From f68b4252b8b85e85db506f02ba8bea92fc013ea5 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Fri, 4 May 2018 17:30:16 -0700 Subject: [PATCH] Sync protobuf to v3.3.0 disable-clang-format Change-Id: I520178aa9bb8fd8a00a7009279bf30d7cdb8d5a8 --- .../bear-640x360-audio.mp4.media_info | 2 +- .../bear-640x360-video.mp4.media_info | 2 +- packager/third_party/protobuf/.gitignore | 72 +- packager/third_party/protobuf/.gitmodules | 3 + packager/third_party/protobuf/.travis.yml | 65 +- packager/third_party/protobuf/BUILD | 253 +- packager/third_party/protobuf/BUILD.gn | 394 +- packager/third_party/protobuf/CHANGES.txt | 414 +- packager/third_party/protobuf/COPYING.txt | 33 - packager/third_party/protobuf/DEPS | 3 + packager/third_party/protobuf/INSTALL.txt | 237 - packager/third_party/protobuf/Makefile.am | 338 +- packager/third_party/protobuf/OWNERS | 2 + .../third_party/protobuf/Protobuf.podspec | 22 +- packager/third_party/protobuf/README.chromium | 106 +- packager/third_party/protobuf/README.md | 31 +- packager/third_party/protobuf/README.txt | 152 - packager/third_party/protobuf/WORKSPACE | 24 +- packager/third_party/protobuf/appveyor.bat | 15 +- packager/third_party/protobuf/appveyor.yml | 18 +- packager/third_party/protobuf/autogen.sh | 13 +- .../protobuf/benchmarks/Makefile.am | 11 +- .../benchmark_messages_proto2.proto | 2 + .../benchmark_messages_proto3.proto | 2 + .../protobuf/benchmarks/cpp_benchmark.cc | 242 + .../protobuf/benchmarks/readme.txt | 22 +- .../third_party/protobuf/cmake/CMakeLists.txt | 44 +- .../third_party/protobuf/cmake/examples.cmake | 57 + .../protobuf/cmake/extract_includes.bat.in | 226 +- .../third_party/protobuf/cmake/install.cmake | 96 +- .../protobuf/cmake/libprotobuf-lite.cmake | 26 +- .../protobuf/cmake/libprotobuf.cmake | 65 +- .../protobuf/cmake/libprotoc.cmake | 126 +- .../cmake/protobuf-config-version.cmake.in | 61 +- .../protobuf/cmake/protobuf-config.cmake.in | 125 +- .../protobuf/cmake/protobuf-module.cmake.in | 193 +- .../protobuf/cmake/protobuf-options.cmake | 7 + .../third_party/protobuf/cmake/tests.cmake | 12 +- packager/third_party/protobuf/composer.json | 20 + packager/third_party/protobuf/config.h | 196 - packager/third_party/protobuf/configure.ac | 35 +- .../protobuf/conformance/ConformanceJava.java | 185 +- .../conformance/ConformanceJavaLite.java | 4 +- .../protobuf/conformance/Makefile.am | 211 +- .../protobuf/conformance/README.md | 32 +- .../protobuf/conformance/autoload.php | 21 + .../protobuf/conformance/conformance.proto | 173 +- .../protobuf/conformance/conformance_cpp.cc | 3 +- .../conformance/conformance_nodejs.js | 168 + .../protobuf/conformance/conformance_objc.m | 1 + .../protobuf/conformance/conformance_php.php | 113 + .../conformance/conformance_python.py | 15 +- .../protobuf/conformance/conformance_ruby.rb | 12 +- .../protobuf/conformance/conformance_test.cc | 1100 +- .../protobuf/conformance/conformance_test.h | 87 +- .../conformance/conformance_test_runner.cc | 16 +- .../protobuf/conformance/failure_list_cpp.txt | 132 +- .../conformance/failure_list_csharp.txt | 20 +- .../conformance/failure_list_java.txt | 82 +- .../protobuf/conformance/failure_list_js.txt | 15 + .../conformance/failure_list_objc.txt | 6 +- .../protobuf/conformance/failure_list_php.txt | 118 + .../conformance/failure_list_php_c.txt | 197 + .../conformance/failure_list_php_zts_c.txt | 225 + .../conformance/failure_list_python.txt | 102 +- .../conformance/failure_list_python_cpp.txt | 130 +- .../conformance/failure_list_ruby.txt | 334 +- .../update_failure_list.py} | 58 +- .../third_party/protobuf/csharp/.gitignore | 21 +- .../csharp/Google.Protobuf.Tools.nuspec | 2 +- .../third_party/protobuf/csharp/README.md | 46 +- .../protobuf/csharp/build_packages.bat | 7 +- .../protobuf/csharp/build_tools.sh | 52 + .../third_party/protobuf/csharp/buildall.sh | 16 +- .../csharp/protos/unittest_issues.proto | 126 + .../google/protobuf/map_unittest_proto3.proto | 120 + .../protobuf/unittest_import_proto3.proto} | 64 +- .../unittest_import_public_proto3.proto} | 19 +- .../src/google/protobuf/unittest_proto3.proto | 388 + .../protobuf/unittest_well_known_types.proto | 114 + .../Google.Protobuf.Test/ByteStringTest.cs | 171 + .../CodedInputStreamExtensions.cs | 53 + .../CodedInputStreamTest.cs | 598 + .../CodedOutputStreamTest.cs | 419 + .../Collections/MapFieldTest.cs | 532 + .../Collections/RepeatedFieldTest.cs | 746 ++ .../PropertyInfoExtensionsTest.cs | 98 + .../Compatibility/TypeExtensionsTest.cs | 117 + .../DeprecatedMemberTest.cs} | 103 +- .../Google.Protobuf.Test/EqualityTester.cs | 64 + .../Google.Protobuf.Test/FieldCodecTest.cs | 196 + .../GeneratedMessageTest.cs | 723 + .../Google.Protobuf.Test.csproj | 30 + .../src/Google.Protobuf.Test/IssuesTest.cs | 82 + .../Google.Protobuf.Test/JsonParserTest.cs | 939 ++ .../Google.Protobuf.Test/JsonTokenizerTest.cs | 408 + .../src/Google.Protobuf.Test/Program.cs | 47 + .../Reflection/DescriptorsTest.cs | 259 + .../Reflection/FieldAccessTest.cs | 218 + .../Reflection/TypeRegistryTest.cs | 94 + .../src/Google.Protobuf.Test/SampleEnum.cs | 42 + .../Google.Protobuf.Test/SampleMessages.cs | 99 + .../Google.Protobuf.Test/TestCornerCases.cs | 62 + .../TestProtos/ForeignMessagePartial.cs | 45 + .../WellKnownTypes/AnyTest.cs | 116 + .../WellKnownTypes/DurationTest.cs | 132 + .../WellKnownTypes/FieldMaskTest.cs | 62 + .../WellKnownTypes/TimestampTest.cs | 115 + .../WellKnownTypes/WrappersTest.cs | 421 + .../csharp/compatibility_tests/v3.0.0/test.sh | 104 + .../protobuf/csharp/generate_protos.sh | 10 +- .../third_party/protobuf/csharp/global.json | 5 + .../unittest_custom_options_proto3.proto | 336 + .../csharp/src/AddressBook/AddPerson.cs | 262 +- .../csharp/src/AddressBook/AddressBook.csproj | 77 +- .../csharp/src/AddressBook/Addressbook.cs | 61 +- .../csharp/src/AddressBook/ListPeople.cs | 196 +- .../csharp/src/AddressBook/Program.cs | 188 +- .../AddressBook/Properties/AssemblyInfo.cs | 18 - .../csharp/src/AddressBook/SampleUsage.cs | 144 +- .../csharp/src/AddressBook/app.config | 3 - .../Google.Protobuf.Conformance/App.config | 6 - .../Conformance.cs | 3254 +---- .../Google.Protobuf.Conformance.csproj | 65 +- .../Google.Protobuf.Conformance/Program.cs | 8 +- .../Google.Protobuf.JsonDump.csproj | 71 +- .../src/Google.Protobuf.JsonDump/Program.cs | 143 +- .../Properties/AssemblyInfo.cs | 19 - .../src/Google.Protobuf.JsonDump/app.config | 3 - .../Google.Protobuf.Test/ByteStringTest.cs | 406 +- .../CodedInputStreamTest.cs | 1201 +- .../CodedOutputStreamTest.cs | 843 +- .../Collections/MapFieldTest.cs | 32 + .../Collections/RepeatedFieldTest.cs | 90 +- .../Compatibility/StreamExtensionsTest.cs | 67 + .../Compatibility/TypeExtensionsTest.cs | 20 +- .../DeprecatedMemberTest.cs | 110 +- .../Google.Protobuf.Test/FieldCodecTest.cs | 8 +- .../GeneratedMessageTest.cs | 1444 +- .../Google.Protobuf.Test.csproj | 167 +- .../src/Google.Protobuf.Test/IssuesTest.cs | 164 +- .../Google.Protobuf.Test/JsonFormatterTest.cs | 126 +- .../Google.Protobuf.Test/JsonParserTest.cs | 3 + .../src/Google.Protobuf.Test/Program.cs | 48 + .../Properties/AppManifest.xml | 6 - .../Properties/AssemblyInfo.cs | 20 - .../Reflection/CustomOptionsTest.cs | 271 + .../Google.Protobuf.Test/TestCornerCases.cs | 124 +- .../TestProtos/MapUnittestProto3.cs | 156 +- .../TestProtos/TestMessagesProto3.cs | 3688 ++++++ .../TestProtos/UnittestCustomOptionsProto3.cs | 2625 ++++ .../TestProtos/UnittestImportProto3.cs | 17 +- .../TestProtos/UnittestImportPublicProto3.cs | 17 +- .../TestProtos/UnittestIssues.cs | 239 +- .../TestProtos/UnittestProto3.cs | 1050 +- .../TestProtos/UnittestWellKnownTypes.cs | 154 +- .../WellKnownTypes/AnyTest.cs | 30 +- .../WellKnownTypes/FieldMaskTest.cs | 4 +- .../src/Google.Protobuf.Test/packages.config | 5 - .../csharp/src/Google.Protobuf/ByteArray.cs | 156 +- .../csharp/src/Google.Protobuf/ByteString.cs | 744 +- .../src/Google.Protobuf/CodedInputStream.cs | 2551 ++-- .../CodedOutputStream.ComputeSize.cs | 606 +- .../src/Google.Protobuf/CodedOutputStream.cs | 1522 +-- .../Google.Protobuf/Collections/MapField.cs | 53 +- .../Collections/ReadOnlyDictionary.cs | 292 +- .../Collections/RepeatedField.cs | 120 +- .../Compatibility/PropertyInfoExtensions.cs | 8 + .../Compatibility/StreamExtensions.cs} | 62 +- .../Compatibility/TypeExtensions.cs | 11 +- .../csharp/src/Google.Protobuf/FieldCodec.cs | 3 +- .../Google.Protobuf/FrameworkPortability.cs | 96 +- .../Google.Protobuf/Google.Protobuf.csproj | 195 +- .../Google.Protobuf/Google.Protobuf.nuspec | 54 - .../csharp/src/Google.Protobuf/IMessage.cs | 174 +- .../InvalidProtocolBufferException.cs | 256 +- .../src/Google.Protobuf/JsonFormatter.cs | 186 +- .../csharp/src/Google.Protobuf/JsonParser.cs | 3 +- .../Properties/AssemblyInfo.cs | 116 +- .../Reflection/CustomOptions.cs | 390 + .../Google.Protobuf/Reflection/Descriptor.cs | 1751 ++- .../Reflection/EnumDescriptor.cs | 5 + .../Reflection/EnumValueDescriptor.cs | 5 + .../Reflection/FieldDescriptor.cs | 7 +- .../Reflection/FileDescriptor.cs | 18 +- .../Reflection/MessageDescriptor.cs | 9 + .../Reflection/MethodDescriptor.cs | 5 + .../Reflection/OneofDescriptor.cs | 5 + .../Reflection/OriginalNameAttribute.cs | 9 +- .../Reflection/PartialClasses.cs | 116 +- .../Reflection/ServiceDescriptor.cs | 5 + .../src/Google.Protobuf/WellKnownTypes/Any.cs | 166 +- .../WellKnownTypes/AnyPartial.cs | 43 +- .../src/Google.Protobuf/WellKnownTypes/Api.cs | 267 +- .../WellKnownTypes/Duration.cs | 119 +- .../Google.Protobuf/WellKnownTypes/Empty.cs | 38 +- .../WellKnownTypes/FieldMask.cs | 307 +- .../WellKnownTypes/FieldMaskPartial.cs | 13 +- .../WellKnownTypes/SourceContext.cs | 32 +- .../Google.Protobuf/WellKnownTypes/Struct.cs | 110 +- .../WellKnownTypes/TimeExtensions.cs | 4 - .../WellKnownTypes/Timestamp.cs | 141 +- .../Google.Protobuf/WellKnownTypes/Type.cs | 241 +- .../WellKnownTypes/Wrappers.cs | 205 +- .../csharp/src/Google.Protobuf/WireFormat.cs | 206 +- .../src/Google.Protobuf/packages.config | 4 - .../csharp/src/packages/repositories.config | 4 - .../third_party/protobuf/descriptor_pb2.py | 1172 -- .../protobuf/docs/swift/DesignDoc.md | 674 - .../third_party/protobuf/docs/third_party.md | 21 +- .../protobuf/editors/protobuf-mode.el | 5 +- .../protobuf/examples/CMakeLists.txt | 48 + .../protobuf/generate_changelog.py | 66 + .../protobuf/generate_descriptor_proto.sh | 28 +- packager/third_party/protobuf/gmock.BUILD | 20 +- packager/third_party/protobuf/java/README.md | 85 +- packager/third_party/protobuf/java/README.txt | 96 - .../java/compatibility_tests/README.md | 50 + .../compatibility_tests/v2.5.0/deps/pom.xml | 43 + .../v2.5.0/more_protos/pom.xml | 69 + .../google/protobuf/multiple_files_test.proto | 0 .../protobuf/nested_builders_test.proto | 0 .../google/protobuf/nested_extension.proto | 0 .../protobuf/nested_extension_lite.proto | 0 .../protobuf/non_nested_extension.proto | 0 .../protobuf/non_nested_extension_lite.proto | 0 .../protobuf/test_bad_identifiers.proto | 0 .../proto/google/protobuf/descriptor.proto | 620 + .../src/proto/google/protobuf/unittest.proto | 719 + .../protobuf/unittest_custom_options.proto | 387 + .../unittest_embed_optimize_for.proto | 50 + .../google/protobuf/unittest_empty.proto | 37 + .../unittest_enormous_descriptor.proto | 1046 ++ .../google/protobuf/unittest_import.proto | 64 + .../protobuf/unittest_import_lite.proto} | 34 +- .../protobuf/unittest_import_public.proto} | 27 +- .../unittest_import_public_lite.proto | 42 + .../proto/google/protobuf/unittest_lite.proto | 360 + .../unittest_lite_imports_nonlite.proto | 43 + .../proto/google/protobuf/unittest_mset.proto | 72 + .../unittest_no_generic_services.proto | 52 + .../protobuf/unittest_optimize_for.proto} | 47 +- .../java/compatibility_tests/v2.5.0/pom.xml | 30 + .../compatibility_tests/v2.5.0/protos/pom.xml | 71 + .../google/protobuf/multiple_files_test.proto | 71 + .../protobuf/nested_builders_test.proto | 53 + .../google/protobuf/nested_extension.proto} | 25 +- .../protobuf/nested_extension_lite.proto | 48 + .../protobuf/non_nested_extension.proto | 48 + .../protobuf/non_nested_extension_lite.proto | 50 + .../protobuf/test_bad_identifiers.proto | 108 + .../proto/google/protobuf/descriptor.proto | 620 + .../src/proto/google/protobuf/unittest.proto | 719 + .../protobuf/unittest_custom_options.proto | 387 + .../unittest_embed_optimize_for.proto | 50 + .../google/protobuf/unittest_empty.proto | 37 + .../unittest_enormous_descriptor.proto | 1046 ++ .../google/protobuf/unittest_import.proto | 64 + .../protobuf/unittest_import_lite.proto | 51 + .../protobuf/unittest_import_public.proto | 40 + .../unittest_import_public_lite.proto | 42 + .../proto/google/protobuf/unittest_lite.proto | 360 + .../unittest_lite_imports_nonlite.proto | 43 + .../proto/google/protobuf/unittest_mset.proto | 72 + .../unittest_no_generic_services.proto | 52 + .../protobuf/unittest_optimize_for.proto | 61 + .../java/compatibility_tests/v2.5.0/test.sh | 140 + .../compatibility_tests/v2.5.0/tests/pom.xml | 73 + .../protobuf/test}/AbstractMessageTest.java | 3 +- .../protobuf/test}/BoundedByteStringTest.java | 16 +- .../google/protobuf/test}/ByteStringTest.java | 106 +- .../protobuf/test}/CodedInputStreamTest.java | 75 +- .../protobuf/test}/CodedOutputStreamTest.java | 3 +- .../protobuf/test}/DeprecatedFieldTest.java | 3 +- .../protobuf/test}/DescriptorsTest.java | 3 +- .../protobuf/test}/DynamicMessageTest.java | 3 +- .../test}/ForceFieldBuildersPreRun.java | 5 +- .../protobuf/test}/GeneratedMessageTest.java | 189 +- .../test}/LazyStringArrayListTest.java | 3 +- .../test}/LazyStringEndToEndTest.java | 39 +- .../protobuf/test}/LiteralByteStringTest.java | 56 +- .../google/protobuf/test}/MessageTest.java | 3 +- .../protobuf/test}/NestedBuildersTest.java | 3 +- .../com/google/protobuf/test}/ParserTest.java | 101 +- .../test}/RopeByteStringSubstringTest.java | 39 +- .../protobuf/test}/RopeByteStringTest.java | 35 +- .../google/protobuf/test}/ServiceTest.java | 3 +- .../protobuf/test}/TestBadIdentifiers.java | 3 +- .../com/google/protobuf/test}/TestUtil.java | 903 +- .../google/protobuf/test}/TextFormatTest.java | 254 +- .../protobuf/test}/UnknownFieldSetTest.java | 3 +- .../test}/UnmodifiableLazyStringListTest.java | 3 +- .../google/protobuf/test}/WireFormatTest.java | 119 +- .../third_party/protobuf/java/core/pom.xml | 38 +- .../com/google/protobuf/AbstractMessage.java | 102 +- .../google/protobuf/AbstractMessageLite.java | 66 +- .../com/google/protobuf/AbstractParser.java | 28 +- .../com/google/protobuf/BooleanArrayList.java | 54 +- .../com/google/protobuf/ByteBufferWriter.java | 50 +- .../java/com/google/protobuf/ByteOutput.java | 4 +- .../java/com/google/protobuf/ByteString.java | 60 +- .../com/google/protobuf/CodedInputStream.java | 3658 +++-- .../google/protobuf/CodedOutputStream.java | 551 +- .../java/com/google/protobuf/Descriptors.java | 52 +- .../com/google/protobuf/DoubleArrayList.java | 58 +- .../com/google/protobuf/DynamicMessage.java | 17 +- .../google/protobuf/ExtensionRegistry.java | 12 +- .../protobuf/ExtensionRegistryFactory.java | 95 + .../protobuf/ExtensionRegistryLite.java | 58 +- .../java/com/google/protobuf/FieldSet.java | 34 +- .../com/google/protobuf/FloatArrayList.java | 57 +- .../com/google/protobuf/GeneratedMessage.java | 206 +- .../google/protobuf/GeneratedMessageLite.java | 421 +- .../google/protobuf/GeneratedMessageV3.java} | 1749 ++- .../com/google/protobuf/IntArrayList.java | 57 +- .../java/com/google/protobuf/Internal.java | 45 +- .../InvalidProtocolBufferException.java | 16 +- .../com/google/protobuf/LazyFieldLite.java | 26 +- .../com/google/protobuf/LongArrayList.java | 59 +- .../java/com/google/protobuf/MapEntry.java | 246 +- .../com/google/protobuf/MapEntryLite.java | 330 +- .../java/com/google/protobuf/MapField.java | 420 +- .../com/google/protobuf/MapFieldLite.java | 465 +- .../google/protobuf/MessageLiteToString.java | 4 +- .../google/protobuf/MessageReflection.java | 3 - .../com/google/protobuf/NioByteString.java | 9 +- .../main/java/com/google/protobuf/Parser.java | 15 +- .../PrimitiveNonBoxingCollection.java | 34 + .../protobuf/RepeatedFieldBuilderV3.java} | 138 +- .../com/google/protobuf/RopeByteString.java | 1 + .../protobuf/SingleFieldBuilderV3.java} | 44 +- .../com/google/protobuf/SmallSortedMap.java | 21 +- .../java/com/google/protobuf/TextFormat.java | 131 +- .../protobuf/TextFormatParseInfoTree.java | 5 +- .../com/google/protobuf/UnknownFieldSet.java | 41 +- .../google/protobuf/UnknownFieldSetLite.java | 62 +- .../google/protobuf/UnsafeByteOperations.java | 48 +- .../java/com/google/protobuf/UnsafeUtil.java | 510 + .../main/java/com/google/protobuf/Utf8.java | 250 +- .../java/com/google/protobuf/WireFormat.java | 4 + .../google/protobuf/AbstractMessageTest.java | 4 +- .../google/protobuf/BooleanArrayListTest.java | 193 +- .../google/protobuf/ByteBufferWriterTest.java | 3 +- .../com/google/protobuf/ByteStringTest.java | 4 +- .../google/protobuf/CodedInputStreamTest.java | 852 +- .../protobuf/CodedOutputStreamTest.java | 55 +- .../google/protobuf/DeprecatedFieldTest.java | 4 +- .../com/google/protobuf/DescriptorsTest.java | 23 +- .../google/protobuf/DoubleArrayListTest.java | 152 +- .../google/protobuf/DynamicMessageTest.java | 4 +- .../ExtensionRegistryFactoryTest.java | 276 + .../google/protobuf/FieldPresenceTest.java | 70 + .../google/protobuf/FloatArrayListTest.java | 152 +- .../google/protobuf/GeneratedMessageTest.java | 8 +- .../com/google/protobuf/IntArrayListTest.java | 146 +- .../google/protobuf/LazyFieldLiteTest.java | 28 +- .../com/google/protobuf/LazyFieldTest.java | 4 +- .../google/protobuf/LazyMessageLiteTest.java | 34 +- .../protobuf/LazyStringArrayListTest.java | 7 +- .../protobuf/LazyStringEndToEndTest.java | 4 +- .../protobuf/LiteEqualsAndHashTest.java | 2 +- .../java/com/google/protobuf/LiteTest.java | 174 +- .../protobuf/LiteralByteStringTest.java | 3 +- .../google/protobuf/LongArrayListTest.java | 188 +- .../google/protobuf/MapForProto2LiteTest.java | 720 +- .../com/google/protobuf/MapForProto2Test.java | 724 +- .../java/com/google/protobuf/MapTest.java | 912 +- .../java/com/google/protobuf/MessageTest.java | 4 +- .../google/protobuf/NestedBuildersTest.java | 4 +- .../google/protobuf/NioByteStringTest.java | 3 +- .../google/protobuf/ParseExceptionsTest.java | 8 +- .../java/com/google/protobuf/ParserTest.java | 71 +- .../protobuf/ProtobufArrayListTest.java | 3 +- ...t.java => RepeatedFieldBuilderV3Test.java} | 30 +- .../java/com/google/protobuf/ServiceTest.java | 8 +- ...est.java => SingleFieldBuilderV3Test.java} | 20 +- .../google/protobuf/SmallSortedMapTest.java | 3 +- .../java/com/google/protobuf/TestUtil.java | 21 +- .../com/google/protobuf/TextFormatTest.java | 126 +- .../protobuf/UnknownFieldSetLiteTest.java | 12 +- .../google/protobuf/UnknownFieldSetTest.java | 4 +- .../UnmodifiableLazyStringListTest.java | 3 +- .../com/google/protobuf/WireFormatTest.java | 4 +- .../google/protobuf/field_presence_test.proto | 3 +- .../protobuf/lite_equals_and_hash.proto | 8 + .../protobuf/map_for_proto2_lite_test.proto | 48 +- .../google/protobuf/map_for_proto2_test.proto | 48 +- .../proto/com/google/protobuf/map_test.proto | 51 +- .../protobuf/test_bad_identifiers.proto | 1 - .../third_party/protobuf/java/lite/pom.xml | 35 +- packager/third_party/protobuf/java/pom.xml | 38 +- .../com/google/protobuf/AbstractMessage.java | 930 -- .../google/protobuf/AbstractMessageLite.java | 343 - .../com/google/protobuf/AbstractParser.java | 261 - .../google/protobuf/BoundedByteString.java | 163 - .../java/com/google/protobuf/ByteString.java | 970 -- .../com/google/protobuf/CodedInputStream.java | 920 -- .../google/protobuf/CodedOutputStream.java | 1111 -- .../java/com/google/protobuf/Descriptors.java | 1970 --- .../com/google/protobuf/DynamicMessage.java | 482 - .../google/protobuf/ExtensionRegistry.java | 266 - .../protobuf/ExtensionRegistryLite.java | 185 - .../java/com/google/protobuf/FieldSet.java | 861 -- .../google/protobuf/GeneratedMessageLite.java | 797 -- .../java/com/google/protobuf/Internal.java | 153 - .../InvalidProtocolBufferException.java | 114 - .../java/com/google/protobuf/LazyField.java | 210 - .../google/protobuf/LazyStringArrayList.java | 178 - .../com/google/protobuf/LazyStringList.java | 81 - .../google/protobuf/LiteralByteString.java | 349 - .../java/com/google/protobuf/Message.java | 237 - .../java/com/google/protobuf/MessageLite.java | 319 - .../com/google/protobuf/MessageOrBuilder.java | 129 - .../main/java/com/google/protobuf/Parser.java | 259 - .../com/google/protobuf/RopeByteString.java | 943 -- .../java/com/google/protobuf/RpcChannel.java | 71 - .../com/google/protobuf/RpcController.java | 118 - .../java/com/google/protobuf/RpcUtil.java | 135 - .../java/com/google/protobuf/Service.java | 117 - .../com/google/protobuf/SmallSortedMap.java | 618 - .../java/com/google/protobuf/TextFormat.java | 1559 --- .../UninitializedMessageException.java | 99 - .../com/google/protobuf/UnknownFieldSet.java | 978 -- .../protobuf/UnmodifiableLazyStringList.java | 152 - .../main/java/com/google/protobuf/Utf8.java | 349 - .../java/com/google/protobuf/WireFormat.java | 163 - .../com/google/protobuf/IsValidUtf8Test.java | 180 - .../google/protobuf/IsValidUtf8TestUtil.java | 421 - .../java/com/google/protobuf/LiteTest.java | 148 - .../protobuf/RepeatedFieldBuilderTest.java | 190 - .../protobuf/SingleFieldBuilderTest.java | 155 - .../google/protobuf/SmallSortedMapTest.java | 420 - .../third_party/protobuf/java/util/pom.xml | 26 +- .../com/google/protobuf/util/Durations.java | 302 + .../google/protobuf/util/FieldMaskTree.java | 55 +- .../google/protobuf/util/FieldMaskUtil.java | 78 +- .../com/google/protobuf/util/JsonFormat.java | 1082 +- .../com/google/protobuf/util/TimeUtil.java | 381 +- .../com/google/protobuf/util/Timestamps.java | 397 + .../protobuf/util/FieldMaskUtilTest.java | 113 +- .../google/protobuf/util/JsonFormatTest.java | 1157 +- .../google/protobuf/util/TimeUtilTest.java | 98 +- .../com/google/protobuf/util/json_test.proto | 37 +- .../third_party/protobuf/javanano/README.md | 3 + .../third_party/protobuf/javanano/pom.xml | 10 +- .../google/protobuf/nano/InternalNano.java | 4 +- .../InvalidProtocolBufferNanoException.java | 2 +- .../protobuf/nano/MessageNanoPrinter.java | 2 +- .../com/google/protobuf/nano/NanoTest.java | 5 +- .../protobuf/jenkins/build_and_run_docker.sh | 1 + .../jenkins/buildcmds/pull_request.sh | 1 + .../jenkins/buildcmds/pull_request_32.sh | 16 + .../protobuf/jenkins/docker/Dockerfile | 125 +- .../protobuf/jenkins/docker32/Dockerfile | 143 + .../jenkins/pull_request_in_docker.sh | 12 +- packager/third_party/protobuf/js/README.md | 13 +- .../protobuf/js/binary/constants.js | 4 +- .../third_party/protobuf/js/binary/decoder.js | 96 +- .../protobuf/js/binary/decoder_test.js | 45 +- .../third_party/protobuf/js/binary/encoder.js | 74 +- .../protobuf/js/binary/message_test.js | 60 + .../protobuf/js/binary/proto_test.js | 49 +- .../third_party/protobuf/js/binary/reader.js | 98 +- .../protobuf/js/binary/reader_test.js | 73 +- .../third_party/protobuf/js/binary/utils.js | 14 +- .../protobuf/js/binary/utils_test.js | 24 +- .../third_party/protobuf/js/binary/writer.js | 475 +- .../protobuf/js/binary/writer_test.js | 4 +- .../protobuf/js/commonjs/export.js | 9 + .../protobuf/js/commonjs/export_asserts.js | 4 + .../protobuf/js/commonjs/export_testdeps.js | 5 + .../v3.0.0/binary/arith_test.js | 355 + .../v3.0.0/binary/decoder_test.js | 334 + .../v3.0.0/binary/proto_test.js | 628 + .../v3.0.0/binary/reader_test.js | 922 ++ .../v3.0.0/binary/utils_test.js | 668 + .../v3.0.0/binary/writer_test.js | 122 + .../v3.0.0/commonjs/export_asserts.js | 37 + .../v3.0.0/commonjs/export_testdeps.js | 18 + .../v3.0.0/commonjs/import_test.js | 52 + .../v3.0.0/commonjs/jasmine.json | 9 + .../commonjs/rewrite_tests_for_commonjs.js | 97 + .../v3.0.0/commonjs/test6/test6.proto | 40 + .../v3.0.0/commonjs/test7/test7.proto | 42 + .../js/compatibility_tests/v3.0.0/data.proto | 51 + .../compatibility_tests/v3.0.0/debug_test.js | 105 + .../compatibility_tests/v3.0.0/jasmine1.json | 17 + .../compatibility_tests/v3.0.0/jasmine2.json | 17 + .../compatibility_tests/v3.0.0/jasmine3.json | 17 + .../v3.0.0/message_test.js | 1080 ++ .../compatibility_tests/v3.0.0/proto3_test.js | 329 + .../v3.0.0/proto3_test.proto | 89 + .../js/compatibility_tests/v3.0.0/test.proto | 236 + .../js/compatibility_tests/v3.0.0/test.sh | 92 + .../js/compatibility_tests/v3.0.0/test2.proto | 54 + .../js/compatibility_tests/v3.0.0/test3.proto | 53 + .../js/compatibility_tests/v3.0.0/test4.proto | 42 + .../js/compatibility_tests/v3.0.0/test5.proto | 44 + .../v3.0.0/testbinary.proto | 212 + .../v3.0.0/testempty.proto | 34 + packager/third_party/protobuf/js/debug.js | 5 +- .../third_party/protobuf/js/debug_test.js | 2 +- packager/third_party/protobuf/js/gulpfile.js | 128 +- packager/third_party/protobuf/js/jasmine.json | 7 +- packager/third_party/protobuf/js/map.js | 531 + packager/third_party/protobuf/js/maps_test.js | 350 + packager/third_party/protobuf/js/message.js | 362 +- .../third_party/protobuf/js/message_test.js | 194 +- packager/third_party/protobuf/js/package.json | 18 +- .../third_party/protobuf/js/proto3_test.js | 79 +- packager/third_party/protobuf/js/test.proto | 43 + packager/third_party/protobuf/js/test2.proto | 6 + packager/third_party/protobuf/js/test8.proto | 50 + .../third_party/protobuf/js/testbinary.proto | 27 + .../third_party/protobuf/kokoro/README.md | 6 + .../kokoro/linux/cpp_distcheck/build.sh | 11 + .../kokoro/linux/cpp_distcheck/continuous.cfg | 5 + .../kokoro/linux/cpp_distcheck/presubmit.cfg | 5 + .../protobuf/kokoro/linux/csharp/build.sh | 11 + .../kokoro/linux/csharp/continuous.cfg | 5 + .../kokoro/linux/csharp/presubmit.cfg | 5 + .../kokoro/linux/java_compatibility/build.sh | 11 + .../linux/java_compatibility/continuous.cfg | 5 + .../linux/java_compatibility/presubmit.cfg | 5 + .../kokoro/linux/prepare_build_linux_rc | 9 + .../linux/python_compatibility/build.sh | 11 + .../linux/python_compatibility/continuous.cfg | 5 + .../linux/python_compatibility/presubmit.cfg | 5 + .../protobuf/kokoro/macos/cpp/build.sh | 11 + .../protobuf/kokoro/macos/cpp/continuous.cfg | 5 + .../protobuf/kokoro/macos/cpp/presubmit.cfg | 5 + .../kokoro/macos/cpp_distcheck/build.sh | 11 + .../kokoro/macos/cpp_distcheck/continuous.cfg | 5 + .../kokoro/macos/cpp_distcheck/presubmit.cfg | 5 + .../protobuf/kokoro/macos/javascript/build.sh | 11 + .../kokoro/macos/javascript/continuous.cfg | 5 + .../kokoro/macos/javascript/presubmit.cfg | 5 + .../protobuf/kokoro/macos/jruby/build.sh | 11 + .../kokoro/macos/jruby/continuous.cfg | 5 + .../protobuf/kokoro/macos/jruby/presubmit.cfg | 5 + .../objectivec_cocoapods_integration/build.sh | 11 + .../continuous.cfg | 5 + .../presubmit.cfg | 5 + .../macos/objectivec_ios_debug/build.sh | 11 + .../macos/objectivec_ios_debug/continuous.cfg | 5 + .../macos/objectivec_ios_debug/presubmit.cfg | 5 + .../macos/objectivec_ios_release/build.sh | 11 + .../objectivec_ios_release/continuous.cfg | 5 + .../objectivec_ios_release/presubmit.cfg | 5 + .../kokoro/macos/objectivec_osx/build.sh | 11 + .../macos/objectivec_osx/continuous.cfg | 5 + .../kokoro/macos/objectivec_osx/presubmit.cfg | 5 + .../protobuf/kokoro/macos/php5.6_mac/build.sh | 11 + .../kokoro/macos/php5.6_mac/continuous.cfg | 5 + .../kokoro/macos/php5.6_mac/presubmit.cfg | 5 + .../protobuf/kokoro/macos/php7.0_mac/build.sh | 11 + .../kokoro/macos/php7.0_mac/continuous.cfg | 5 + .../kokoro/macos/php7.0_mac/presubmit.cfg | 5 + .../kokoro/macos/prepare_build_macos_rc | 33 + .../protobuf/kokoro/macos/python/build.sh | 11 + .../kokoro/macos/python/continuous.cfg | 5 + .../kokoro/macos/python/presubmit.cfg | 5 + .../protobuf/kokoro/macos/python_cpp/build.sh | 12 + .../kokoro/macos/python_cpp/continuous.cfg | 5 + .../kokoro/macos/python_cpp/presubmit.cfg | 5 + .../protobuf/kokoro/macos/ruby21/build.sh | 11 + .../kokoro/macos/ruby21/continuous.cfg | 5 + .../kokoro/macos/ruby21/presubmit.cfg | 5 + .../protobuf/kokoro/macos/ruby22/build.sh | 11 + .../kokoro/macos/ruby22/continuous.cfg | 5 + .../kokoro/macos/ruby22/presubmit.cfg | 5 + .../protobuf/m4/ax_cxx_compile_stdcxx.m4 | 982 ++ .../protobuf/m4/ax_prog_cc_for_build.m4 | 125 + .../protobuf/m4/ax_prog_cxx_for_build.m4 | 110 + packager/third_party/protobuf/mirclient.cc | 469 + packager/third_party/protobuf/mirclient.map | 30 + .../protobuf/objectivec/.gitignore | 23 + .../DevTools/check_version_stamps.sh | 63 +- .../DevTools/compile_testing_protos.sh | 93 +- .../objectivec/DevTools/full_mac_build.sh | 140 +- .../protobuf/objectivec/GPBArray.h | 1494 ++- .../protobuf/objectivec/GPBArray.m | 95 +- .../protobuf/objectivec/GPBBootstrap.h | 68 +- .../protobuf/objectivec/GPBCodedInputStream.h | 227 +- .../protobuf/objectivec/GPBCodedInputStream.m | 99 +- .../objectivec/GPBCodedOutputStream.h | 608 +- .../objectivec/GPBCodedOutputStream.m | 56 +- .../protobuf/objectivec/GPBDescriptor.h | 165 +- .../protobuf/objectivec/GPBDescriptor.m | 145 +- .../objectivec/GPBDescriptor_PackagePrivate.h | 42 +- .../protobuf/objectivec/GPBDictionary.h | 7529 ++++++++++- .../protobuf/objectivec/GPBDictionary.m | 4782 ++++--- .../objectivec/GPBExtensionInternals.m | 11 + .../objectivec/GPBExtensionRegistry.h | 71 +- .../objectivec/GPBExtensionRegistry.m | 80 +- .../protobuf/objectivec/GPBMessage.h | 566 +- .../protobuf/objectivec/GPBMessage.m | 184 +- .../objectivec/GPBMessage_PackagePrivate.h | 11 +- .../protobuf/objectivec/GPBProtocolBuffers.h | 39 +- .../protobuf/objectivec/GPBProtocolBuffers.m | 14 +- .../protobuf/objectivec/GPBRootObject.h | 13 +- .../protobuf/objectivec/GPBRootObject.m | 21 +- .../protobuf/objectivec/GPBRuntimeTypes.h | 72 +- .../protobuf/objectivec/GPBUnknownField.h | 66 +- .../protobuf/objectivec/GPBUnknownField.m | 8 + .../protobuf/objectivec/GPBUnknownFieldSet.h | 47 +- .../protobuf/objectivec/GPBUnknownFieldSet.m | 54 +- .../GPBUnknownField_PackagePrivate.h | 2 - .../protobuf/objectivec/GPBUtilities.h | 498 +- .../protobuf/objectivec/GPBUtilities.m | 330 +- .../objectivec/GPBUtilities_PackagePrivate.h | 29 +- .../protobuf/objectivec/GPBWellKnownTypes.h | 205 +- .../protobuf/objectivec/GPBWellKnownTypes.m | 189 +- .../protobuf/objectivec/GPBWireFormat.h | 1 + .../protobuf/objectivec/GPBWireFormat.m | 7 + .../third_party/protobuf/objectivec/README.md | 42 +- .../OSXCocoaPodsTester/AppDelegate.h | 37 + .../OSXCocoaPodsTester/AppDelegate.m | 48 + .../AppIcon.appiconset/Contents.json | 58 + .../Base.lproj/MainMenu.xib | 680 + .../OSXCocoaPodsTester/Info.plist | 34 + .../OSXCocoaPodsTester/main.m | 35 + .../OSXCocoaPodsTester/Podfile-framework | 10 + .../OSXCocoaPodsTester/Podfile-static | 8 + .../objectivec/Tests/CocoaPods/README.md | 9 + .../iOSCocoaPodsTester/Podfile-framework | 10 + .../iOSCocoaPodsTester/Podfile-static | 8 + .../iOSCocoaPodsTester/AppDelegate.h | 39 + .../iOSCocoaPodsTester/AppDelegate.m | 67 + .../AppIcon.appiconset/Contents.json | 68 + .../Base.lproj/LaunchScreen.storyboard | 27 + .../Base.lproj/Main.storyboard | 26 + .../iOSCocoaPodsTester/Info.plist | 47 + .../iOSCocoaPodsTester/ViewController.h | 37 + .../iOSCocoaPodsTester/ViewController.m | 49 + .../iOSCocoaPodsTester/main.m | 39 + .../objectivec/Tests/CocoaPods/run_tests.sh | 150 + .../objectivec/Tests/GPBARCUnittestProtos.m | 2 + .../protobuf/objectivec/Tests/GPBArrayTests.m | 173 + .../Tests/GPBCodedOuputStreamTests.m | 86 + .../objectivec/Tests/GPBDescriptorTests.m | 37 + .../Tests/GPBDictionaryTests+Bool.m | 1020 +- .../Tests/GPBDictionaryTests+Int32.m | 2044 +-- .../Tests/GPBDictionaryTests+Int64.m | 2044 +-- .../Tests/GPBDictionaryTests+String.m | 2036 +-- .../Tests/GPBDictionaryTests+UInt32.m | 2044 +-- .../Tests/GPBDictionaryTests+UInt64.m | 2044 +-- .../objectivec/Tests/GPBDictionaryTests.m | 186 + .../objectivec/Tests/GPBDictionaryTests.pddm | 428 +- .../Tests/GPBExtensionRegistryTest.m | 138 + .../Tests/GPBMessageTests+Runtime.m | 439 +- .../Tests/GPBMessageTests+Serialization.m | 266 +- .../objectivec/Tests/GPBMessageTests.m | 39 +- .../protobuf/objectivec/Tests/GPBPerfTests.m | 106 + .../objectivec/Tests/GPBSwiftTests.swift | 314 +- .../objectivec/Tests/GPBTestUtilities.m | 30 +- .../objectivec/Tests/GPBUnittestProtos.m | 11 + .../objectivec/Tests/GPBUnittestProtos2.m | 34 + .../objectivec/Tests/GPBUnknownFieldSetTest.m | 4 - .../objectivec/Tests/GPBUtilitiesTests.m | 227 + .../objectivec/Tests/GPBWellKnownTypesTest.m | 206 +- .../objectivec/Tests/GPBWireFormatTests.m | 8 +- .../objectivec/Tests/unittest_cycle.proto | 6 +- .../Tests/unittest_deprecated.proto | 95 + .../Tests/unittest_deprecated_file.proto | 76 + .../Tests/unittest_extension_chain_a.proto | 51 + .../Tests/unittest_extension_chain_b.proto | 47 + .../Tests/unittest_extension_chain_c.proto | 45 + .../Tests/unittest_extension_chain_d.proto | 49 + .../Tests/unittest_extension_chain_e.proto | 40 + .../Tests/unittest_extension_chain_f.proto | 44 + .../Tests/unittest_extension_chain_g.proto | 41 + .../objectivec/Tests/unittest_objc.proto | 18 + .../objectivec/google/protobuf/Any.pbobjc.h | 213 +- .../objectivec/google/protobuf/Any.pbobjc.m | 29 +- .../objectivec/google/protobuf/Api.pbobjc.h | 323 +- .../objectivec/google/protobuf/Api.pbobjc.m | 56 +- .../google/protobuf/Duration.pbobjc.h | 158 +- .../google/protobuf/Duration.pbobjc.m | 27 +- .../objectivec/google/protobuf/Empty.pbobjc.h | 57 +- .../objectivec/google/protobuf/Empty.pbobjc.m | 27 +- .../google/protobuf/FieldMask.pbobjc.h | 393 +- .../google/protobuf/FieldMask.pbobjc.m | 27 +- .../google/protobuf/SourceContext.pbobjc.h | 49 +- .../google/protobuf/SourceContext.pbobjc.m | 27 +- .../google/protobuf/Struct.pbobjc.h | 143 +- .../google/protobuf/Struct.pbobjc.m | 36 +- .../google/protobuf/Timestamp.pbobjc.h | 186 +- .../google/protobuf/Timestamp.pbobjc.m | 27 +- .../objectivec/google/protobuf/Type.pbobjc.h | 303 +- .../objectivec/google/protobuf/Type.pbobjc.m | 62 +- .../google/protobuf/Wrappers.pbobjc.h | 127 +- .../google/protobuf/Wrappers.pbobjc.m | 43 +- ...-ignore-option-retain-unknown-fields.patch | 21 - ...ger-types-and-shared-library-exports.patch | 30 +- .../0005-fix-include-js-generator.patch | 11 - .../0008-uninline_get_empty_string.patch | 10 +- .../patches/0009-uninline-arenastring.patch | 20 +- .../0010-uninline-generated-code.patch | 14 - .../patches/0011-libprotobuf_export.patch | 11 - .../patches/0012-fixes-for-js-embed-cc.patch | 25 + .../0013-fixes-expansion-to-defined.patch | 18 + .../0014-truncate-uint8-constants.patch | 192 + .../0015-fixes-forcing-value-to-bool.patch | 17 + .../0016-fixes-limit-for-msvc-c1091.patch | 12 + .../patches/0017-constexpr-for-vs-2017.patch | 14 + .../protobuf/patches/0018-fallthrough.patch | 38 + .../0019-rename-a-shadowed-variable.patch | 31 + ...0020-Add-support-for-libc-on-Windows.patch | 42 + packager/third_party/protobuf/php/README.md | 97 + .../third_party/protobuf/php/composer.json | 25 + .../protobuf/php/ext/google/protobuf/array.c | 517 + .../php/ext/google/protobuf/config.m4 | 8 +- .../protobuf/php/ext/google/protobuf/def.c | 795 +- .../php/ext/google/protobuf/encode_decode.c | 1565 +++ .../protobuf/php/ext/google/protobuf/map.c | 561 + .../php/ext/google/protobuf/message.c | 467 +- .../php/ext/google/protobuf/package.xml | 140 + .../php/ext/google/protobuf/protobuf.c | 198 +- .../php/ext/google/protobuf/protobuf.h | 929 +- .../php/ext/google/protobuf/storage.c | 1077 +- .../protobuf/php/ext/google/protobuf/test.php | 15 - .../php/ext/google/protobuf/type_check.c | 567 + .../protobuf/php/ext/google/protobuf/upb.c | 6141 ++++++--- .../protobuf/php/ext/google/protobuf/upb.h | 3985 +++--- .../protobuf/php/ext/google/protobuf/utf8.c | 68 + .../protobuf/php/ext/google/protobuf/utf8.h | 36 + .../php/generate_descriptor_protos.sh | 16 + packager/third_party/protobuf/php/phpunit.xml | 16 + .../Google/Protobuf/Internal/Descriptor.php | 263 + .../Protobuf/Internal/CodedInputStream.php | 373 + .../Protobuf/Internal/CodedOutputStream.php | 159 + .../Google/Protobuf/Internal/Descriptor.php | 189 + .../Protobuf/Internal/DescriptorPool.php | 165 + .../Protobuf/Internal/DescriptorProto.php | 366 + .../DescriptorProto_ExtensionRange.php | 91 + .../DescriptorProto_ReservedRange.php | 107 + .../Protobuf/Internal/EnumBuilderContext.php | 63 + .../Protobuf/Internal/EnumDescriptor.php | 72 + .../Protobuf/Internal/EnumDescriptorProto.php | 126 + .../Google/Protobuf/Internal/EnumOptions.php | 154 + .../Protobuf/Internal/EnumValueDescriptor.php | 59 + .../Internal/EnumValueDescriptorProto.php | 126 + .../Protobuf/Internal/EnumValueOptions.php | 112 + .../Protobuf/Internal/FieldDescriptor.php | 253 + .../Internal/FieldDescriptorProto.php | 435 + .../Internal/FieldDescriptorProto_Label.php | 27 + .../Internal/FieldDescriptorProto_Type.php | 107 + .../Google/Protobuf/Internal/FieldOptions.php | 421 + .../Protobuf/Internal/FieldOptions_CType.php | 27 + .../Protobuf/Internal/FieldOptions_JSType.php | 31 + .../Protobuf/Internal/FileDescriptor.php | 89 + .../Protobuf/Internal/FileDescriptorProto.php | 486 + .../Protobuf/Internal/FileDescriptorSet.php | 61 + .../Google/Protobuf/Internal/FileOptions.php | 862 ++ .../Internal/FileOptions_OptimizeMode.php | 33 + .../Protobuf/Internal/GPBDecodeException.php | 47 + .../Google/Protobuf/Internal/GPBJsonWire.php | 285 + .../src/Google/Protobuf/Internal/GPBLabel.php | 40 + .../src/Google/Protobuf/Internal/GPBType.php | 55 + .../src/Google/Protobuf/Internal/GPBUtil.php | 343 + .../src/Google/Protobuf/Internal/GPBWire.php | 622 + .../Google/Protobuf/Internal/GPBWireType.php | 43 + .../Protobuf/Internal/GeneratedCodeInfo.php | 71 + .../Internal/GeneratedCodeInfo_Annotation.php | 193 + .../src/Google/Protobuf/Internal/MapEntry.php | 57 + .../src/Google/Protobuf/Internal/MapField.php | 272 + .../Google/Protobuf/Internal/MapFieldIter.php | 124 + .../src/Google/Protobuf/Internal/Message.php | 1462 ++ .../Internal/MessageBuilderContext.php | 120 + .../Protobuf/Internal/MessageOptions.php | 328 + .../Internal/MethodDescriptorProto.php | 246 + .../Protobuf/Internal/MethodOptions.php | 145 + .../MethodOptions_IdempotencyLevel.php | 33 + .../Protobuf/Internal/OneofDescriptor.php | 67 + .../Internal/OneofDescriptorProto.php | 93 + .../Google/Protobuf/Internal/OneofField.php | 77 + .../Google/Protobuf/Internal/OneofOptions.php | 64 + .../Protobuf/Internal/RawInputStream.php | 50 + .../Protobuf/Internal/RepeatedField.php | 227 + .../Protobuf/Internal/RepeatedFieldIter.php | 118 + .../Internal/ServiceDescriptorProto.php | 126 + .../Protobuf/Internal/ServiceOptions.php | 112 + .../Protobuf/Internal/SourceCodeInfo.php | 187 + .../Internal/SourceCodeInfo_Location.php | 385 + .../Protobuf/Internal/UninterpretedOption.php | 272 + .../Internal/UninterpretedOption_NamePart.php | 97 + .../protobuf/php/src/phpdoc.dist.xml | 15 + .../protobuf/php/tests/array_test.php | 543 + .../protobuf/php/tests/autoload.php | 25 +- .../protobuf/php/tests/compatibility_test.sh | 141 + .../protobuf/php/tests/encode_decode_test.php | 453 + .../protobuf/php/tests/gdb_test.sh | 10 + .../php/tests/generated_class_test.php | 705 + .../php/tests/generated_phpdoc_test.php | 337 + .../php/tests/generated_service_test.php | 110 + .../protobuf/php/tests/map_field_test.php | 445 + .../protobuf/php/tests/memory_leak_test.php | 105 + .../php/tests/php_implementation_test.php | 516 + .../protobuf/php/tests/proto/test.proto | 189 + .../proto/test_empty_php_namespace.proto | 8 + .../proto/test_import_descriptor_proto.proto | 14 + .../php/tests/proto/test_include.proto | 7 + .../php/tests/proto/test_no_namespace.proto | 16 + .../php/tests/proto/test_php_namespace.proto | 8 + .../php/tests/proto/test_prefix.proto | 12 + .../php/tests/proto/test_service.proto | 18 + .../tests/proto/test_service_namespace.proto | 13 + .../third_party/protobuf/php/tests/test.sh | 27 + .../protobuf/php/tests/test_base.php | 342 + .../protobuf/php/tests/test_util.php | 547 + .../protobuf/php/tests/undefined_test.php | 920 ++ .../protobuf/php/tests/well_known_test.php | 17 + .../third_party/protobuf/post_process_dist.sh | 2 +- .../third_party/protobuf/proto_library.gni | 384 +- packager/third_party/protobuf/protobuf.bzl | 174 +- packager/third_party/protobuf/protobuf.gyp | 16 +- .../third_party/protobuf/protobuf_lite.gypi | 3 +- .../protobuf_lite_java_descriptor_proto.py | 49 - .../protobuf/protobuf_lite_java_parse_pom.py | 57 - .../protobuf/protoc-artifacts/Dockerfile | 6 +- .../protobuf/protoc-artifacts/README.md | 42 +- .../protobuf/protoc-artifacts/build-protoc.sh | 27 +- .../protobuf/protoc-artifacts/build-zip.sh | 112 + .../protobuf/protoc-artifacts/pom.xml | 7 +- .../third_party/protobuf/python/README.md | 85 +- .../third_party/protobuf/python/README.txt | 100 - .../protobuf/internal/factory_test1.proto | 55 + .../protobuf/internal/factory_test2.proto | 77 + .../protobuf/internal/more_extensions.proto | 58 + .../internal/more_extensions_dynamic.proto | 49 + .../protobuf/internal/more_messages.proto | 51 + .../internal/test_bad_identifiers.proto | 52 + .../proto/google/protobuf/descriptor.proto | 620 + .../src/proto/google/protobuf/unittest.proto | 719 + .../protobuf/unittest_custom_options.proto | 387 + .../google/protobuf/unittest_import.proto | 64 + .../protobuf/unittest_import_public.proto | 40 + .../proto/google/protobuf/unittest_mset.proto | 72 + .../unittest_no_generic_services.proto | 52 + .../compatibility_tests/v2.5.0/setup.py | 87 + .../python/compatibility_tests/v2.5.0/test.sh | 104 + .../v2.5.0/tests/__init__.py | 4 + .../v2.5.0/tests/google/__init__.py | 4 + .../v2.5.0/tests/google/protobuf/__init__.py | 4 + .../google/protobuf/internal/__init__.py} | 22 +- .../protobuf/internal/descriptor_test.py | 613 + .../protobuf/internal/generator_test.py | 269 + .../google/protobuf/internal/golden_message | Bin 0 -> 509 bytes .../internal/golden_packed_fields_message | Bin 0 -> 142 bytes .../google/protobuf/internal/message_test.py | 494 + .../internal/service_reflection_test.py | 136 + .../google/protobuf/internal/test_util.py | 651 + .../protobuf/internal/text_format_test.py | 620 + .../internal/text_format_unittest_data.txt | 128 + .../text_format_unittest_extensions_data.txt | 128 + .../protobuf/internal/wire_format_test.py | 253 + .../third_party/protobuf/python/ez_setup.py | 283 - .../python/google/protobuf/__init__.py | 2 +- .../python/google/protobuf/descriptor.py | 97 +- .../google/protobuf/descriptor_database.py | 11 +- .../python/google/protobuf/descriptor_pool.py | 415 +- .../protobuf/internal/_parameterized.py | 2 +- .../google/protobuf/internal/any_test.proto | 14 +- .../google/protobuf/internal/containers.py | 29 +- .../google/protobuf/internal/cpp_message.py | 663 - .../google/protobuf/internal/decoder.py | 22 +- .../protobuf/internal/descriptor_pool_test.py | 115 + .../protobuf/internal/descriptor_test.py | 60 +- .../google/protobuf/internal/encoder.py | 7 +- .../protobuf/internal/file_options_test.proto | 43 + .../protobuf/internal/generator_test.py | 3 +- .../protobuf/internal/json_format_test.py | 124 +- .../protobuf/internal/message_factory_test.py | 20 +- .../google/protobuf/internal/message_test.py | 72 +- .../protobuf/internal/python_message.py | 90 +- .../{pyext => internal}/python_protobuf.cc | 4 +- .../internal/reflection_cpp_generated_test.py | 91 - .../protobuf/internal/reflection_test.py | 120 +- .../protobuf/internal/symbol_database_test.py | 35 +- .../google/protobuf/internal/test_util.py | 154 +- .../protobuf/internal/testing_refleaks.py | 126 + .../protobuf/internal/text_format_test.py | 724 +- .../google/protobuf/internal/type_checkers.py | 15 +- .../protobuf/internal/unknown_fields_test.py | 107 +- .../protobuf/internal/well_known_types.py | 75 +- .../internal/well_known_types_test.py | 132 +- .../python/google/protobuf/json_format.py | 860 +- .../python/google/protobuf/message.py | 9 +- .../python/google/protobuf/message_factory.py | 11 +- .../google/protobuf/pyext/cpp_message.py | 6 +- .../google/protobuf/pyext/descriptor.cc | 316 +- .../python/google/protobuf/pyext/descriptor.h | 8 + .../protobuf/pyext/descriptor_containers.cc | 158 +- .../protobuf/pyext/descriptor_containers.h | 8 + .../google/protobuf/pyext/descriptor_pool.cc | 184 +- .../google/protobuf/pyext/descriptor_pool.h | 36 +- .../google/protobuf/pyext/extension_dict.cc | 149 +- .../google/protobuf/pyext/extension_dict.h | 43 - .../google/protobuf/pyext/map_container.cc | 101 +- .../google/protobuf/pyext/map_container.h | 12 +- .../python/google/protobuf/pyext/message.cc | 732 +- .../python/google/protobuf/pyext/message.h | 67 +- .../google/protobuf/pyext/message_factory.cc | 280 + .../google/protobuf/pyext/message_factory.h | 103 + .../google/protobuf/pyext/message_module.cc | 88 + .../google/protobuf/pyext/python-proto2.cc | 1717 --- .../protobuf/pyext/python_descriptor.cc | 337 - .../pyext/repeated_composite_container.cc | 38 +- .../pyext/repeated_scalar_container.cc | 7 +- .../google/protobuf/pyext/safe_numerics.h | 164 + .../protobuf/pyext/scoped_pyobject_ptr.h | 59 +- .../protobuf/{pyext => }/python_protobuf.h | 0 .../python/google/protobuf/reflection.py | 19 +- .../python/google/protobuf/symbol_database.py | 94 +- .../python/google/protobuf/text_format.py | 654 +- .../protobuf/python/release/wheel/Dockerfile | 6 + .../protobuf/python/release/wheel/README.md | 17 + .../release/wheel/build_wheel_manylinux.sh | 27 + .../release/wheel/protobuf_optimized_pip.sh | 66 + .../third_party/protobuf/python/setup.cfg | 2 + packager/third_party/protobuf/python/setup.py | 13 +- packager/third_party/protobuf/python/tox.ini | 3 +- .../third_party/protobuf/ruby/Gemfile.lock | 30 - packager/third_party/protobuf/ruby/Rakefile | 15 +- .../ruby/compatibility_tests/v3.0.0/README.md | 5 + .../ruby/compatibility_tests/v3.0.0/Rakefile | 25 + .../ruby/compatibility_tests/v3.0.0/test.sh | 17 + .../compatibility_tests/v3.0.0/tests/basic.rb | 1182 ++ .../v3.0.0/tests/generated_code.proto | 67 + .../v3.0.0/tests/generated_code_test.rb | 19 + .../v3.0.0/tests/repeated_field_test.rb | 640 + .../v3.0.0/tests/stress.rb | 38 + .../v3.0.0/tests/test_import.proto | 5 + .../ruby/ext/google/protobuf_c/defs.c | 4 +- .../ext/google/protobuf_c/encode_decode.c | 176 +- .../ruby/ext/google/protobuf_c/extconf.rb | 9 +- .../protobuf/ruby/ext/google/protobuf_c/map.c | 51 +- .../ruby/ext/google/protobuf_c/message.c | 58 +- .../ruby/ext/google/protobuf_c/protobuf.c | 2 + .../ruby/ext/google/protobuf_c/protobuf.h | 7 +- .../ext/google/protobuf_c/repeated_field.c | 17 +- .../ruby/ext/google/protobuf_c/storage.c | 72 +- .../protobuf/ruby/ext/google/protobuf_c/upb.c | 3695 ++++-- .../protobuf/ruby/ext/google/protobuf_c/upb.h | 1285 +- .../ruby/ext/google/protobuf_c/wrap_memcpy.c | 51 + .../protobuf/ruby/google-protobuf.gemspec | 13 +- .../protobuf/ruby/lib/google/protobuf.rb | 2 +- .../lib/google/protobuf/repeated_field.rb | 4 +- .../lib/google/protobuf/well_known_types.rb | 212 + packager/third_party/protobuf/ruby/pom.xml | 6 +- .../com/google/protobuf/jruby/RubyMap.java | 4 +- .../google/protobuf/jruby/RubyMessage.java | 35 +- .../protobuf/jruby/RubyRepeatedField.java | 4 +- .../java/com/google/protobuf/jruby/Utils.java | 37 +- .../third_party/protobuf/ruby/tests/basic.rb | 245 +- .../protobuf/ruby/tests/generated_code.proto | 2 +- .../ruby/tests/generated_code_test.rb | 4 +- .../protobuf/ruby/tests/test_import.proto | 5 + .../ruby/tests/well_known_types_test.rb | 130 + .../third_party/protobuf/ruby/travis-test.sh | 9 +- packager/third_party/protobuf/src/Makefile.am | 365 +- packager/third_party/protobuf/src/README.md | 2 +- .../protobuf/src/google/protobuf/SEBS | 240 - .../protobuf/src/google/protobuf/any.cc | 8 +- .../protobuf/src/google/protobuf/any.h | 6 +- .../protobuf/src/google/protobuf/any.pb.cc | 308 +- .../protobuf/src/google/protobuf/any.pb.h | 119 +- .../protobuf/src/google/protobuf/any.proto | 17 +- .../protobuf/src/google/protobuf/api.pb.cc | 1189 +- .../protobuf/src/google/protobuf/api.pb.h | 480 +- .../protobuf/src/google/protobuf/api.proto | 2 +- .../protobuf/src/google/protobuf/arena.cc | 62 +- .../protobuf/src/google/protobuf/arena.h | 90 +- .../src/google/protobuf/arena_test_util.h | 33 +- .../src/google/protobuf/arena_unittest.cc | 108 +- .../src/google/protobuf/arenastring.cc | 13 - .../src/google/protobuf/arenastring.h | 57 +- .../google/protobuf/arenastring_unittest.cc | 22 +- .../protobuf/compiler/code_generator.cc | 44 +- .../google/protobuf/compiler/code_generator.h | 52 +- .../compiler/command_line_interface.cc | 348 +- .../compiler/command_line_interface.h | 73 +- .../command_line_interface_unittest.cc | 281 +- .../compiler/cpp/cpp_bootstrap_unittest.cc | 17 +- .../google/protobuf/compiler/cpp/cpp_enum.cc | 45 +- .../google/protobuf/compiler/cpp/cpp_enum.h | 8 +- .../protobuf/compiler/cpp/cpp_enum_field.cc | 105 +- .../protobuf/compiler/cpp/cpp_enum_field.h | 6 +- .../protobuf/compiler/cpp/cpp_extension.cc | 36 +- .../google/protobuf/compiler/cpp/cpp_field.cc | 6 +- .../google/protobuf/compiler/cpp/cpp_field.h | 21 +- .../google/protobuf/compiler/cpp/cpp_file.cc | 887 +- .../google/protobuf/compiler/cpp/cpp_file.h | 49 +- .../protobuf/compiler/cpp/cpp_generator.cc | 4 +- .../protobuf/compiler/cpp/cpp_helpers.cc | 169 +- .../protobuf/compiler/cpp/cpp_helpers.h | 98 +- .../protobuf/compiler/cpp/cpp_map_field.cc | 364 +- .../protobuf/compiler/cpp/cpp_map_field.h | 9 +- .../protobuf/compiler/cpp/cpp_message.cc | 3496 +++-- .../protobuf/compiler/cpp/cpp_message.h | 94 +- .../compiler/cpp/cpp_message_field.cc | 178 +- .../protobuf/compiler/cpp/cpp_message_field.h | 19 +- .../protobuf/compiler/cpp/cpp_options.h | 6 +- .../compiler/cpp/cpp_primitive_field.cc | 130 +- .../compiler/cpp/cpp_primitive_field.h | 6 +- .../protobuf/compiler/cpp/cpp_service.cc | 66 +- .../protobuf/compiler/cpp/cpp_service.h | 5 +- .../protobuf/compiler/cpp/cpp_string_field.cc | 816 +- .../protobuf/compiler/cpp/cpp_string_field.h | 11 +- .../protobuf/compiler/cpp/cpp_unittest.cc | 165 +- .../protobuf/compiler/cpp/metadata_test.cc | 6 +- .../csharp/csharp_bootstrap_unittest.cc | 205 + .../compiler/csharp/csharp_doc_comment.cc | 2 +- .../protobuf/compiler/csharp/csharp_enum.cc | 22 +- .../compiler/csharp/csharp_field_base.cc | 21 +- .../compiler/csharp/csharp_field_base.h | 6 +- .../compiler/csharp/csharp_generator.cc | 3 - .../compiler/csharp/csharp_generator.h | 8 +- .../compiler/csharp/csharp_helpers.cc | 1 + .../protobuf/compiler/csharp/csharp_helpers.h | 16 + .../compiler/csharp/csharp_map_field.cc | 2 +- .../compiler/csharp/csharp_message.cc | 111 +- .../protobuf/compiler/csharp/csharp_message.h | 2 + .../compiler/csharp/csharp_message_field.cc | 4 +- .../protobuf/compiler/csharp/csharp_names.h | 9 +- .../protobuf/compiler/csharp/csharp_options.h | 9 +- .../compiler/csharp/csharp_primitive_field.cc | 4 +- .../csharp/csharp_reflection_class.cc | 5 +- .../csharp/csharp_repeated_enum_field.cc | 2 +- .../csharp/csharp_repeated_message_field.cc | 2 +- .../csharp/csharp_repeated_primitive_field.cc | 2 +- .../csharp/csharp_source_generator_base.cc | 2 +- .../csharp/csharp_source_generator_base.h | 2 + .../compiler/csharp/csharp_wrapper_field.cc | 4 +- .../src/google/protobuf/compiler/importer.cc | 5 +- .../src/google/protobuf/compiler/importer.h | 3 +- .../protobuf/compiler/importer_unittest.cc | 4 +- .../protobuf/compiler/java/java_context.cc | 16 +- .../protobuf/compiler/java/java_context.h | 22 +- .../compiler/java/java_doc_comment.cc | 2 +- .../protobuf/compiler/java/java_enum.cc | 76 +- .../google/protobuf/compiler/java/java_enum.h | 9 +- .../protobuf/compiler/java/java_enum_field.cc | 34 +- .../protobuf/compiler/java/java_enum_field.h | 4 +- .../compiler/java/java_enum_field_lite.cc | 19 +- .../compiler/java/java_enum_field_lite.h | 4 +- .../protobuf/compiler/java/java_enum_lite.cc | 74 +- .../protobuf/compiler/java/java_enum_lite.h | 9 +- .../protobuf/compiler/java/java_extension.cc | 12 +- .../protobuf/compiler/java/java_extension.h | 2 +- .../compiler/java/java_extension_lite.cc | 2 +- .../protobuf/compiler/java/java_field.cc | 8 +- .../protobuf/compiler/java/java_field.h | 9 +- .../protobuf/compiler/java/java_file.cc | 117 +- .../google/protobuf/compiler/java/java_file.h | 11 +- .../protobuf/compiler/java/java_generator.cc | 94 +- .../protobuf/compiler/java/java_helpers.cc | 34 +- .../protobuf/compiler/java/java_helpers.h | 56 +- .../compiler/java/java_lazy_message_field.cc | 12 +- .../java/java_lazy_message_field_lite.cc | 63 +- .../java/java_lazy_message_field_lite.h | 3 + .../protobuf/compiler/java/java_map_field.cc | 456 +- .../protobuf/compiler/java/java_map_field.h | 3 +- .../compiler/java/java_map_field_lite.cc | 516 +- .../compiler/java/java_map_field_lite.h | 3 +- .../protobuf/compiler/java/java_message.cc | 166 +- .../protobuf/compiler/java/java_message.h | 3 +- .../compiler/java/java_message_builder.cc | 108 +- .../java/java_message_builder_lite.cc | 9 +- .../compiler/java/java_message_field.cc | 39 +- .../compiler/java/java_message_field.h | 4 +- .../compiler/java/java_message_field_lite.cc | 6 +- .../compiler/java/java_message_field_lite.h | 6 +- .../compiler/java/java_message_lite.cc | 159 +- .../compiler/java/java_message_lite.h | 3 +- .../compiler/java/java_name_resolver.h | 2 +- .../protobuf/compiler/java/java_options.h} | 82 +- .../compiler/java/java_primitive_field.cc | 35 +- .../compiler/java/java_primitive_field.h | 4 +- .../java/java_primitive_field_lite.cc | 46 +- .../compiler/java/java_primitive_field_lite.h | 7 +- .../protobuf/compiler/java/java_service.cc | 39 +- .../protobuf/compiler/java/java_service.h | 7 +- .../java/java_shared_code_generator.cc | 75 +- .../java/java_shared_code_generator.h | 17 +- .../compiler/java/java_string_field.cc | 19 +- .../compiler/java/java_string_field.h | 4 +- .../compiler/java/java_string_field_lite.cc | 9 +- .../compiler/java/java_string_field_lite.h | 7 +- .../compiler/javanano/javanano_enum_field.cc | 2 +- .../compiler/javanano/javanano_enum_field.h | 6 +- .../compiler/javanano/javanano_extension.cc | 2 +- .../compiler/javanano/javanano_extension.h | 2 +- .../compiler/javanano/javanano_field.cc | 6 +- .../compiler/javanano/javanano_field.h | 6 +- .../compiler/javanano/javanano_file.cc | 6 +- .../compiler/javanano/javanano_helpers.cc | 10 +- .../compiler/javanano/javanano_helpers.h | 2 +- .../compiler/javanano/javanano_map_field.cc | 2 +- .../compiler/javanano/javanano_map_field.h | 2 +- .../compiler/javanano/javanano_message.cc | 4 +- .../javanano/javanano_message_field.cc | 2 +- .../javanano/javanano_message_field.h | 6 +- .../compiler/javanano/javanano_params.h | 4 +- .../javanano/javanano_primitive_field.cc | 2 +- .../javanano/javanano_primitive_field.h | 8 +- .../src/google/protobuf/compiler/js/embed.cc | 112 + .../protobuf/compiler/js/js_generator.cc | 1578 ++- .../protobuf/compiler/js/js_generator.h | 136 +- .../compiler/js/well_known_types/any.js | 80 + .../compiler/js/well_known_types/struct.js | 168 + .../compiler/js/well_known_types/timestamp.js | 53 + .../compiler/js/well_known_types_embed.cc | 311 + .../compiler/js/well_known_types_embed.h | 43 + .../src/google/protobuf/compiler/main.cc | 24 +- .../protobuf/compiler/mock_code_generator.cc | 41 +- .../compiler/objectivec/objectivec_enum.cc | 20 +- .../objectivec/objectivec_enum_field.cc | 18 +- .../objectivec/objectivec_enum_field.h | 2 +- .../objectivec/objectivec_extension.cc | 19 +- .../compiler/objectivec/objectivec_field.cc | 16 +- .../compiler/objectivec/objectivec_field.h | 4 +- .../compiler/objectivec/objectivec_file.cc | 424 +- .../compiler/objectivec/objectivec_file.h | 16 +- .../objectivec/objectivec_generator.cc | 103 +- .../objectivec/objectivec_generator.h | 15 +- .../compiler/objectivec/objectivec_helpers.cc | 764 +- .../compiler/objectivec/objectivec_helpers.h | 167 +- .../objectivec/objectivec_map_field.cc | 4 +- .../objectivec/objectivec_map_field.h | 2 +- .../compiler/objectivec/objectivec_message.cc | 65 +- .../compiler/objectivec/objectivec_message.h | 6 +- .../objectivec/objectivec_message_field.cc | 6 +- .../objectivec/objectivec_message_field.h | 4 +- .../compiler/objectivec/objectivec_oneof.cc | 8 +- .../compiler/objectivec/objectivec_oneof.h | 2 +- .../objectivec/objectivec_primitive_field.cc | 2 +- .../src/google/protobuf/compiler/parser.cc | 26 +- .../src/google/protobuf/compiler/parser.h | 12 +- .../protobuf/compiler/parser_unittest.cc | 17 +- .../protobuf/compiler/php/php_generator.cc | 1375 ++ .../protobuf/compiler/php/php_generator.h | 57 + .../src/google/protobuf/compiler/plugin.cc | 60 +- .../src/google/protobuf/compiler/plugin.pb.cc | 1874 ++- .../src/google/protobuf/compiler/plugin.pb.h | 697 +- .../src/google/protobuf/compiler/plugin.proto | 18 +- .../google/protobuf/compiler/profile.pb.cc | 1451 ++ .../src/google/protobuf/compiler/profile.pb.h | 728 + .../google/protobuf/compiler/profile.proto | 68 + .../compiler/python/python_generator.cc | 163 +- .../compiler/python/python_generator.h | 6 +- .../compiler/python/python_plugin_unittest.cc | 48 + ...ated_code.rb => ruby_generated_code_pb.rb} | 0 .../protobuf/compiler/ruby/ruby_generator.cc | 60 +- .../protobuf/compiler/ruby/ruby_generator.h | 6 + .../compiler/ruby/ruby_generator_unittest.cc | 24 +- .../google/protobuf/compiler/subprocess.cc | 11 +- .../google/protobuf/compiler/test_plugin.cc | 1 - .../src/google/protobuf/compiler/zip_writer.h | 2 +- .../src/google/protobuf/descriptor.cc | 1200 +- .../protobuf/src/google/protobuf/descriptor.h | 173 +- .../src/google/protobuf/descriptor.pb.cc | 11016 +++++++++------- .../src/google/protobuf/descriptor.pb.h | 3604 +++-- .../src/google/protobuf/descriptor.proto | 70 +- .../google/protobuf/descriptor_database.cc | 49 +- .../src/google/protobuf/descriptor_database.h | 46 +- .../protobuf/descriptor_database_unittest.cc | 20 +- .../google/protobuf/descriptor_unittest.cc | 604 +- .../src/google/protobuf/duration.pb.cc | 319 +- .../src/google/protobuf/duration.pb.h | 102 +- .../src/google/protobuf/duration.proto | 23 +- .../src/google/protobuf/dynamic_message.cc | 198 +- .../src/google/protobuf/dynamic_message.h | 90 +- .../protobuf/dynamic_message_unittest.cc | 3 +- .../protobuf/src/google/protobuf/empty.pb.cc | 220 +- .../protobuf/src/google/protobuf/empty.pb.h | 85 +- .../protobuf/src/google/protobuf/empty.proto | 1 - .../src/google/protobuf/extension_set.cc | 94 +- .../src/google/protobuf/extension_set.h | 83 +- .../google/protobuf/extension_set_heavy.cc | 178 +- .../google/protobuf/extension_set_unittest.cc | 82 +- .../src/google/protobuf/field_mask.pb.cc | 268 +- .../src/google/protobuf/field_mask.pb.h | 103 +- .../src/google/protobuf/field_mask.proto | 56 +- .../protobuf/generated_message_reflection.cc | 694 +- .../protobuf/generated_message_reflection.h | 369 +- .../generated_message_reflection_unittest.cc | 203 +- .../generated_message_table_driven.cc | 676 + .../protobuf/generated_message_table_driven.h | 174 + .../google/protobuf/generated_message_util.cc | 14 +- .../google/protobuf/generated_message_util.h | 136 +- .../protobuf/src/google/protobuf/has_bits.h | 103 + .../src/google/protobuf/io/coded_stream.cc | 325 +- .../src/google/protobuf/io/coded_stream.h | 276 +- .../protobuf/io/coded_stream_unittest.cc | 104 +- .../src/google/protobuf/io/gzip_stream.cc | 2 +- .../src/google/protobuf/io/printer.cc | 36 +- .../protobuf/src/google/protobuf/io/printer.h | 36 +- .../google/protobuf/io/printer_unittest.cc | 30 +- .../src/google/protobuf/io/tokenizer.cc | 6 +- .../src/google/protobuf/io/tokenizer.h | 4 +- .../google/protobuf/io/tokenizer_unittest.cc | 19 +- .../protobuf/io/zero_copy_stream_impl.cc | 22 +- .../protobuf/io/zero_copy_stream_impl.h | 12 +- .../protobuf/io/zero_copy_stream_impl_lite.h | 3 +- .../protobuf/io/zero_copy_stream_unittest.cc | 4 +- .../src/google/protobuf/lite_unittest.cc | 239 +- .../protobuf/src/google/protobuf/map.h | 777 +- .../protobuf/src/google/protobuf/map_entry.h | 252 +- .../src/google/protobuf/map_entry_lite.h | 386 +- .../protobuf/src/google/protobuf/map_field.cc | 59 +- .../protobuf/src/google/protobuf/map_field.h | 533 +- .../src/google/protobuf/map_field_inl.h | 308 +- .../src/google/protobuf/map_field_lite.h | 235 +- .../src/google/protobuf/map_field_test.cc | 53 +- .../google/protobuf/map_lite_unittest.proto | 2 +- .../google/protobuf/map_proto2_unittest.proto | 27 +- .../protobuf/src/google/protobuf/map_test.cc | 634 +- .../src/google/protobuf/map_test_util.cc | 22 +- .../src/google/protobuf/map_test_util.h | 5 + .../src/google/protobuf/map_test_util_impl.h | 41 +- .../src/google/protobuf/map_type_handler.h | 142 +- .../src/google/protobuf/map_unittest.proto | 2 +- .../protobuf/src/google/protobuf/message.cc | 72 +- .../protobuf/src/google/protobuf/message.h | 86 +- .../src/google/protobuf/message_lite.cc | 49 +- .../src/google/protobuf/message_lite.h | 38 +- .../src/google/protobuf/message_unittest.cc | 148 +- .../protobuf/src/google/protobuf/metadata.h | 115 +- .../src/google/protobuf/metadata_lite.h | 194 + .../protobuf/src/google/protobuf/reflection.h | 35 +- .../src/google/protobuf/reflection_ops.cc | 34 +- .../src/google/protobuf/reflection_ops.h | 2 +- .../protobuf/reflection_ops_unittest.cc | 3 +- .../src/google/protobuf/repeated_field.cc | 18 +- .../src/google/protobuf/repeated_field.h | 342 +- .../protobuf/repeated_field_reflection.h | 337 - .../repeated_field_reflection_unittest.cc | 39 +- .../protobuf/repeated_field_unittest.cc | 66 +- .../src/google/protobuf/source_context.pb.cc | 260 +- .../src/google/protobuf/source_context.pb.h | 101 +- .../src/google/protobuf/source_context.proto | 4 +- .../protobuf/src/google/protobuf/struct.pb.cc | 1172 +- .../protobuf/src/google/protobuf/struct.pb.h | 461 +- .../protobuf/src/google/protobuf/struct.proto | 2 +- .../src/google/protobuf/stubs/atomicops.h | 27 +- .../stubs/atomicops_internals_arm64_gcc.h | 26 +- .../stubs/atomicops_internals_arm_gcc.h | 10 +- .../stubs/atomicops_internals_arm_qnx.h | 10 +- ... atomicops_internals_generic_c11_atomic.h} | 16 +- .../stubs/atomicops_internals_generic_gcc.h | 30 +- .../stubs/atomicops_internals_macosx.h | 225 - .../stubs/atomicops_internals_mips_gcc.h | 34 +- .../stubs/atomicops_internals_power.h | 2 +- .../stubs/atomicops_internals_ppc_gcc.h | 18 +- .../stubs/atomicops_internals_solaris.h | 18 +- .../protobuf/stubs/atomicops_internals_tsan.h | 2 +- .../stubs/atomicops_internals_x86_gcc.h | 12 +- .../stubs/atomicops_internals_x86_msvc.cc | 7 +- .../stubs/atomicops_internals_x86_msvc.h | 4 +- .../src/google/protobuf/stubs/bytestream.h | 4 +- .../src/google/protobuf/stubs/callback.h | 34 +- .../src/google/protobuf/stubs/common.cc | 13 +- .../src/google/protobuf/stubs/common.h | 25 +- .../google/protobuf/stubs/common_unittest.cc | 2 - .../src/google/protobuf/stubs/fastmem.h | 3 +- .../protobuf/src/google/protobuf/stubs/hash.h | 23 +- .../src/google/protobuf/stubs/int128.cc | 6 +- .../google/protobuf/stubs/int128_unittest.cc | 14 +- .../src/google/protobuf/stubs/map-util.h | 143 - .../src/google/protobuf/stubs/map_util.h | 7 +- .../src/google/protobuf/stubs/mathlimits.h | 39 +- .../src/google/protobuf/stubs/mathutil.h | 23 +- .../google/protobuf/stubs/once_unittest.cc | 5 +- .../google/protobuf/stubs/platform_macros.h | 6 +- .../protobuf/src/google/protobuf/stubs/port.h | 124 +- .../src/google/protobuf/stubs/shared_ptr.h | 7 +- .../src/google/protobuf/stubs/stringpiece.h | 28 +- .../protobuf/stubs/stringpiece_unittest.cc | 2 + .../src/google/protobuf/stubs/strutil.cc | 31 +- .../src/google/protobuf/stubs/strutil.h | 4 +- .../src/google/protobuf/stubs/substitute.cc | 4 +- .../protobuf/src/google/protobuf/stubs/time.h | 2 +- .../src/google/protobuf/stubs/type_traits.h | 2 +- .../protobuf/test_messages_proto3.proto | 227 + .../protobuf/src/google/protobuf/test_util.cc | 16 +- .../src/google/protobuf/test_util_lite.cc | 7 +- .../google/protobuf/testdata/bad_utf8_string | 1 + .../protobuf/testdata/golden_message_maps | Bin 0 -> 13619 bytes .../src/google/protobuf/testing/file.cc | 17 +- .../src/google/protobuf/testing/googletest.cc | 4 + .../src/google/protobuf/testing/googletest.h | 2 +- .../src/google/protobuf/text_format.cc | 210 +- .../src/google/protobuf/text_format.h | 12 +- .../google/protobuf/text_format_unittest.cc | 192 +- .../src/google/protobuf/timestamp.pb.cc | 299 +- .../src/google/protobuf/timestamp.pb.h | 93 +- .../src/google/protobuf/timestamp.proto | 34 +- .../protobuf/src/google/protobuf/type.pb.cc | 3587 ++--- .../protobuf/src/google/protobuf/type.pb.h | 1096 +- .../protobuf/src/google/protobuf/type.proto | 13 +- .../src/google/protobuf/unittest.proto | 60 + .../protobuf/unittest_custom_options.proto | 9 + .../protobuf/unittest_lazy_dependencies.proto | 75 + ...test_lazy_dependencies_custom_option.proto | 67 + .../unittest_lazy_dependencies_enum.proto | 61 + .../src/google/protobuf/unittest_lite.proto | 34 + .../src/google/protobuf/unittest_proto3.proto | 3 + .../protobuf/unittest_proto3_arena.proto | 2 + .../src/google/protobuf/unknown_field_set.cc | 101 +- .../src/google/protobuf/unknown_field_set.h | 71 +- .../protobuf/unknown_field_set_unittest.cc | 11 +- .../protobuf/util/delimited_message_util.cc | 79 + .../protobuf/util/delimited_message_util.h | 66 + .../util/delimited_message_util_test.cc | 57 + .../google/protobuf/util/field_comparator.cc | 2 +- .../google/protobuf/util/field_comparator.h | 4 +- .../protobuf/util/field_comparator_test.cc | 16 +- .../google/protobuf/util/field_mask_util.cc | 87 +- .../google/protobuf/util/field_mask_util.h | 30 +- .../protobuf/util/field_mask_util_test.cc | 136 + .../google/protobuf/util/internal/constants.h | 8 +- .../protobuf/util/internal/datapiece.cc | 102 +- .../google/protobuf/util/internal/datapiece.h | 43 +- .../internal/default_value_objectwriter.cc | 157 +- .../internal/default_value_objectwriter.h | 66 +- .../default_value_objectwriter_test.cc | 33 + .../protobuf/util/internal/error_listener.h | 4 +- .../util/internal/field_mask_utility.cc | 9 +- .../protobuf/util/internal/json_escaping.cc | 56 +- .../util/internal/json_objectwriter.cc | 21 +- .../util/internal/json_objectwriter.h | 20 +- .../util/internal/json_objectwriter_test.cc | 4 +- .../util/internal/json_stream_parser.cc | 130 +- .../util/internal/json_stream_parser.h | 11 + .../util/internal/json_stream_parser_test.cc | 62 +- .../protobuf/util/internal/object_writer.h | 8 + .../protobuf/util/internal/proto_writer.cc | 75 +- .../protobuf/util/internal/proto_writer.h | 59 +- .../util/internal/protostream_objectsource.cc | 107 +- .../util/internal/protostream_objectsource.h | 65 +- .../internal/protostream_objectsource_test.cc | 92 +- .../util/internal/protostream_objectwriter.cc | 176 +- .../util/internal/protostream_objectwriter.h | 90 +- .../internal/protostream_objectwriter_test.cc | 616 +- .../util/internal/testdata/anys.proto | 69 +- .../util/internal/testdata/books.proto | 14 + .../util/internal/testdata/maps.proto | 76 +- .../util/internal/testdata/oneofs.proto | 31 +- .../util/internal/testdata/proto3.proto | 42 + .../util/internal/testdata/struct.proto | 86 +- .../testdata/timestamp_duration.proto | 47 +- .../protobuf/util/internal/type_info.cc | 44 +- .../util/internal/type_info_test_helper.cc | 6 +- .../util/internal/type_info_test_helper.h | 2 +- .../google/protobuf/util/internal/utility.cc | 83 +- .../google/protobuf/util/internal/utility.h | 15 + .../protobuf/util/json_format_proto3.proto | 7 + .../src/google/protobuf/util/json_util.cc | 114 +- .../src/google/protobuf/util/json_util.h | 92 +- .../google/protobuf/util/json_util_test.cc | 216 +- .../protobuf/util/message_differencer.cc | 169 +- .../protobuf/util/message_differencer.h | 159 +- .../util/message_differencer_unittest.cc | 108 +- .../src/google/protobuf/util/package_info.h | 46 + .../src/google/protobuf/util/time_util.cc | 41 +- .../src/google/protobuf/util/time_util.h | 7 +- .../src/google/protobuf/util/type_resolver.h | 2 + .../protobuf/util/type_resolver_util.cc | 56 +- .../google/protobuf/util/type_resolver_util.h | 2 + .../src/google/protobuf/wire_format.cc | 379 +- .../src/google/protobuf/wire_format.h | 22 +- .../src/google/protobuf/wire_format_lite.cc | 251 +- .../src/google/protobuf/wire_format_lite.h | 528 +- .../google/protobuf/wire_format_lite_inl.h | 330 +- .../google/protobuf/wire_format_unittest.cc | 169 +- .../src/google/protobuf/wrappers.pb.cc | 1453 +- .../src/google/protobuf/wrappers.pb.h | 559 +- .../src/google/protobuf/wrappers.proto | 1 - .../protobuf/src/libprotobuf-lite.map | 9 + .../third_party/protobuf/src/libprotobuf.map | 9 + .../third_party/protobuf/src/libprotoc.map | 9 + packager/third_party/protobuf/tests.sh | 480 +- .../third_party/protobuf/update_file_lists.sh | 2 +- .../third_party/protobuf/vsprojects/config.h | 29 - .../protobuf/vsprojects/convert2008to2005.sh | 20 - .../protobuf/vsprojects/extract_includes.bat | 49 - .../protobuf/vsprojects/readme.txt | 114 - 1389 files changed, 182449 insertions(+), 89434 deletions(-) create mode 100644 packager/third_party/protobuf/.gitmodules delete mode 100644 packager/third_party/protobuf/COPYING.txt delete mode 100644 packager/third_party/protobuf/INSTALL.txt delete mode 100644 packager/third_party/protobuf/README.txt create mode 100644 packager/third_party/protobuf/benchmarks/cpp_benchmark.cc create mode 100644 packager/third_party/protobuf/cmake/examples.cmake create mode 100644 packager/third_party/protobuf/cmake/protobuf-options.cmake create mode 100644 packager/third_party/protobuf/composer.json delete mode 100644 packager/third_party/protobuf/config.h create mode 100644 packager/third_party/protobuf/conformance/autoload.php create mode 100755 packager/third_party/protobuf/conformance/conformance_nodejs.js create mode 100755 packager/third_party/protobuf/conformance/conformance_php.php create mode 100644 packager/third_party/protobuf/conformance/failure_list_js.txt create mode 100644 packager/third_party/protobuf/conformance/failure_list_php.txt create mode 100644 packager/third_party/protobuf/conformance/failure_list_php_c.txt create mode 100644 packager/third_party/protobuf/conformance/failure_list_php_zts_c.txt rename packager/third_party/protobuf/{src/google/protobuf/arena_nc_test.py => conformance/update_failure_list.py} (56%) mode change 100644 => 100755 create mode 100755 packager/third_party/protobuf/csharp/build_tools.sh create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto rename packager/third_party/protobuf/{java/src/main/java/com/google/protobuf/BlockingService.java => csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto} (59%) rename packager/third_party/protobuf/{src/google/protobuf/arena_nc.cc => csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto} (83%) create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs rename packager/third_party/protobuf/csharp/{src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs => compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs} (73%) create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs create mode 100644 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs create mode 100755 packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/test.sh create mode 100644 packager/third_party/protobuf/csharp/global.json create mode 100644 packager/third_party/protobuf/csharp/protos/unittest_custom_options_proto3.proto delete mode 100644 packager/third_party/protobuf/csharp/src/AddressBook/Properties/AssemblyInfo.cs delete mode 100644 packager/third_party/protobuf/csharp/src/AddressBook/app.config delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/App.config delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/app.config mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/ByteStringTest.cs create mode 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs create mode 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Program.cs delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs create mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs create mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs create mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/packages.config mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteString.cs mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs rename packager/third_party/protobuf/{java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java => csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs} (57%) mode change 100644 => 100755 mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.nuspec mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs create mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs mode change 100644 => 100755 packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs delete mode 100644 packager/third_party/protobuf/csharp/src/Google.Protobuf/packages.config delete mode 100644 packager/third_party/protobuf/csharp/src/packages/repositories.config delete mode 100755 packager/third_party/protobuf/descriptor_pb2.py delete mode 100644 packager/third_party/protobuf/docs/swift/DesignDoc.md create mode 100644 packager/third_party/protobuf/examples/CMakeLists.txt create mode 100755 packager/third_party/protobuf/generate_changelog.py delete mode 100644 packager/third_party/protobuf/java/README.txt create mode 100644 packager/third_party/protobuf/java/compatibility_tests/README.md create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/deps/pom.xml create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/pom.xml rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/multiple_files_test.proto (100%) rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/nested_builders_test.proto (100%) rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/nested_extension.proto (100%) rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/nested_extension_lite.proto (100%) rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/non_nested_extension.proto (100%) rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/non_nested_extension_lite.proto (100%) rename packager/third_party/protobuf/java/{src/test/java => compatibility_tests/v2.5.0/more_protos/src/proto}/com/google/protobuf/test_bad_identifiers.proto (100%) create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/RpcCallback.java => compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto} (71%) rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/BlockingRpcChannel.java => compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto} (71%) create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/ProtocolMessageEnum.java => compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto} (69%) create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/pom.xml create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/pom.xml create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/ServiceException.java => compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto} (76%) create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto create mode 100755 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/test.sh create mode 100644 packager/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/pom.xml rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/AbstractMessageTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/BoundedByteStringTest.java (79%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/ByteStringTest.java (84%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/CodedInputStreamTest.java (88%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/CodedOutputStreamTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/DeprecatedFieldTest.java (98%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/DescriptorsTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/DynamicMessageTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/ForceFieldBuildersPreRun.java (94%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/GeneratedMessageTest.java (83%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/LazyStringArrayListTest.java (98%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/LazyStringEndToEndTest.java (77%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/LiteralByteStringTest.java (84%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/MessageTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/NestedBuildersTest.java (98%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/ParserTest.java (70%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/RopeByteStringSubstringTest.java (62%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/RopeByteStringTest.java (72%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/ServiceTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/TestBadIdentifiers.java (97%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/TestUtil.java (73%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/TextFormatTest.java (69%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/UnknownFieldSetTest.java (99%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/UnmodifiableLazyStringListTest.java (98%) rename packager/third_party/protobuf/java/{src/test/java/com/google/protobuf => compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test}/WireFormatTest.java (79%) create mode 100644 packager/third_party/protobuf/java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/GeneratedMessage.java => core/src/main/java/com/google/protobuf/GeneratedMessageV3.java} (51%) create mode 100644 packager/third_party/protobuf/java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/RepeatedFieldBuilder.java => core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java} (86%) rename packager/third_party/protobuf/java/{src/main/java/com/google/protobuf/SingleFieldBuilder.java => core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java} (86%) create mode 100644 packager/third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnsafeUtil.java create mode 100644 packager/third_party/protobuf/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java rename packager/third_party/protobuf/java/core/src/test/java/com/google/protobuf/{RepeatedFieldBuilderTest.java => RepeatedFieldBuilderV3Test.java} (91%) rename packager/third_party/protobuf/java/core/src/test/java/com/google/protobuf/{SingleFieldBuilderTest.java => SingleFieldBuilderV3Test.java} (90%) delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/AbstractMessage.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/AbstractParser.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/BoundedByteString.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/ByteString.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/CodedInputStream.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/CodedOutputStream.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/Descriptors.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/DynamicMessage.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistry.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/FieldSet.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/Internal.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyField.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringArrayList.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/LazyStringList.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/LiteralByteString.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/Message.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/MessageLite.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/MessageOrBuilder.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/Parser.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/RopeByteString.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/RpcChannel.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/RpcController.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/RpcUtil.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/Service.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/SmallSortedMap.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/TextFormat.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/UninitializedMessageException.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/UnknownFieldSet.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/Utf8.java delete mode 100644 packager/third_party/protobuf/java/src/main/java/com/google/protobuf/WireFormat.java delete mode 100644 packager/third_party/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java delete mode 100644 packager/third_party/protobuf/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java delete mode 100644 packager/third_party/protobuf/java/src/test/java/com/google/protobuf/LiteTest.java delete mode 100644 packager/third_party/protobuf/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java delete mode 100644 packager/third_party/protobuf/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java delete mode 100644 packager/third_party/protobuf/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java create mode 100644 packager/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Durations.java create mode 100644 packager/third_party/protobuf/java/util/src/main/java/com/google/protobuf/util/Timestamps.java create mode 100755 packager/third_party/protobuf/jenkins/buildcmds/pull_request_32.sh create mode 100644 packager/third_party/protobuf/jenkins/docker32/Dockerfile create mode 100644 packager/third_party/protobuf/js/binary/message_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/binary/arith_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/binary/decoder_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/binary/proto_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/binary/reader_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/binary/utils_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/binary/writer_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/export_asserts.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/import_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/jasmine.json create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/data.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/debug_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/jasmine1.json create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/jasmine2.json create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/jasmine3.json create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/message_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/proto3_test.js create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/proto3_test.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/test.proto create mode 100755 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/test.sh create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/test2.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/test3.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/test4.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/test5.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/testbinary.proto create mode 100644 packager/third_party/protobuf/js/compatibility_tests/v3.0.0/testempty.proto create mode 100644 packager/third_party/protobuf/js/map.js create mode 100755 packager/third_party/protobuf/js/maps_test.js create mode 100644 packager/third_party/protobuf/js/test8.proto create mode 100644 packager/third_party/protobuf/kokoro/README.md create mode 100755 packager/third_party/protobuf/kokoro/linux/cpp_distcheck/build.sh create mode 100644 packager/third_party/protobuf/kokoro/linux/cpp_distcheck/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/linux/cpp_distcheck/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/linux/csharp/build.sh create mode 100644 packager/third_party/protobuf/kokoro/linux/csharp/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/linux/csharp/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/linux/java_compatibility/build.sh create mode 100644 packager/third_party/protobuf/kokoro/linux/java_compatibility/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/linux/java_compatibility/presubmit.cfg create mode 100644 packager/third_party/protobuf/kokoro/linux/prepare_build_linux_rc create mode 100755 packager/third_party/protobuf/kokoro/linux/python_compatibility/build.sh create mode 100644 packager/third_party/protobuf/kokoro/linux/python_compatibility/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/linux/python_compatibility/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/cpp/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/cpp/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/cpp/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/cpp_distcheck/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/cpp_distcheck/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/cpp_distcheck/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/javascript/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/javascript/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/javascript/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/jruby/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/jruby/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/jruby/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/objectivec_cocoapods_integration/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_cocoapods_integration/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_cocoapods_integration/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/objectivec_ios_debug/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_ios_debug/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_ios_debug/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/objectivec_ios_release/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_ios_release/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_ios_release/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/objectivec_osx/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_osx/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/objectivec_osx/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/php5.6_mac/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/php5.6_mac/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/php5.6_mac/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/php7.0_mac/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/php7.0_mac/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/php7.0_mac/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/prepare_build_macos_rc create mode 100755 packager/third_party/protobuf/kokoro/macos/python/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/python/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/python/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/python_cpp/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/python_cpp/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/python_cpp/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/ruby21/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/ruby21/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/ruby21/presubmit.cfg create mode 100755 packager/third_party/protobuf/kokoro/macos/ruby22/build.sh create mode 100644 packager/third_party/protobuf/kokoro/macos/ruby22/continuous.cfg create mode 100644 packager/third_party/protobuf/kokoro/macos/ruby22/presubmit.cfg create mode 100644 packager/third_party/protobuf/m4/ax_cxx_compile_stdcxx.m4 create mode 100644 packager/third_party/protobuf/m4/ax_prog_cc_for_build.m4 create mode 100644 packager/third_party/protobuf/m4/ax_prog_cxx_for_build.m4 create mode 100644 packager/third_party/protobuf/mirclient.cc create mode 100644 packager/third_party/protobuf/mirclient.map create mode 100644 packager/third_party/protobuf/objectivec/.gitignore create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/README.md create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m create mode 100755 packager/third_party/protobuf/objectivec/Tests/CocoaPods/run_tests.sh create mode 100644 packager/third_party/protobuf/objectivec/Tests/GPBDictionaryTests.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/GPBExtensionRegistryTest.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/GPBUnittestProtos2.m create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_deprecated.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_deprecated_file.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_a.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_b.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_c.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_d.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_e.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_f.proto create mode 100644 packager/third_party/protobuf/objectivec/Tests/unittest_extension_chain_g.proto delete mode 100644 packager/third_party/protobuf/patches/0001-ignore-option-retain-unknown-fields.patch delete mode 100644 packager/third_party/protobuf/patches/0005-fix-include-js-generator.patch delete mode 100644 packager/third_party/protobuf/patches/0011-libprotobuf_export.patch create mode 100644 packager/third_party/protobuf/patches/0012-fixes-for-js-embed-cc.patch create mode 100644 packager/third_party/protobuf/patches/0013-fixes-expansion-to-defined.patch create mode 100644 packager/third_party/protobuf/patches/0014-truncate-uint8-constants.patch create mode 100644 packager/third_party/protobuf/patches/0015-fixes-forcing-value-to-bool.patch create mode 100644 packager/third_party/protobuf/patches/0016-fixes-limit-for-msvc-c1091.patch create mode 100644 packager/third_party/protobuf/patches/0017-constexpr-for-vs-2017.patch create mode 100644 packager/third_party/protobuf/patches/0018-fallthrough.patch create mode 100644 packager/third_party/protobuf/patches/0019-rename-a-shadowed-variable.patch create mode 100644 packager/third_party/protobuf/patches/0020-Add-support-for-libc-on-Windows.patch create mode 100644 packager/third_party/protobuf/php/README.md create mode 100644 packager/third_party/protobuf/php/composer.json create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/array.c create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/encode_decode.c create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/map.c create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/package.xml delete mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/test.php create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/type_check.c create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/utf8.c create mode 100644 packager/third_party/protobuf/php/ext/google/protobuf/utf8.h create mode 100755 packager/third_party/protobuf/php/generate_descriptor_protos.sh create mode 100644 packager/third_party/protobuf/php/phpunit.xml create mode 100644 packager/third_party/protobuf/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/CodedInputStream.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/CodedOutputStream.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/Descriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorPool.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumBuilderContext.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueDescriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/EnumValueOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_CType.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FileDescriptorSet.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBDecodeException.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBJsonWire.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBLabel.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBType.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBUtil.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBWire.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GPBWireType.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MapEntry.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MapField.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MapFieldIter.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/Message.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MessageBuilderContext.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MessageOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofDescriptor.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofField.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/OneofOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/RawInputStream.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/RepeatedField.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/RepeatedFieldIter.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/ServiceOptions.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption.php create mode 100644 packager/third_party/protobuf/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php create mode 100644 packager/third_party/protobuf/php/src/phpdoc.dist.xml create mode 100644 packager/third_party/protobuf/php/tests/array_test.php mode change 100644 => 100755 packager/third_party/protobuf/php/tests/autoload.php create mode 100755 packager/third_party/protobuf/php/tests/compatibility_test.sh create mode 100644 packager/third_party/protobuf/php/tests/encode_decode_test.php create mode 100755 packager/third_party/protobuf/php/tests/gdb_test.sh create mode 100644 packager/third_party/protobuf/php/tests/generated_class_test.php create mode 100644 packager/third_party/protobuf/php/tests/generated_phpdoc_test.php create mode 100644 packager/third_party/protobuf/php/tests/generated_service_test.php create mode 100644 packager/third_party/protobuf/php/tests/map_field_test.php create mode 100644 packager/third_party/protobuf/php/tests/memory_leak_test.php create mode 100644 packager/third_party/protobuf/php/tests/php_implementation_test.php create mode 100644 packager/third_party/protobuf/php/tests/proto/test.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_empty_php_namespace.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_import_descriptor_proto.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_include.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_no_namespace.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_php_namespace.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_prefix.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_service.proto create mode 100644 packager/third_party/protobuf/php/tests/proto/test_service_namespace.proto create mode 100755 packager/third_party/protobuf/php/tests/test.sh create mode 100644 packager/third_party/protobuf/php/tests/test_base.php create mode 100644 packager/third_party/protobuf/php/tests/test_util.php create mode 100644 packager/third_party/protobuf/php/tests/undefined_test.php create mode 100644 packager/third_party/protobuf/php/tests/well_known_test.php delete mode 100755 packager/third_party/protobuf/protobuf_lite_java_descriptor_proto.py delete mode 100755 packager/third_party/protobuf/protobuf_lite_java_parse_pom.py create mode 100755 packager/third_party/protobuf/protoc-artifacts/build-zip.sh delete mode 100644 packager/third_party/protobuf/python/README.txt create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/setup.py create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/test.sh create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/__init__.py create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/__init__.py create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py rename packager/third_party/protobuf/python/{google/protobuf/internal/message_cpp_test.py => compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py} (82%) create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt create mode 100644 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt create mode 100755 packager/third_party/protobuf/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py delete mode 100755 packager/third_party/protobuf/python/ez_setup.py delete mode 100644 packager/third_party/protobuf/python/google/protobuf/internal/cpp_message.py create mode 100644 packager/third_party/protobuf/python/google/protobuf/internal/file_options_test.proto rename packager/third_party/protobuf/python/google/protobuf/{pyext => internal}/python_protobuf.cc (96%) delete mode 100644 packager/third_party/protobuf/python/google/protobuf/internal/reflection_cpp_generated_test.py create mode 100644 packager/third_party/protobuf/python/google/protobuf/internal/testing_refleaks.py create mode 100644 packager/third_party/protobuf/python/google/protobuf/pyext/message_factory.cc create mode 100644 packager/third_party/protobuf/python/google/protobuf/pyext/message_factory.h create mode 100644 packager/third_party/protobuf/python/google/protobuf/pyext/message_module.cc delete mode 100644 packager/third_party/protobuf/python/google/protobuf/pyext/python-proto2.cc delete mode 100644 packager/third_party/protobuf/python/google/protobuf/pyext/python_descriptor.cc create mode 100644 packager/third_party/protobuf/python/google/protobuf/pyext/safe_numerics.h rename packager/third_party/protobuf/python/google/protobuf/{pyext => }/python_protobuf.h (100%) create mode 100644 packager/third_party/protobuf/python/release/wheel/Dockerfile create mode 100644 packager/third_party/protobuf/python/release/wheel/README.md create mode 100755 packager/third_party/protobuf/python/release/wheel/build_wheel_manylinux.sh create mode 100755 packager/third_party/protobuf/python/release/wheel/protobuf_optimized_pip.sh create mode 100644 packager/third_party/protobuf/python/setup.cfg delete mode 100644 packager/third_party/protobuf/ruby/Gemfile.lock create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/README.md create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/Rakefile create mode 100755 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/test.sh create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/tests/basic.rb create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/tests/generated_code.proto create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/tests/stress.rb create mode 100644 packager/third_party/protobuf/ruby/compatibility_tests/v3.0.0/tests/test_import.proto create mode 100644 packager/third_party/protobuf/ruby/ext/google/protobuf_c/wrap_memcpy.c create mode 100644 packager/third_party/protobuf/ruby/lib/google/protobuf/well_known_types.rb create mode 100644 packager/third_party/protobuf/ruby/tests/test_import.proto create mode 100644 packager/third_party/protobuf/ruby/tests/well_known_types_test.rb delete mode 100644 packager/third_party/protobuf/src/google/protobuf/SEBS create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc rename packager/third_party/protobuf/{python/google/protobuf/pyext/python_descriptor.h => src/google/protobuf/compiler/java/java_options.h} (57%) create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/js/embed.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types/any.js create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types/struct.js create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types/timestamp.js create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/js/well_known_types_embed.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/php/php_generator.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/php/php_generator.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/profile.pb.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/profile.pb.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/compiler/profile.proto rename packager/third_party/protobuf/src/google/protobuf/compiler/ruby/{ruby_generated_code.rb => ruby_generated_code_pb.rb} (100%) create mode 100644 packager/third_party/protobuf/src/google/protobuf/generated_message_table_driven.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/generated_message_table_driven.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/has_bits.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/metadata_lite.h delete mode 100644 packager/third_party/protobuf/src/google/protobuf/repeated_field_reflection.h rename packager/third_party/protobuf/src/google/protobuf/stubs/{atomicops_internals_pnacl.h => atomicops_internals_generic_c11_atomic.h} (96%) delete mode 100644 packager/third_party/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h delete mode 100644 packager/third_party/protobuf/src/google/protobuf/stubs/map-util.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/test_messages_proto3.proto create mode 100644 packager/third_party/protobuf/src/google/protobuf/testdata/bad_utf8_string create mode 100644 packager/third_party/protobuf/src/google/protobuf/testdata/golden_message_maps create mode 100644 packager/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies.proto create mode 100644 packager/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto create mode 100644 packager/third_party/protobuf/src/google/protobuf/unittest_lazy_dependencies_enum.proto create mode 100644 packager/third_party/protobuf/src/google/protobuf/util/delimited_message_util.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/util/delimited_message_util.h create mode 100644 packager/third_party/protobuf/src/google/protobuf/util/delimited_message_util_test.cc create mode 100644 packager/third_party/protobuf/src/google/protobuf/util/internal/testdata/proto3.proto create mode 100644 packager/third_party/protobuf/src/google/protobuf/util/package_info.h create mode 100644 packager/third_party/protobuf/src/libprotobuf-lite.map create mode 100644 packager/third_party/protobuf/src/libprotobuf.map create mode 100644 packager/third_party/protobuf/src/libprotoc.map delete mode 100644 packager/third_party/protobuf/vsprojects/config.h delete mode 100755 packager/third_party/protobuf/vsprojects/convert2008to2005.sh delete mode 100755 packager/third_party/protobuf/vsprojects/extract_includes.bat delete mode 100644 packager/third_party/protobuf/vsprojects/readme.txt diff --git a/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-audio.mp4.media_info b/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-audio.mp4.media_info index af1dd07a5c..78fb2c7769 100644 --- a/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-audio.mp4.media_info +++ b/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-audio.mp4.media_info @@ -15,7 +15,7 @@ index_range { end: 1034 } media_file_name: "bear-640x360-audio.mp4" -media_duration_seconds: 2.7631745 +media_duration_seconds: 2.76317453 reference_time_scale: 44100 container_type: CONTAINER_MP4 protected_content { diff --git a/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-video.mp4.media_info b/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-video.mp4.media_info index 61ab89e2f9..bcdeea3035 100644 --- a/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-video.mp4.media_info +++ b/packager/app/test/testdata/encryption-and-output-media-info/bear-640x360-video.mp4.media_info @@ -18,7 +18,7 @@ index_range { end: 1158 } media_file_name: "bear-640x360-video.mp4" -media_duration_seconds: 2.7360666 +media_duration_seconds: 2.73606658 reference_time_scale: 30000 container_type: CONTAINER_MP4 protected_content { diff --git a/packager/third_party/protobuf/.gitignore b/packager/third_party/protobuf/.gitignore index 27eeb9c224..51d092c724 100644 --- a/packager/third_party/protobuf/.gitignore +++ b/packager/third_party/protobuf/.gitignore @@ -60,10 +60,16 @@ python/build/ python/google/protobuf/compiler/ python/google/protobuf/util/ +src/js_embed src/protoc src/unittest_proto_middleman +# vim generated +*.swp + # Generated test scaffolding +src/no_warning_test.cc +src/no-warning-test src/protobuf*-test src/test_plugin src/testzip.* @@ -77,8 +83,11 @@ src/**/*.log src/**/*.trs # JavaBuild output. -java/target +java/core/target +java/util/target javanano/target +java/.idea +java/**/*.iml # Windows native output. cmake/build @@ -88,16 +97,14 @@ build_msvc # packages themselves. /csharp/src/packages/*/ -# Directories created by opening the Objective C Xcode projects. -objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcuserdata/ -objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/ProtocolBuffers_OSX.xccheckout -objectivec/ProtocolBuffers_OSX.xcodeproj/xcuserdata/ -objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcuserdata/ -objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/ProtocolBuffers_iOS.xccheckout -objectivec/ProtocolBuffers_iOS.xcodeproj/xcuserdata/ # OS X's Finder creates these for state about opened windows/etc. **/.DS_Store +# Cocoapods artifacts +# Podfile.lock and the workspace file are tracked, to ease deleting them. That's +# needed to trigger "pod install" to rerun the preinstall commands. +Pods/ + # Comformance test output conformance/.libs/ conformance/com/ @@ -110,8 +117,55 @@ conformance/conformance.pb.cc conformance/conformance.pb.h conformance/Conformance.pbobjc.h conformance/Conformance.pbobjc.m -conformance/conformance.rb +conformance/conformance_pb.js +conformance/conformance_pb.rb +conformance/failing_tests.txt conformance/google/ +conformance/google-protobuf/ conformance/javac_middleman conformance/lite/ +conformance/nonexistent_tests.txt conformance/protoc_middleman +conformance/succeeding_tests.txt +conformance/Conformance/ +conformance/GPBMetadata/ +conformance/Google/ +conformance/Protobuf_test_messages/ +conformance/conformance-php +conformance/conformance-php-c + +# php test output +composer.lock +php/tests/generated/ +php/tests/old_protoc +php/tests/protobuf/ +php/ext/google/protobuf/.libs/ +php/ext/google/protobuf/Makefile.fragments +php/ext/google/protobuf/Makefile.global +php/ext/google/protobuf/Makefile.objects +php/ext/google/protobuf/acinclude.m4 +php/ext/google/protobuf/build/ +php/ext/google/protobuf/config.h +php/ext/google/protobuf/config.nice +php/ext/google/protobuf/configure.in +php/ext/google/protobuf/mkinstalldirs +php/ext/google/protobuf/run-tests.php +vendor/ + +# JavaScript artifacts +js/commonjs_out/ +js/compatibility_tests/v3.0.0/commonjs_out* +js/compatibility_tests/v3.0.0/protoc +js/compatibility_tests/v3.0.0/testproto_libs1.js +js/compatibility_tests/v3.0.0/testproto_libs1_new.js +js/compatibility_tests/v3.0.0/testproto_libs2.js +js/compatibility_tests/v3.0.0/testproto_libs2_new.js +js/deps.js +js/google-protobuf.js +js/google/ +js/node_modules/ +js/testproto_libs1.js +js/testproto_libs2.js + +# Ignore the bazel symlinks +/bazel-* diff --git a/packager/third_party/protobuf/.gitmodules b/packager/third_party/protobuf/.gitmodules new file mode 100644 index 0000000000..55a47ceafe --- /dev/null +++ b/packager/third_party/protobuf/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/benchmark"] + path = third_party/benchmark + url = https://github.com/google/benchmark.git diff --git a/packager/third_party/protobuf/.travis.yml b/packager/third_party/protobuf/.travis.yml index bcf3851bc2..d49e0a7131 100644 --- a/packager/third_party/protobuf/.travis.yml +++ b/packager/third_party/protobuf/.travis.yml @@ -1,66 +1,76 @@ sudo: required +dist: trusty # Note: travis currently does not support listing more than one language so # this cheats and claims to only be cpp. If they add multiple language # support, this should probably get updated to install steps and/or # rvm/gemfile/jdk/etc. entries rather than manually doing the work. language: cpp os: - - linux - osx # The Objective C build needs Xcode 7.0 or later. -osx_image: xcode7.2 +osx_image: xcode8.1 script: - ./tests.sh $CONFIG env: - CONFIG=cpp - CONFIG=cpp_distcheck - - CONFIG=csharp - CONFIG=golang - - CONFIG=java_jdk6 - CONFIG=java_jdk7 - CONFIG=java_oracle7 - - CONFIG=javanano_jdk6 - CONFIG=javanano_jdk7 - CONFIG=javanano_oracle7 - CONFIG=javascript + # iOS build log was starting to choke travis UI, so split to cover the + # Xcode Debug and Release Configurations independently. + - CONFIG=objectivec_ios_debug + - CONFIG=objectivec_ios_release + - CONFIG=objectivec_osx + - CONFIG=objectivec_cocoapods_integration - CONFIG=python - CONFIG=python_cpp - - CONFIG=ruby19 - - CONFIG=ruby20 - CONFIG=ruby21 - CONFIG=ruby22 - CONFIG=jruby + - CONFIG=php5.6_mac + - CONFIG=php7.0_mac matrix: exclude: # It's nontrivial to programmatically install a new JDK from the command # line on OS X, so we rely on testing on Linux for Java code. - - os: osx - env: CONFIG=java_jdk6 - os: osx env: CONFIG=java_jdk7 - os: osx env: CONFIG=java_oracle7 - - os: osx - env: CONFIG=javanano_jdk6 - os: osx env: CONFIG=javanano_jdk7 - os: osx env: CONFIG=javanano_oracle7 - # Requires installing mono, currently travis.sh is doing that with apt-get - # which doesn't work on OS X. - - os: osx - env: CONFIG=csharp # Requires installing golang, currently travis.sh is doing that with apt-get # which doesn't work on OS X. - os: osx env: CONFIG=golang - # Add into the matrix OS X tests of Objective C (needs Xcode, so it won't - # work on other platforms). These are split so it doesn't take as long to run. include: - - os: osx - env: CONFIG=objectivec_ios - - os: osx - env: CONFIG=objectivec_osx + # The dotnet environment requires Ubuntu 14.04 or 16.04. This + # configuration is effectively an "extra" one, outside the + # autogenerated matrix. + - os: linux + env: CONFIG=csharp + language: csharp + dist: trusty + dotnet: 1.0.1 + mono: none + # This test is kept on travis because it doesn't play nicely with other + # tests on jenkins running in parallel. + - os: linux + env: CONFIG=cpp_distcheck + # The Java compatibility test currently only runs on Linux because it will + # fetch pre-built Linux protoc binaries in the test. + - os: linux + env: CONFIG=java_compatibility + # The Python compatibility test currently only runs on Linux because it will + # fetch pre-built Linux protoc binaries in the test. + - os: linux + env: CONFIG=python_compatibility allow_failures: # These currently do not work on OS X but are being worked on by @haberman. - os: osx @@ -71,14 +81,11 @@ matrix: # we moved to an OS X image that is 10.11. - os: osx env: CONFIG=python_cpp - # xctool 0.2.8 seems to have a bug where it randomly kills tests saying - # they failed. - # https://github.com/facebook/xctool/issues/619 - # https://github.com/google/protobuf/issues/1232 - # travis updated their images to include 0.2.8: - # https://blog.travis-ci.com/2016-03-23-xcode-image-updates - # Mark the iOS test as flakey so these failures don't turn things red. + # Mark the iOS test as flakey as xcodebuild some times fails to start the + # iOS Simulator. - os: osx - env: CONFIG=objectivec_ios + env: CONFIG=objectivec_ios_debug + - os: osx + env: CONFIG=objectivec_ios_release notifications: email: false diff --git a/packager/third_party/protobuf/BUILD b/packager/third_party/protobuf/BUILD index 8b1046b90d..92584af217 100644 --- a/packager/third_party/protobuf/BUILD +++ b/packager/third_party/protobuf/BUILD @@ -2,19 +2,41 @@ licenses(["notice"]) +exports_files(["LICENSE"]) + ################################################################################ # Protobuf Runtime Library ################################################################################ -COPTS = [ - "-DHAVE_PTHREAD", - "-Wall", - "-Wwrite-strings", - "-Woverloaded-virtual", - "-Wno-sign-compare", - "-Wno-error=unused-function", +WIN_COPTS = [ + "/DHAVE_PTHREAD", + "/wd4018", # -Wno-sign-compare + "/wd4514", # -Wno-unused-function ] +COPTS = select({ + ":windows" : WIN_COPTS, + ":windows_msvc" : WIN_COPTS, + "//conditions:default": [ + "-DHAVE_PTHREAD", + "-Wall", + "-Wwrite-strings", + "-Woverloaded-virtual", + "-Wno-sign-compare", + "-Wno-unused-function", + ], +}) + +config_setting( + name = "windows", + values = { "cpu": "x64_windows" }, +) + +config_setting( + name = "windows_msvc", + values = { "cpu": "x64_windows_msvc" }, +) + config_setting( name = "android", values = { @@ -25,13 +47,14 @@ config_setting( # Android builds do not need to link in a separate pthread library. LINK_OPTS = select({ ":android": [], - "//conditions:default": ["-lpthread"], + "//conditions:default": ["-lpthread", "-lm"], }) load( - "protobuf", + ":protobuf.bzl", "cc_proto_library", "py_proto_library", + "internal_copied_filegroup", "internal_gen_well_known_protos_java", "internal_protobuf_py_tests", ) @@ -57,7 +80,7 @@ config_setting( }, ) -IOS_ARM_COPTS = COPTS + [ +IOS_ARM_COPTS = [ "-DOS_IOS", "-miphoneos-version-min=7.0", "-arch armv7", @@ -100,8 +123,8 @@ cc_library( ":ios_armv7": IOS_ARM_COPTS, ":ios_armv7s": IOS_ARM_COPTS, ":ios_arm64": IOS_ARM_COPTS, - "//conditions:default": COPTS, - }), + "//conditions:default": [], + }) + COPTS, includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], @@ -125,6 +148,7 @@ cc_library( "src/google/protobuf/extension_set_heavy.cc", "src/google/protobuf/field_mask.pb.cc", "src/google/protobuf/generated_message_reflection.cc", + "src/google/protobuf/generated_message_table_driven.cc", "src/google/protobuf/io/gzip_stream.cc", "src/google/protobuf/io/printer.cc", "src/google/protobuf/io/strtod.cc", @@ -142,6 +166,7 @@ cc_library( "src/google/protobuf/timestamp.pb.cc", "src/google/protobuf/type.pb.cc", "src/google/protobuf/unknown_field_set.cc", + "src/google/protobuf/util/delimited_message_util.cc", "src/google/protobuf/util/field_comparator.cc", "src/google/protobuf/util/field_mask_util.cc", "src/google/protobuf/util/internal/datapiece.cc", @@ -170,14 +195,25 @@ cc_library( ":ios_armv7": IOS_ARM_COPTS, ":ios_armv7s": IOS_ARM_COPTS, ":ios_arm64": IOS_ARM_COPTS, - "//conditions:default": COPTS, - }), + "//conditions:default": [], + }) + COPTS, includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], deps = [":protobuf_lite"], ) +# This provides just the header files for use in projects that need to build +# shared libraries for dynamic loading. This target is available until Bazel +# adds native support for such use cases. +# TODO(keveman): Remove this target once the support gets added to Bazel. +cc_library( + name = "protobuf_headers", + hdrs = glob(["src/**/*.h"]), + includes = ["src/"], + visibility = ["//visibility:public"], +) + objc_library( name = "protobuf_objc", hdrs = ["objectivec/GPBProtocolBuffers.h"], @@ -191,6 +227,7 @@ RELATIVE_WELL_KNOWN_PROTOS = [ "google/protobuf/any.proto", "google/protobuf/api.proto", "google/protobuf/compiler/plugin.proto", + "google/protobuf/compiler/profile.proto", "google/protobuf/descriptor.proto", "google/protobuf/duration.proto", "google/protobuf/empty.proto", @@ -224,6 +261,24 @@ cc_proto_library( # Protocol Buffers Compiler ################################################################################ +cc_binary( + name = "js_embed", + srcs = ["src/google/protobuf/compiler/js/embed.cc"], + visibility = ["//visibility:public"], +) + +genrule( + name = "generate_js_well_known_types_embed", + srcs = [ + "src/google/protobuf/compiler/js/well_known_types/any.js", + "src/google/protobuf/compiler/js/well_known_types/struct.js", + "src/google/protobuf/compiler/js/well_known_types/timestamp.js", + ], + outs = ["src/google/protobuf/compiler/js/well_known_types_embed.cc"], + cmd = "$(location :js_embed) $(SRCS) > $@", + tools = [":js_embed"], +) + cc_library( name = "protoc_lib", srcs = [ @@ -301,6 +356,7 @@ cc_library( "src/google/protobuf/compiler/javanano/javanano_message_field.cc", "src/google/protobuf/compiler/javanano/javanano_primitive_field.cc", "src/google/protobuf/compiler/js/js_generator.cc", + "src/google/protobuf/compiler/js/well_known_types_embed.cc", "src/google/protobuf/compiler/objectivec/objectivec_enum.cc", "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", "src/google/protobuf/compiler/objectivec/objectivec_extension.cc", @@ -313,8 +369,10 @@ cc_library( "src/google/protobuf/compiler/objectivec/objectivec_message_field.cc", "src/google/protobuf/compiler/objectivec/objectivec_oneof.cc", "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", + "src/google/protobuf/compiler/php/php_generator.cc", "src/google/protobuf/compiler/plugin.cc", "src/google/protobuf/compiler/plugin.pb.cc", + "src/google/protobuf/compiler/profile.pb.cc", "src/google/protobuf/compiler/python/python_generator.cc", "src/google/protobuf/compiler/ruby/ruby_generator.cc", "src/google/protobuf/compiler/subprocess.cc", @@ -366,6 +424,9 @@ RELATIVE_TEST_PROTOS = [ "google/protobuf/unittest_enormous_descriptor.proto", "google/protobuf/unittest_import.proto", "google/protobuf/unittest_import_public.proto", + "google/protobuf/unittest_lazy_dependencies.proto", + "google/protobuf/unittest_lazy_dependencies_custom_option.proto", + "google/protobuf/unittest_lazy_dependencies_enum.proto", "google/protobuf/unittest_lite_imports_nonlite.proto", "google/protobuf/unittest_mset.proto", "google/protobuf/unittest_mset_wire_format.proto", @@ -387,8 +448,10 @@ RELATIVE_TEST_PROTOS = [ "google/protobuf/util/internal/testdata/field_mask.proto", "google/protobuf/util/internal/testdata/maps.proto", "google/protobuf/util/internal/testdata/oneofs.proto", + "google/protobuf/util/internal/testdata/proto3.proto", "google/protobuf/util/internal/testdata/struct.proto", "google/protobuf/util/internal/testdata/timestamp_duration.proto", + "google/protobuf/util/internal/testdata/wrappers.proto", "google/protobuf/util/json_format_proto3.proto", "google/protobuf/util/message_differencer_unittest.proto", ] @@ -440,6 +503,7 @@ cc_test( "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc", "src/google/protobuf/compiler/cpp/cpp_unittest.cc", "src/google/protobuf/compiler/cpp/metadata_test.cc", + "src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc", "src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc", "src/google/protobuf/compiler/importer_unittest.cc", "src/google/protobuf/compiler/java/java_doc_comment_unittest.cc", @@ -485,6 +549,7 @@ cc_test( "src/google/protobuf/stubs/type_traits_unittest.cc", "src/google/protobuf/text_format_unittest.cc", "src/google/protobuf/unknown_field_set_unittest.cc", + "src/google/protobuf/util/delimited_message_util_test.cc", "src/google/protobuf/util/field_comparator_test.cc", "src/google/protobuf/util/field_mask_util_test.cc", "src/google/protobuf/util/internal/default_value_objectwriter_test.cc", @@ -505,6 +570,10 @@ cc_test( ":test_plugin", ] + glob([ "src/google/protobuf/**/*", + # Files for csharp_bootstrap_unittest.cc. + "conformance/**/*", + "csharp/src/**/*", + "examples/**/*", ]), includes = [ "src/", @@ -532,6 +601,7 @@ java_library( ]) + [ ":gen_well_known_protos_java", ], + javacopts = ["-source 6", "-target 6"], visibility = ["//visibility:public"], ) @@ -540,12 +610,13 @@ java_library( srcs = glob([ "java/util/src/main/java/com/google/protobuf/util/*.java", ]), + javacopts = ["-source 6", "-target 6"], + visibility = ["//visibility:public"], deps = [ "protobuf_java", "//external:gson", "//external:guava", ], - visibility = ["//visibility:public"], ) ################################################################################ @@ -560,16 +631,18 @@ py_library( "python/google/protobuf/**/*.py", ], exclude = [ + "python/google/protobuf/__init__.py", + "python/google/protobuf/**/__init__.py", "python/google/protobuf/internal/*_test.py", "python/google/protobuf/internal/test_util.py", ], ), - srcs_version = "PY2AND3", imports = ["python"], + srcs_version = "PY2AND3", ) cc_binary( - name = "internal/_api_implementation.so", + name = "python/google/protobuf/internal/_api_implementation.so", srcs = ["python/google/protobuf/internal/api_implementation.cc"], copts = COPTS + [ "-DPYTHON_PROTO2_CPP_IMPL_V2", @@ -583,7 +656,7 @@ cc_binary( ) cc_binary( - name = "pyext/_message.so", + name = "python/google/protobuf/pyext/_message.so", srcs = glob([ "python/google/protobuf/pyext/*.cc", "python/google/protobuf/pyext/*.h", @@ -622,31 +695,65 @@ config_setting( }, ) +# Copy the builtin proto files from src/google/protobuf to +# python/google/protobuf. This way, the generated Python sources will be in the +# same directory as the Python runtime sources. This is necessary for the +# modules to be imported correctly since they are all part of the same Python +# package. +internal_copied_filegroup( + name = "protos_python", + srcs = WELL_KNOWN_PROTOS, + dest = "python", + strip_prefix = "src", +) + +# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in +# which case we can simply add :protos_python in srcs. +COPIED_WELL_KNOWN_PROTOS = ["python/" + s for s in RELATIVE_WELL_KNOWN_PROTOS] + py_proto_library( name = "protobuf_python", - srcs = WELL_KNOWN_PROTOS, - include = "src", + srcs = COPIED_WELL_KNOWN_PROTOS, + include = "python", data = select({ "//conditions:default": [], ":use_fast_cpp_protos": [ - ":internal/_api_implementation.so", - ":pyext/_message.so", + ":python/google/protobuf/internal/_api_implementation.so", + ":python/google/protobuf/pyext/_message.so", ], }), default_runtime = "", protoc = ":protoc", py_libs = [ ":python_srcs", - "//external:six" + "//external:six", ], srcs_version = "PY2AND3", visibility = ["//visibility:public"], ) +# Copy the test proto files from src/google/protobuf to +# python/google/protobuf. This way, the generated Python sources will be in the +# same directory as the Python runtime sources. This is necessary for the +# modules to be imported correctly by the tests since they are all part of the +# same Python package. +internal_copied_filegroup( + name = "protos_python_test", + srcs = LITE_TEST_PROTOS + TEST_PROTOS, + dest = "python", + strip_prefix = "src", +) + +# TODO(dzc): Remove this once py_proto_library can have labels in srcs, in +# which case we can simply add :protos_python_test in srcs. +COPIED_LITE_TEST_PROTOS = ["python/" + s for s in RELATIVE_LITE_TEST_PROTOS] + +COPIED_TEST_PROTOS = ["python/" + s for s in RELATIVE_TEST_PROTOS] + py_proto_library( name = "python_common_test_protos", - srcs = LITE_TEST_PROTOS + TEST_PROTOS, - include = "src", + srcs = COPIED_LITE_TEST_PROTOS + COPIED_TEST_PROTOS, + include = "python", default_runtime = "", protoc = ":protoc", srcs_version = "PY2AND3", @@ -672,6 +779,7 @@ py_library( [ "python/google/protobuf/internal/*_test.py", "python/google/protobuf/internal/test_util.py", + "python/google/protobuf/internal/import_test_package/__init__.py", ], ), imports = ["python"], @@ -707,3 +815,98 @@ internal_protobuf_py_tests( ], deps = [":python_tests"], ) + +proto_lang_toolchain( + name = "cc_toolchain", + command_line = "--cpp_out=$(OUT)", + runtime = ":protobuf", + visibility = ["//visibility:public"], +) + +proto_lang_toolchain( + name = "java_toolchain", + command_line = "--java_out=$(OUT)", + runtime = ":protobuf_java", + visibility = ["//visibility:public"], +) + +OBJC_HDRS = [ + "objectivec/GPBArray.h", + "objectivec/GPBBootstrap.h", + "objectivec/GPBCodedInputStream.h", + "objectivec/GPBCodedOutputStream.h", + "objectivec/GPBDescriptor.h", + "objectivec/GPBDictionary.h", + "objectivec/GPBExtensionInternals.h", + "objectivec/GPBExtensionRegistry.h", + "objectivec/GPBMessage.h", + "objectivec/GPBProtocolBuffers.h", + "objectivec/GPBProtocolBuffers_RuntimeSupport.h", + "objectivec/GPBRootObject.h", + "objectivec/GPBRuntimeTypes.h", + "objectivec/GPBUnknownField.h", + "objectivec/GPBUnknownFieldSet.h", + "objectivec/GPBUtilities.h", + "objectivec/GPBWellKnownTypes.h", + "objectivec/GPBWireFormat.h", + "objectivec/google/protobuf/Any.pbobjc.h", + "objectivec/google/protobuf/Api.pbobjc.h", + "objectivec/google/protobuf/Duration.pbobjc.h", + "objectivec/google/protobuf/Empty.pbobjc.h", + "objectivec/google/protobuf/FieldMask.pbobjc.h", + "objectivec/google/protobuf/SourceContext.pbobjc.h", + "objectivec/google/protobuf/Struct.pbobjc.h", + "objectivec/google/protobuf/Timestamp.pbobjc.h", + "objectivec/google/protobuf/Type.pbobjc.h", + "objectivec/google/protobuf/Wrappers.pbobjc.h", +] + +OBJC_PRIVATE_HDRS = [ + "objectivec/GPBArray_PackagePrivate.h", + "objectivec/GPBCodedInputStream_PackagePrivate.h", + "objectivec/GPBCodedOutputStream_PackagePrivate.h", + "objectivec/GPBDescriptor_PackagePrivate.h", + "objectivec/GPBDictionary_PackagePrivate.h", + "objectivec/GPBMessage_PackagePrivate.h", + "objectivec/GPBRootObject_PackagePrivate.h", + "objectivec/GPBUnknownFieldSet_PackagePrivate.h", + "objectivec/GPBUnknownField_PackagePrivate.h", + "objectivec/GPBUtilities_PackagePrivate.h", +] + +OBJC_SRCS = [ + "objectivec/GPBArray.m", + "objectivec/GPBCodedInputStream.m", + "objectivec/GPBCodedOutputStream.m", + "objectivec/GPBDescriptor.m", + "objectivec/GPBDictionary.m", + "objectivec/GPBExtensionInternals.m", + "objectivec/GPBExtensionRegistry.m", + "objectivec/GPBMessage.m", + "objectivec/GPBRootObject.m", + "objectivec/GPBUnknownField.m", + "objectivec/GPBUnknownFieldSet.m", + "objectivec/GPBUtilities.m", + "objectivec/GPBWellKnownTypes.m", + "objectivec/GPBWireFormat.m", + "objectivec/google/protobuf/Any.pbobjc.m", + "objectivec/google/protobuf/Api.pbobjc.m", + "objectivec/google/protobuf/Duration.pbobjc.m", + "objectivec/google/protobuf/Empty.pbobjc.m", + "objectivec/google/protobuf/FieldMask.pbobjc.m", + "objectivec/google/protobuf/SourceContext.pbobjc.m", + "objectivec/google/protobuf/Struct.pbobjc.m", + "objectivec/google/protobuf/Timestamp.pbobjc.m", + "objectivec/google/protobuf/Type.pbobjc.m", + "objectivec/google/protobuf/Wrappers.pbobjc.m", +] + +objc_library( + name = "objectivec", + hdrs = OBJC_HDRS + OBJC_PRIVATE_HDRS, + includes = [ + "objectivec", + ], + non_arc_srcs = OBJC_SRCS, + visibility = ["//visibility:public"], +) diff --git a/packager/third_party/protobuf/BUILD.gn b/packager/third_party/protobuf/BUILD.gn index 84c916a651..3f8c1e6095 100644 --- a/packager/third_party/protobuf/BUILD.gn +++ b/packager/third_party/protobuf/BUILD.gn @@ -1,6 +1,7 @@ # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/sanitizers/sanitizers.gni") config("protobuf_config") { include_dirs = [ "src" ] @@ -52,6 +53,7 @@ protobuf_lite_sources = [ "src/google/protobuf/io/zero_copy_stream.h", "src/google/protobuf/io/zero_copy_stream_impl_lite.cc", "src/google/protobuf/io/zero_copy_stream_impl_lite.h", + "src/google/protobuf/has_bits.h", "src/google/protobuf/map.h", "src/google/protobuf/map_entry_lite.h", "src/google/protobuf/map_field_lite.h", @@ -65,10 +67,10 @@ protobuf_lite_sources = [ "src/google/protobuf/stubs/atomicops_internals_arm_gcc.h", "src/google/protobuf/stubs/atomicops_internals_arm_qnx.h", "src/google/protobuf/stubs/atomicops_internals_atomicword_compat.h", + "src/google/protobuf/stubs/atomicops_internals_generic_c11_atomic.h", "src/google/protobuf/stubs/atomicops_internals_generic_gcc.h", "src/google/protobuf/stubs/atomicops_internals_macosx.h", "src/google/protobuf/stubs/atomicops_internals_mips_gcc.h", - "src/google/protobuf/stubs/atomicops_internals_pnacl.h", "src/google/protobuf/stubs/atomicops_internals_power.h", "src/google/protobuf/stubs/atomicops_internals_ppc_gcc.h", "src/google/protobuf/stubs/atomicops_internals_solaris.h", @@ -136,6 +138,27 @@ if (is_win) { ] } +# Do not allow libprotobuf_lite to be dynamically linked on Linux. Later +# versions of Ubuntu like Xenial and Yakkety link in the system +# libprotobuf_lite by the following dependency chain: chrome -> gtk -> +# libmirclient -> libmirprotobuf -> libprotobuf-lite. Trying to load +# the system libprotobuf-lite after already having loaded the libprotobuf_lite +# component will result in an immediate crash. (crbug.com/700120) +if (is_component_build && is_desktop_linux) { + shared_library("mirclient") { + inputs = [ + "mirclient.map", + ] + sources = [ + "mirclient.cc", + ] + ldflags = + [ "-Wl,--version-script=" + + rebase_path("//third_party/protobuf/mirclient.map", root_build_dir) ] + output_extension = "so.9" + } +} + component("protobuf_lite") { sources = protobuf_lite_sources @@ -148,6 +171,12 @@ component("protobuf_lite") { ":protobuf_warnings", ] + # Remove Sanitizers and coverage for a performance boost when fuzzing. This is + # OK because the only fuzzers that use protobuf are libprotobuf-mutator based + # fuzzers, and they don't actually target the protobuf code, they just use it. + configs -= not_fuzzed_remove_configs + configs += [ "//build/config/sanitizers:not_fuzzed" ] + if (is_win) { configs -= [ "//build/config/win:lean_and_mean" ] } @@ -160,11 +189,19 @@ component("protobuf_lite") { ] deps = [ - "//build/config/sanitizers:deps", + "//build/config:exe_and_shlib_deps", ] + if (is_android) { + libs = [ "log" ] # Used by src/google/protobuf/stubs/common.cc + } + cflags = protobuf_lite_cflags + if (is_component_build && is_desktop_linux) { + deps += [ ":mirclient" ] + } + # Required for component builds. See http://crbug.com/172800. if (is_component_build) { public_configs += [ ":protobuf_use_dlls" ] @@ -177,141 +214,158 @@ component("protobuf_lite") { # into that category. Do not use in Chrome code. static_library("protobuf_full") { # Prevent people from depending on this outside our file. - visibility = [ ":*" ] + visibility = [ + ":*", - sources = protobuf_lite_sources - sources += [ - "src/google/protobuf/any.cc", - "src/google/protobuf/any.h", - "src/google/protobuf/any.pb.cc", - "src/google/protobuf/any.pb.h", - "src/google/protobuf/api.pb.cc", - "src/google/protobuf/api.pb.h", - "src/google/protobuf/compiler/importer.cc", - "src/google/protobuf/compiler/importer.h", - "src/google/protobuf/compiler/parser.cc", - "src/google/protobuf/compiler/parser.h", - "src/google/protobuf/descriptor.cc", - "src/google/protobuf/descriptor.h", - "src/google/protobuf/descriptor.pb.cc", - "src/google/protobuf/descriptor.pb.h", - "src/google/protobuf/descriptor_database.cc", - "src/google/protobuf/descriptor_database.h", - "src/google/protobuf/duration.pb.cc", - "src/google/protobuf/duration.pb.h", - "src/google/protobuf/dynamic_message.cc", - "src/google/protobuf/dynamic_message.h", - "src/google/protobuf/empty.pb.cc", - "src/google/protobuf/empty.pb.h", - "src/google/protobuf/extension_set_heavy.cc", - "src/google/protobuf/field_mask.pb.cc", - "src/google/protobuf/field_mask.pb.h", - "src/google/protobuf/generated_enum_reflection.h", - "src/google/protobuf/generated_enum_util.h", - "src/google/protobuf/generated_message_reflection.cc", - "src/google/protobuf/generated_message_reflection.h", + # requires descriptors & reflection; testonly. + "//third_party/libprotobuf-mutator:*", - # gzip_stream.cc pulls in zlib, but it's not actually used by protoc, just - # by test code, so instead of compiling zlib for the host, let's just - # exclude this. - # "src/google/protobuf/io/gzip_stream.cc", - # "src/google/protobuf/io/gzip_stream.h", + # The traffic_annotation tool is not part of Chrome itself, and needs to + # parse human-readable protobufs. + "//tools/traffic_annotation/*", - "src/google/protobuf/io/printer.cc", - "src/google/protobuf/io/printer.h", - "src/google/protobuf/io/strtod.cc", - "src/google/protobuf/io/strtod.h", - "src/google/protobuf/io/tokenizer.cc", - "src/google/protobuf/io/tokenizer.h", - "src/google/protobuf/io/zero_copy_stream_impl.cc", - "src/google/protobuf/io/zero_copy_stream_impl.h", - "src/google/protobuf/map_entry.h", - "src/google/protobuf/map_field.cc", - "src/google/protobuf/map_field.h", - "src/google/protobuf/map_field_inl.h", - "src/google/protobuf/message.cc", - "src/google/protobuf/message.h", - "src/google/protobuf/metadata.h", - "src/google/protobuf/reflection.h", - "src/google/protobuf/reflection_internal.h", - "src/google/protobuf/reflection_ops.cc", - "src/google/protobuf/reflection_ops.h", - "src/google/protobuf/service.cc", - "src/google/protobuf/service.h", - "src/google/protobuf/source_context.pb.cc", - "src/google/protobuf/source_context.pb.h", - "src/google/protobuf/struct.pb.cc", - "src/google/protobuf/struct.pb.h", - "src/google/protobuf/stubs/mathlimits.cc", - "src/google/protobuf/stubs/mathlimits.h", - "src/google/protobuf/stubs/mathutil.h", - "src/google/protobuf/stubs/singleton.h", - "src/google/protobuf/stubs/substitute.cc", - "src/google/protobuf/stubs/substitute.h", - "src/google/protobuf/text_format.cc", - "src/google/protobuf/text_format.h", - "src/google/protobuf/timestamp.pb.cc", - "src/google/protobuf/timestamp.pb.h", - "src/google/protobuf/type.pb.cc", - "src/google/protobuf/type.pb.h", - "src/google/protobuf/unknown_field_set.cc", - "src/google/protobuf/unknown_field_set.h", - "src/google/protobuf/util/field_comparator.cc", - "src/google/protobuf/util/field_comparator.h", - "src/google/protobuf/util/field_mask_util.cc", - "src/google/protobuf/util/field_mask_util.h", - "src/google/protobuf/util/internal/constants.h", - "src/google/protobuf/util/internal/datapiece.cc", - "src/google/protobuf/util/internal/datapiece.h", - "src/google/protobuf/util/internal/default_value_objectwriter.cc", - "src/google/protobuf/util/internal/default_value_objectwriter.h", - "src/google/protobuf/util/internal/error_listener.cc", - "src/google/protobuf/util/internal/error_listener.h", - "src/google/protobuf/util/internal/field_mask_utility.cc", - "src/google/protobuf/util/internal/field_mask_utility.h", - "src/google/protobuf/util/internal/json_escaping.cc", - "src/google/protobuf/util/internal/json_escaping.h", - "src/google/protobuf/util/internal/json_objectwriter.cc", - "src/google/protobuf/util/internal/json_objectwriter.h", - "src/google/protobuf/util/internal/json_stream_parser.cc", - "src/google/protobuf/util/internal/json_stream_parser.h", - "src/google/protobuf/util/internal/location_tracker.h", - "src/google/protobuf/util/internal/object_location_tracker.h", - "src/google/protobuf/util/internal/object_source.h", - "src/google/protobuf/util/internal/object_writer.cc", - "src/google/protobuf/util/internal/object_writer.h", - "src/google/protobuf/util/internal/proto_writer.cc", - "src/google/protobuf/util/internal/proto_writer.h", - "src/google/protobuf/util/internal/protostream_objectsource.cc", - "src/google/protobuf/util/internal/protostream_objectsource.h", - "src/google/protobuf/util/internal/protostream_objectwriter.cc", - "src/google/protobuf/util/internal/protostream_objectwriter.h", - "src/google/protobuf/util/internal/structured_objectwriter.h", - "src/google/protobuf/util/internal/type_info.cc", - "src/google/protobuf/util/internal/type_info.h", - "src/google/protobuf/util/internal/type_info_test_helper.cc", - "src/google/protobuf/util/internal/type_info_test_helper.h", - "src/google/protobuf/util/internal/utility.cc", - "src/google/protobuf/util/internal/utility.h", - "src/google/protobuf/util/json_util.cc", - "src/google/protobuf/util/json_util.h", - "src/google/protobuf/util/message_differencer.cc", - "src/google/protobuf/util/message_differencer.h", - "src/google/protobuf/util/time_util.cc", - "src/google/protobuf/util/time_util.h", - "src/google/protobuf/util/type_resolver.h", - "src/google/protobuf/util/type_resolver_util.cc", - "src/google/protobuf/util/type_resolver_util.h", - "src/google/protobuf/wire_format.cc", - "src/google/protobuf/wire_format.h", - "src/google/protobuf/wrappers.pb.cc", - "src/google/protobuf/wrappers.pb.h", + # Chromecast requires descriptors and reflection. + "//chromecast/*", + + # Perfetto uses the full library for testing. + "//third_party/perfetto/protos/ftrace:full", + "//third_party/perfetto/gn:protobuf_full_deps", ] + sources = protobuf_lite_sources + [ + "src/google/protobuf/any.cc", + "src/google/protobuf/any.h", + "src/google/protobuf/any.pb.cc", + "src/google/protobuf/any.pb.h", + "src/google/protobuf/api.pb.cc", + "src/google/protobuf/api.pb.h", + "src/google/protobuf/compiler/importer.cc", + "src/google/protobuf/compiler/importer.h", + "src/google/protobuf/compiler/parser.cc", + "src/google/protobuf/compiler/parser.h", + "src/google/protobuf/descriptor.cc", + "src/google/protobuf/descriptor.h", + "src/google/protobuf/descriptor.pb.cc", + "src/google/protobuf/descriptor.pb.h", + "src/google/protobuf/descriptor_database.cc", + "src/google/protobuf/descriptor_database.h", + "src/google/protobuf/duration.pb.cc", + "src/google/protobuf/duration.pb.h", + "src/google/protobuf/dynamic_message.cc", + "src/google/protobuf/dynamic_message.h", + "src/google/protobuf/empty.pb.cc", + "src/google/protobuf/empty.pb.h", + "src/google/protobuf/extension_set_heavy.cc", + "src/google/protobuf/field_mask.pb.cc", + "src/google/protobuf/field_mask.pb.h", + "src/google/protobuf/generated_enum_reflection.h", + "src/google/protobuf/generated_enum_util.h", + "src/google/protobuf/generated_message_reflection.cc", + "src/google/protobuf/generated_message_reflection.h", + + "src/google/protobuf/io/gzip_stream.cc", + "src/google/protobuf/io/gzip_stream.h", + + "src/google/protobuf/io/printer.cc", + "src/google/protobuf/io/printer.h", + "src/google/protobuf/io/strtod.cc", + "src/google/protobuf/io/strtod.h", + "src/google/protobuf/io/tokenizer.cc", + "src/google/protobuf/io/tokenizer.h", + "src/google/protobuf/io/zero_copy_stream_impl.cc", + "src/google/protobuf/io/zero_copy_stream_impl.h", + "src/google/protobuf/map_entry.h", + "src/google/protobuf/map_field.cc", + "src/google/protobuf/map_field.h", + "src/google/protobuf/map_field_inl.h", + "src/google/protobuf/message.cc", + "src/google/protobuf/message.h", + "src/google/protobuf/metadata.h", + "src/google/protobuf/reflection.h", + "src/google/protobuf/reflection_internal.h", + "src/google/protobuf/reflection_ops.cc", + "src/google/protobuf/reflection_ops.h", + "src/google/protobuf/service.cc", + "src/google/protobuf/service.h", + "src/google/protobuf/source_context.pb.cc", + "src/google/protobuf/source_context.pb.h", + "src/google/protobuf/struct.pb.cc", + "src/google/protobuf/struct.pb.h", + "src/google/protobuf/stubs/mathlimits.cc", + "src/google/protobuf/stubs/mathlimits.h", + "src/google/protobuf/stubs/mathutil.h", + "src/google/protobuf/stubs/singleton.h", + "src/google/protobuf/stubs/substitute.cc", + "src/google/protobuf/stubs/substitute.h", + "src/google/protobuf/text_format.cc", + "src/google/protobuf/text_format.h", + "src/google/protobuf/timestamp.pb.cc", + "src/google/protobuf/timestamp.pb.h", + "src/google/protobuf/type.pb.cc", + "src/google/protobuf/type.pb.h", + "src/google/protobuf/unknown_field_set.cc", + "src/google/protobuf/unknown_field_set.h", + "src/google/protobuf/util/field_comparator.cc", + "src/google/protobuf/util/field_comparator.h", + "src/google/protobuf/util/field_mask_util.cc", + "src/google/protobuf/util/field_mask_util.h", + "src/google/protobuf/util/internal/constants.h", + "src/google/protobuf/util/internal/datapiece.cc", + "src/google/protobuf/util/internal/datapiece.h", + "src/google/protobuf/util/internal/default_value_objectwriter.cc", + "src/google/protobuf/util/internal/default_value_objectwriter.h", + "src/google/protobuf/util/internal/error_listener.cc", + "src/google/protobuf/util/internal/error_listener.h", + "src/google/protobuf/util/internal/field_mask_utility.cc", + "src/google/protobuf/util/internal/field_mask_utility.h", + "src/google/protobuf/util/internal/json_escaping.cc", + "src/google/protobuf/util/internal/json_escaping.h", + "src/google/protobuf/util/internal/json_objectwriter.cc", + "src/google/protobuf/util/internal/json_objectwriter.h", + "src/google/protobuf/util/internal/json_stream_parser.cc", + "src/google/protobuf/util/internal/json_stream_parser.h", + "src/google/protobuf/util/internal/location_tracker.h", + "src/google/protobuf/util/internal/object_location_tracker.h", + "src/google/protobuf/util/internal/object_source.h", + "src/google/protobuf/util/internal/object_writer.cc", + "src/google/protobuf/util/internal/object_writer.h", + "src/google/protobuf/util/internal/proto_writer.cc", + "src/google/protobuf/util/internal/proto_writer.h", + "src/google/protobuf/util/internal/protostream_objectsource.cc", + "src/google/protobuf/util/internal/protostream_objectsource.h", + "src/google/protobuf/util/internal/protostream_objectwriter.cc", + "src/google/protobuf/util/internal/protostream_objectwriter.h", + "src/google/protobuf/util/internal/structured_objectwriter.h", + "src/google/protobuf/util/internal/type_info.cc", + "src/google/protobuf/util/internal/type_info.h", + "src/google/protobuf/util/internal/type_info_test_helper.cc", + "src/google/protobuf/util/internal/type_info_test_helper.h", + "src/google/protobuf/util/internal/utility.cc", + "src/google/protobuf/util/internal/utility.h", + "src/google/protobuf/util/json_util.cc", + "src/google/protobuf/util/json_util.h", + "src/google/protobuf/util/message_differencer.cc", + "src/google/protobuf/util/message_differencer.h", + "src/google/protobuf/util/time_util.cc", + "src/google/protobuf/util/time_util.h", + "src/google/protobuf/util/type_resolver.h", + "src/google/protobuf/util/type_resolver_util.cc", + "src/google/protobuf/util/type_resolver_util.h", + "src/google/protobuf/wire_format.cc", + "src/google/protobuf/wire_format.h", + "src/google/protobuf/wrappers.pb.cc", + "src/google/protobuf/wrappers.pb.h", + ] + deps = [ - "//build/config/sanitizers:deps", + "//build/config:exe_and_shlib_deps", + "//third_party/zlib", ] + if (is_android) { + libs = [ "log" ] # Used by src/google/protobuf/stubs/common.cc + } + configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", @@ -320,6 +374,13 @@ static_library("protobuf_full") { # correctly. ":protobuf_warnings", ] + + # Remove coverage and Sanitizers other than ASan for a performance boost when + # fuzzing. ASan can't be removed here because of a bug preventing unsanitized + # code from using libc++, which protobuf_full uses. + configs -= not_fuzzed_remove_nonasan_configs + configs += [ "//build/config/sanitizers:not_fuzzed" ] + if (is_win) { configs -= [ "//build/config/win:lean_and_mean" ] } @@ -331,6 +392,8 @@ static_library("protobuf_full") { ] cflags = protobuf_lite_cflags + + defines = [ "HAVE_ZLIB" ] } # Only compile the compiler for the host architecture. @@ -452,6 +515,7 @@ if (current_toolchain == host_toolchain) { "src/google/protobuf/compiler/java/java_message_lite.h", "src/google/protobuf/compiler/java/java_name_resolver.cc", "src/google/protobuf/compiler/java/java_name_resolver.h", + "src/google/protobuf/compiler/java/java_options.h", "src/google/protobuf/compiler/java/java_primitive_field.cc", "src/google/protobuf/compiler/java/java_primitive_field.h", "src/google/protobuf/compiler/java/java_primitive_field_lite.cc", @@ -488,6 +552,8 @@ if (current_toolchain == host_toolchain) { "src/google/protobuf/compiler/javanano/javanano_primitive_field.h", "src/google/protobuf/compiler/js/js_generator.cc", "src/google/protobuf/compiler/js/js_generator.h", + "src/google/protobuf/compiler/js/well_known_types_embed.cc", + "src/google/protobuf/compiler/js/well_known_types_embed.h", "src/google/protobuf/compiler/objectivec/objectivec_enum.cc", "src/google/protobuf/compiler/objectivec/objectivec_enum.h", "src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc", @@ -512,6 +578,8 @@ if (current_toolchain == host_toolchain) { "src/google/protobuf/compiler/objectivec/objectivec_oneof.h", "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc", "src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h", + "src/google/protobuf/compiler/php/php_generator.cc", + "src/google/protobuf/compiler/php/php_generator.h", "src/google/protobuf/compiler/plugin.cc", "src/google/protobuf/compiler/plugin.h", "src/google/protobuf/compiler/plugin.pb.cc", @@ -565,6 +633,18 @@ if (current_toolchain == host_toolchain) { "//build/win:default_exe_manifest", ] } + + executable("js_embed") { + deps = [ + "//build/config:exe_and_shlib_deps", + ] + sources = [ + "src/google/protobuf/compiler/js/embed.cc", + ] + + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + } } google_python_dir = "$root_out_dir/pyproto/google" @@ -650,3 +730,59 @@ group("py_proto") { data += get_target_outputs(":copy_google_protobuf") data += get_target_outputs(":copy_google_protobuf_internal") } + +if (is_android) { + import("//build/config/android/rules.gni") + + android_library("protobuf_lite_javalib") { + chromium_code = false + java_files = [ + "java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java", + "java/core/src/main/java/com/google/protobuf/AbstractParser.java", + "java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java", + "java/core/src/main/java/com/google/protobuf/BooleanArrayList.java", + "java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java", + "java/core/src/main/java/com/google/protobuf/ByteOutput.java", + "java/core/src/main/java/com/google/protobuf/ByteString.java", + "java/core/src/main/java/com/google/protobuf/CodedInputStream.java", + "java/core/src/main/java/com/google/protobuf/CodedOutputStream.java", + "java/core/src/main/java/com/google/protobuf/DoubleArrayList.java", + "java/core/src/main/java/com/google/protobuf/ExperimentalApi.java", + "java/core/src/main/java/com/google/protobuf/ExtensionLite.java", + "java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java", + "java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java", + "java/core/src/main/java/com/google/protobuf/FieldSet.java", + "java/core/src/main/java/com/google/protobuf/FloatArrayList.java", + "java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java", + "java/core/src/main/java/com/google/protobuf/IntArrayList.java", + "java/core/src/main/java/com/google/protobuf/Internal.java", + "java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java", + "java/core/src/main/java/com/google/protobuf/LazyField.java", + "java/core/src/main/java/com/google/protobuf/LazyFieldLite.java", + "java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java", + "java/core/src/main/java/com/google/protobuf/LazyStringList.java", + "java/core/src/main/java/com/google/protobuf/LongArrayList.java", + "java/core/src/main/java/com/google/protobuf/MapEntryLite.java", + "java/core/src/main/java/com/google/protobuf/MapFieldLite.java", + "java/core/src/main/java/com/google/protobuf/MessageLite.java", + "java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java", + "java/core/src/main/java/com/google/protobuf/MessageLiteToString.java", + "java/core/src/main/java/com/google/protobuf/MutabilityOracle.java", + "java/core/src/main/java/com/google/protobuf/NioByteString.java", + "java/core/src/main/java/com/google/protobuf/Parser.java", + "java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java", + "java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java", + "java/core/src/main/java/com/google/protobuf/ProtocolStringList.java", + "java/core/src/main/java/com/google/protobuf/RopeByteString.java", + "java/core/src/main/java/com/google/protobuf/SmallSortedMap.java", + "java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java", + "java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java", + "java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java", + "java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java", + "java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java", + "java/core/src/main/java/com/google/protobuf/UnsafeUtil.java", + "java/core/src/main/java/com/google/protobuf/Utf8.java", + "java/core/src/main/java/com/google/protobuf/WireFormat.java", + ] + } +} diff --git a/packager/third_party/protobuf/CHANGES.txt b/packager/third_party/protobuf/CHANGES.txt index 3459cccfa9..ccc8ff9439 100644 --- a/packager/third_party/protobuf/CHANGES.txt +++ b/packager/third_party/protobuf/CHANGES.txt @@ -1,3 +1,415 @@ +2017-04-05 version 3.3.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + Planned Future Changes + * There are some changes that are not included in this release but are + planned for the near future: + - Preserve unknown fields in proto3: please read this doc: + + https://docs.google.com/document/d/1KMRX-G91Aa-Y2FkEaHeeviLRRNblgIahbsk4wA14gRk/view + + for the timeline and follow up this github issue: + + https://github.com/google/protobuf/issues/272 + + for discussion. + - Make C++ implementation C++11 only: we plan to require C++11 to build + protobuf code starting from 3.4.0 or 3.5.0 release. Please join this + github issue: + + https://github.com/google/protobuf/issues/2780 + + to provide your feedback. + + C++ + * Fixed map fields serialization of DynamicMessage to correctly serialize + both key and value regardless of their presence. + * Parser now rejects field number 0 correctly. + * New API Message::SpaceUsedLong() that’s equivalent to + Message::SpaceUsed() but returns the value in size_t. + * JSON support + - New flag always_print_enums_as_ints in JsonPrintOptions. + - New flag preserve_proto_field_names in JsonPrintOptions. It will instruct + the JSON printer to use the original field name declared in the .proto + file instead of converting them to lowerCamelCase when printing JSON. + - JsonPrintOptions.always_print_primtive_fields now works for oneof message + fields. + - Fixed a bug that doesn’t allow different fields to set the same json_name + value. + - Fixed a performance bug that causes excessive memory copy when printing + large messages. + * Various performance optimizations. + + Java + * Map field setters eagerly validate inputs and throw NullPointerExceptions + as appropriate. + * Added ByteBuffer overloads to the generated parsing methods and the Parser + interface. + * proto3 enum's getNumber() method now throws on UNRECOGNIZED values. + * Output of JsonFormat is now locale independent. + + Python + * Added FindServiceByName() in the pure-Python DescriptorPool. This works only + for descriptors added with DescriptorPool.Add(). Generated descriptor_pool + does not support this yet. + * Added a descriptor_pool parameter for parsing Any in text_format.Parse(). + * descriptor_pool.FindFileContainingSymbol() now is able to find nested + extensions. + * Extending empty [] to repeated field now sets parent message presence. + + PHP + * Added file option php_class_prefix. The prefix will be prepended to all + generated classes defined in the file. + * When encoding, negative int32 values are sign-extended to int64. + * Repeated/Map field setter accepts a regular PHP array. Type checking is + done on the array elements. + * encode/decode are renamed to serializeToString/mergeFromString. + * Added mergeFrom, clear method on Message. + * Fixed a bug that oneof accessor didn’t return the field name that is + actually set. + * C extension now works with php7. + * This is the first GA release of PHP. We guarantee that old generated code + can always work with new runtime and new generated code. + + Objective-C + * Fixed help for GPBTimestamp for dates before the epoch that contain + fractional seconds. + * Added GPBMessageDropUnknownFieldsRecursively() to remove unknowns from a + message and any sub messages. + * Addressed a threading race in extension registration/lookup. + * Increased the max message parsing depth to 100 to match the other languages. + * Removed some use of dispatch_once in favor of atomic compare/set since it + needs to be heap based. + * Fixes for new Xcode 8.3 warnings. + + C# + * Fixed MapField.Values.CopyTo, which would throw an exception unnecessarily + if provided exactly the right size of array to copy to. + * Fixed enum JSON formatting when multiple names mapped to the same numeric + value. + * Added JSON formatting option to format enums as integers. + * Modified RepeatedField to implement IReadOnlyList. + * Introduced the start of custom option handling; it's not as pleasant as it + might be, but the information is at least present. We expect to extend code + generation to improve this in the future. + * Introduced ByteString.FromStream and ByteString.FromStreamAsync to + efficiently create a ByteString from a stream. + * Added whole-message deprecation, which decorates the class with [Obsolete]. + + Ruby + * Fixed Message#to_h for messages with map fields. + * Fixed memcpy() in binary gems to work for old glibc, without breaking the + build for non-glibc libc’s like musl. + + Javascript + * Added compatibility tests for version 3.0.0. + * Added conformance tests. + * Fixed serialization of extensions: we need to emit a value even if it is + falsy (like the number 0). + * Use closurebuilder.py in favor of calcdeps.py for compiling JavaScript. + +2017-01-23 version 3.2.0 (C++/Java/Python/PHP/Ruby/Objective-C/C#/JavaScript/Lite) + General + * Added protoc version number to protoc plugin protocol. It can be used by + protoc plugin to detect which version of protoc is used with the plugin and + mitigate known problems in certain version of protoc. + + C++ + * The default parsing byte size limit has been raised from 64MB to 2GB. + * Added rvalue setters for non-arena string fields. + * Enabled debug logging for Android. + * Fixed a double-free problem when using Reflection::SetAllocatedMessage() + with extension fields. + * Fixed several deterministic serialization bugs: + * MessageLite::SerializeAsString() now respects the global deterministic + serialization flag. + * Extension fields are serialized deterministically as well. Fixed protocol + compiler to correctly report importing-self as an error. + * Fixed FileDescriptor::DebugString() to print custom options correctly. + * Various performance/codesize optimizations and cleanups. + + Java + * The default parsing byte size limit has been raised from 64MB to 2GB. + * Added recursion limit when parsing JSON. + * Fixed a bug that enumType.getDescriptor().getOptions() doesn't have custom + options. + * Fixed generated code to support field numbers up to 2^29-1. + + Python + * You can now assign NumPy scalars/arrays (np.int32, np.int64) to protobuf + fields, and assigning other numeric types has been optimized for + performance. + * Pure-Python: message types are now garbage-collectable. + * Python/C++: a lot of internal cleanup/refactoring. + + PHP (Alpha) + * For 64-bit integers type (int64/uint64/sfixed64/fixed64/sint64), use PHP + integer on 64-bit environment and PHP string on 32-bit environment. + * PHP generated code also conforms to PSR-4 now. + * Fixed ZTS build for c extension. + * Fixed c extension build on Mac. + * Fixed c extension build on 32-bit linux. + * Fixed the bug that message without namespace is not found in the descriptor + pool. (#2240) + * Fixed the bug that repeated field is not iterable in c extension. + * Message names Empty will be converted to GPBEmpty in generated code. + * Added phpdoc in generated files. + * The released API is almost stable. Unless there is large problem, we won't + change it. See + https://developers.google.com/protocol-buffers/docs/reference/php-generated + for more details. + + Objective-C + * Added support for push/pop of the stream limit on CodedInputStream for + anyone doing manual parsing. + + C# + * No changes. + + Ruby + * Message objects now support #respond_to? for field getters/setters. + * You can now compare “message == non_message_object†and it will return false + instead of throwing an exception. + * JRuby: fixed #hashCode to properly reflect the values in the message. + + Javascript + * Deserialization of repeated fields no longer has quadratic performance + behavior. + * UTF-8 encoding/decoding now properly supports high codepoints. + * Added convenience methods for some well-known types: Any, Struct, and + Timestamp. These make it easier to convert data between native JavaScript + types and the well-known protobuf types. + +2016-09-23 version 3.1.0 (C++/Java/Python/PHP/Ruby/Objective-C/C#/JavaScript/Lite) + General + * Proto3 support in PHP (alpha). + * Various bug fixes. + + C++ + * Added MessageLite::ByteSizeLong() that’s equivalent to + MessageLite::ByteSize() but returns the value in size_t. Useful to check + whether a message is over the 2G size limit that protobuf can support. + * Moved default_instances to global variables. This allows default_instance + addresses to be known at compile time. + * Adding missing generic gcc 64-bit atomicops. + * Restore New*Callback into google::protobuf namespace since these are used + by the service stubs code + * JSON support. + * Fixed some conformance issues. + * Fixed a JSON serialization bug for bytes fields. + + Java + * Fixed a bug in TextFormat that doesn’t accept empty repeated fields (i.e., + “field: [ ]â€). + * JSON support + * Fixed JsonFormat to do correct snake_case-to-camelCase conversion for + non-style-conforming field names. + * Fixed JsonFormat to parse empty Any message correctly. + * Added an option to JsonFormat.Parser to ignore unknown fields. + * Experimental API + * Added UnsafeByteOperations.unsafeWrap(byte[]) to wrap a byte array into + ByteString without copy. + + Python + * JSON support + * Fixed some conformance issues. + + PHP (Alpha) + * We have added the proto3 support for PHP via both a pure PHP package and a + native c extension. The pure PHP package is intended to provide usability + to wider range of PHP platforms, while the c extension is intended to + provide higher performance. Both implementations provide the same runtime + APIs and share the same generated code. Users don’t need to re-generate + code for the same proto definition when they want to switch the + implementation later. The pure PHP package is included in the php/src + directory, and the c extension is included in the php/ext directory. + + Both implementations provide idiomatic PHP APIs: + * All messages and enums are defined as PHP classes. + * All message fields can only be accessed via getter/setter. + * Both repeated field elements and map elements are stored in containers + that act like a normal PHP array. + + Unlike several existing third-party PHP implementations for protobuf, our + implementations are built on a "strongly-typed" philosophy: message fields + and array/map containers will throw exceptions eagerly when values of the + incorrect type (not including those that can be type converted, e.g., + double <-> integer <-> numeric string) are inserted. + + Currently, pure PHP runtime supports php5.5, 5.6 and 7 on linux. C + extension runtime supports php5.5 and 5.6 on linux. + + See php/README.md for more details about installment. See + https://developers.google.com/protocol-buffers/docs/phptutorial for more + details about APIs. + + Objective-C + * Helpers are now provided for working the the Any well known type (see + GPBWellKnownTypes.h for the api additions). + * Some improvements in startup code (especially when extensions aren’t used). + + Javascript + * Fixed missing import of jspb.Map + * Fixed valueWriterFn variable name + + Ruby + * Fixed hash computation for JRuby's RubyMessage + * Make sure map parsing frames are GC-rooted. + * Added API support for well-known types. + + C# + * Removed check on dependency in the C# reflection API. + +2016-09-06 version 3.0.2 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite) + General + * Various bug fixes. + + Objective C + * Fix for oneofs in proto3 syntax files where fields were set to the zero + value. + * Fix for embedded null character in strings. + * CocoaDocs support + + Ruby + * Fixed memory corruption bug in parsing that could occur under GC pressure. + + Javascript + * jspb.Map is now properly exported to CommonJS modules. + + C# + * Removed legacy_enum_values flag. + + +2016-07-27 version 3.0.0 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript/Lite) + General + * This log only contains changes since the beta-4 release. Summarized change + log since the last stable release (v2.6.1) can be found in the github + release page. + + Compatibility Notice + * v3.0.0 is the first API stable release of the v3.x series. We do not expect + any future API breaking changes. + * For C++, Java Lite and Objective-C, source level compatibility is + guaranteed. Upgrading from v3.0.0 to newer minor version releases will be + source compatible. For example, if your code compiles against protobuf + v3.0.0, it will continue to compile after you upgrade protobuf library to + v3.1.0. + * For other languages, both source level compatibility and binary level + compatibility are guaranteed. For example, if you have a Java binary built + against protobuf v3.0.0. After switching the protobuf runtime binary to + v3.1.0, your built binary should continue to work. + * Compatibility is only guaranteed for documented API and documented + behaviors. If you are using undocumented API (e.g., use anything in the C++ + internal namespace), it can be broken by minor version releases in an + undetermined manner. + + Ruby + * When you assign a string field `a.string_field = "X"`, we now call + #encode(UTF-8) on the string and freeze the copy. This saves you from + needing to ensure the string is already encoded as UTF-8. It also prevents + you from mutating the string after it has been assigned (this is how we + ensure it stays valid UTF-8). + * The generated file for `foo.proto` is now `foo_pb.rb` instead of just + `foo.rb`. This makes it easier to see which imports/requires are from + protobuf generated code, and also prevents conflicts with any `foo.rb` file + you might have written directly in Ruby. It is a backward-incompatible + change: you will need to update all of your `require` statements. + * For package names like `foo_bar`, we now translate this to the Ruby module + `FooBar`. This is more idiomatic Ruby than what we used to do (`Foo_bar`). + + JavaScript + * Scalar fields like numbers and boolean now return defaults instead of + `undefined` or `null` when they are unset. You can test for presence + explicitly by calling `hasFoo()`, which we now generate for scalar fields. + + Java Lite + * Java Lite is now implemented as a separate plugin, maintained in the + `javalite` branch. Both lite runtime and protoc artifacts will be available + in Maven. + + C# + * Target platforms now .NET 4.5, selected portable subsets and .NET Core. + * legacy_enum_values option is no longer supported. + +2016-07-15 version 3.0.0-beta-4 (C++/Java/Python/Ruby/Objective-C/C#/JavaScript) + General + * Added a deterministic serialization API for C++. The deterministic + serialization guarantees that given a binary, equal messages will be + serialized to the same bytes. This allows applications like MapReduce to + group equal messages based on the serialized bytes. The deterministic + serialization is, however, NOT canonical across languages; it is also + unstable across different builds with schema changes due to unknown fields. + Users who need canonical serialization, e.g. persistent storage in a + canonical form, fingerprinting, etc, should define their own + canonicalization specification and implement the serializer using reflection + APIs rather than relying on this API. + * Added OneofOptions. You can now define custom options for oneof groups. + import "google/protobuf/descriptor.proto"; + extend google.protobuf.OneofOptions { + optional int32 my_oneof_extension = 12345; + } + message Foo { + oneof oneof_group { + (my_oneof_extension) = 54321; + ... + } + } + + C++ (beta) + * Introduced a deterministic serialization API in + CodedOutputStream::SetSerializationDeterministic(bool). See the notes about + deterministic serialization in the General section. + * Added google::protobuf::Map::swap() to swap two map fields. + * Fixed a memory leak when calling Reflection::ReleaseMessage() on a message + allocated on arena. + * Improved error reporting when parsing text format protos. + * JSON + - Added a new parser option to ignore unknown fields when parsing JSON. + - Added convenient methods for message to/from JSON conversion. + * Various performance optimizations. + + Java (beta) + * File option "java_generate_equals_and_hash" is now deprecated. equals() and + hashCode() methods are generated by default. + * Added a new JSON printer option "omittingInsignificantWhitespace" to produce + a more compact JSON output. The printer will pretty-print by default. + * Updated Java runtime to be compatible with 2.5.0/2.6.1 generated protos. + + Python (beta) + * Added support to pretty print Any messages in text format. + * Added a flag to ignore unknown fields when parsing JSON. + * Bugfix: "@type" field of a JSON Any message is now correctly put before + other fields. + + Objective-C (beta) + * Updated the code to support compiling with more compiler warnings + enabled. (Issue 1616) + * Exposing more detailed errors for parsing failures. (PR 1623) + * Small (breaking) change to the naming of some methods on the support classes + for map<>. There were collisions with the system provided KVO support, so + the names were changed to avoid those issues. (PR 1699) + * Fixed for proper Swift bridging of error handling during parsing. (PR 1712) + * Complete support for generating sources that will go into a Framework and + depend on generated sources from other Frameworks. (Issue 1457) + + C# (beta) + * RepeatedField optimizations. + * Support for .NET Core. + * Minor bug fixes. + * Ability to format a single value in JsonFormatter (advanced usage only). + * Modifications to attributes applied to generated code. + + Javascript (alpha) + * Maps now have a real map API instead of being treated as repeated fields. + * Well-known types are now provided in the google-protobuf package, and the + code generator knows to require() them from that package. + * Bugfix: non-canonical varints are correctly decoded. + + Ruby (alpha) + * Accessors for oneof fields now return default values instead of nil. + + Java Lite + * Java lite support is removed from protocol compiler. It will be supported + as a protocol compiler plugin in a separate code branch. + 2016-05-16 version 3.0.0-beta-3 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript) General * Supported Proto3 lite-runtime in C++/Java for mobile platforms. @@ -1077,7 +1489,7 @@ 2008-09-29 version 2.0.2: General - * License changed from Apache 2.0 to New BSD. + * License changed from Apache 2.0 to 3-Clause BSD. * It is now possible to define custom "options", which are basically annotations which may be placed on definitions in a .proto file. For example, you might define a field option called "foo" like so: diff --git a/packager/third_party/protobuf/COPYING.txt b/packager/third_party/protobuf/COPYING.txt deleted file mode 100644 index 705db579c9..0000000000 --- a/packager/third_party/protobuf/COPYING.txt +++ /dev/null @@ -1,33 +0,0 @@ -Copyright 2008, Google Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. diff --git a/packager/third_party/protobuf/DEPS b/packager/third_party/protobuf/DEPS index 6e156dcd36..f6ed684939 100644 --- a/packager/third_party/protobuf/DEPS +++ b/packager/third_party/protobuf/DEPS @@ -1,3 +1,6 @@ skip_child_includes = [ + 'benchmarks', + 'conformance', 'objectivec', + 'src', ] diff --git a/packager/third_party/protobuf/INSTALL.txt b/packager/third_party/protobuf/INSTALL.txt deleted file mode 100644 index ce3b094905..0000000000 --- a/packager/third_party/protobuf/INSTALL.txt +++ /dev/null @@ -1,237 +0,0 @@ -This file contains detailed but generic information on building and -installing the C++ part of this project. For shorter instructions, -as well as instructions for compiling and installing the Java or -Python parts, see README. - -====================================================================== - -Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software -Foundation, Inc. - - This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - - -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is -disabled by default to prevent problems with accidental use of stale -cache files.) - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/packager/third_party/protobuf/Makefile.am b/packager/third_party/protobuf/Makefile.am index 3e9888166f..7ffb202e5c 100644 --- a/packager/third_party/protobuf/Makefile.am +++ b/packager/third_party/protobuf/Makefile.am @@ -51,30 +51,29 @@ pkgconfig_DATA = protobuf.pc protobuf-lite.pc csharp_EXTRA_DIST= \ csharp/.gitignore \ csharp/CHANGES.txt \ + csharp/Google.Protobuf.Tools.nuspec \ csharp/README.md \ csharp/build_packages.bat \ + csharp/build_tools.sh \ csharp/buildall.sh \ csharp/generate_protos.sh \ + csharp/global.json \ csharp/keys/Google.Protobuf.public.snk \ + csharp/keys/Google.Protobuf.snk \ csharp/keys/README.md \ + csharp/protos/unittest_custom_options_proto3.proto \ csharp/protos/unittest_issues.proto \ csharp/src/AddressBook/AddPerson.cs \ - csharp/src/AddressBook/AddressBook.csproj \ csharp/src/AddressBook/Addressbook.cs \ + csharp/src/AddressBook/AddressBook.csproj \ csharp/src/AddressBook/ListPeople.cs \ csharp/src/AddressBook/Program.cs \ - csharp/src/AddressBook/Properties/AssemblyInfo.cs \ csharp/src/AddressBook/SampleUsage.cs \ - csharp/src/AddressBook/app.config \ - csharp/src/Google.Protobuf.Conformance/App.config \ csharp/src/Google.Protobuf.Conformance/Conformance.cs \ csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj \ csharp/src/Google.Protobuf.Conformance/Program.cs \ - csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs \ csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj \ csharp/src/Google.Protobuf.JsonDump/Program.cs \ - csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs \ - csharp/src/Google.Protobuf.JsonDump/app.config \ csharp/src/Google.Protobuf.Test/ByteStringTest.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs \ csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs \ @@ -82,6 +81,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs \ csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs \ csharp/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs \ + csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs \ csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs \ csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs \ csharp/src/Google.Protobuf.Test/EqualityTester.cs \ @@ -92,15 +92,18 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs \ csharp/src/Google.Protobuf.Test/JsonParserTest.cs \ csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs \ - csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml \ - csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs \ + csharp/src/Google.Protobuf.Test/Program.cs \ + csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs \ csharp/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs \ csharp/src/Google.Protobuf.Test/SampleEnum.cs \ csharp/src/Google.Protobuf.Test/SampleMessages.cs \ csharp/src/Google.Protobuf.Test/TestCornerCases.cs \ + csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs \ csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs \ + csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs \ + csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs \ csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs \ csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs \ csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs \ @@ -108,9 +111,9 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs \ + csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs \ csharp/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs \ - csharp/src/Google.Protobuf.Test/packages.config \ csharp/src/Google.Protobuf.sln \ csharp/src/Google.Protobuf/ByteArray.cs \ csharp/src/Google.Protobuf/ByteString.cs \ @@ -121,11 +124,12 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs \ csharp/src/Google.Protobuf/Collections/RepeatedField.cs \ csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs \ + csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs \ csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs \ csharp/src/Google.Protobuf/FieldCodec.cs \ csharp/src/Google.Protobuf/FrameworkPortability.cs \ csharp/src/Google.Protobuf/Google.Protobuf.csproj \ - csharp/src/Google.Protobuf/Google.Protobuf.nuspec \ + csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs \ csharp/src/Google.Protobuf/IDeepCloneable.cs \ csharp/src/Google.Protobuf/IMessage.cs \ csharp/src/Google.Protobuf/InvalidJsonException.cs \ @@ -139,6 +143,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/MessageParser.cs \ csharp/src/Google.Protobuf/ProtoPreconditions.cs \ csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs \ + csharp/src/Google.Protobuf/Reflection/CustomOptions.cs \ csharp/src/Google.Protobuf/Reflection/Descriptor.cs \ csharp/src/Google.Protobuf/Reflection/DescriptorBase.cs \ csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs \ @@ -173,6 +178,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/WellKnownTypes/DurationPartial.cs \ csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs \ csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs \ + csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs \ csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs \ csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs \ csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs \ @@ -182,9 +188,7 @@ csharp_EXTRA_DIST= \ csharp/src/Google.Protobuf/WellKnownTypes/ValuePartial.cs \ csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.cs \ csharp/src/Google.Protobuf/WellKnownTypes/WrappersPartial.cs \ - csharp/src/Google.Protobuf/WireFormat.cs \ - csharp/src/Google.Protobuf/packages.config \ - csharp/src/packages/repositories.config + csharp/src/Google.Protobuf/WireFormat.cs java_EXTRA_DIST= \ java/README.md \ @@ -206,14 +210,17 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/Descriptors.java \ java/core/src/main/java/com/google/protobuf/DoubleArrayList.java \ java/core/src/main/java/com/google/protobuf/DynamicMessage.java \ + java/core/src/main/java/com/google/protobuf/ExperimentalApi.java \ java/core/src/main/java/com/google/protobuf/Extension.java \ java/core/src/main/java/com/google/protobuf/ExtensionLite.java \ java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java \ + java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java \ java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java \ java/core/src/main/java/com/google/protobuf/FieldSet.java \ java/core/src/main/java/com/google/protobuf/FloatArrayList.java \ java/core/src/main/java/com/google/protobuf/GeneratedMessage.java \ java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java \ + java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java \ java/core/src/main/java/com/google/protobuf/IntArrayList.java \ java/core/src/main/java/com/google/protobuf/Internal.java \ java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \ @@ -235,10 +242,12 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/MutabilityOracle.java \ java/core/src/main/java/com/google/protobuf/NioByteString.java \ java/core/src/main/java/com/google/protobuf/Parser.java \ + java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java \ java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java \ java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java \ java/core/src/main/java/com/google/protobuf/ProtocolStringList.java \ java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java \ + java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java \ java/core/src/main/java/com/google/protobuf/RopeByteString.java \ java/core/src/main/java/com/google/protobuf/RpcCallback.java \ java/core/src/main/java/com/google/protobuf/RpcChannel.java \ @@ -247,6 +256,7 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/Service.java \ java/core/src/main/java/com/google/protobuf/ServiceException.java \ java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java \ + java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java \ java/core/src/main/java/com/google/protobuf/SmallSortedMap.java \ java/core/src/main/java/com/google/protobuf/TextFormat.java \ java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java \ @@ -257,6 +267,7 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java \ java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java \ java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java \ + java/core/src/main/java/com/google/protobuf/UnsafeUtil.java \ java/core/src/main/java/com/google/protobuf/Utf8.java \ java/core/src/main/java/com/google/protobuf/WireFormat.java \ java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java \ @@ -273,6 +284,7 @@ java_EXTRA_DIST= java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java \ java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java \ java/core/src/test/java/com/google/protobuf/EnumTest.java \ + java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java \ java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java \ java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java \ java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java \ @@ -295,16 +307,18 @@ java_EXTRA_DIST= java/core/src/test/java/com/google/protobuf/MessageTest.java \ java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java \ java/core/src/test/java/com/google/protobuf/NioByteStringTest.java \ + java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java \ java/core/src/test/java/com/google/protobuf/ParserTest.java \ java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java \ - java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java \ + java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java \ java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java \ java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java \ java/core/src/test/java/com/google/protobuf/ServiceTest.java \ - java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java \ + java/core/src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java \ java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java \ java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java \ java/core/src/test/java/com/google/protobuf/TestUtil.java \ + java/core/src/test/java/com/google/protobuf/TestUtilLite.java \ java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java \ java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java \ java/core/src/test/java/com/google/protobuf/TextFormatTest.java \ @@ -336,13 +350,17 @@ java_EXTRA_DIST= java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto \ java/core/src/test/proto/com/google/protobuf/test_custom_options.proto \ java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto \ + java/lite/generate-sources-build.xml \ + java/lite/generate-test-sources-build.xml \ java/lite/pom.xml \ java/pom.xml \ java/util/pom.xml \ + java/util/src/main/java/com/google/protobuf/util/Durations.java \ java/util/src/main/java/com/google/protobuf/util/FieldMaskTree.java \ java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java \ java/util/src/main/java/com/google/protobuf/util/JsonFormat.java \ java/util/src/main/java/com/google/protobuf/util/TimeUtil.java \ + java/util/src/main/java/com/google/protobuf/util/Timestamps.java \ java/util/src/test/java/com/google/protobuf/util/FieldMaskTreeTest.java \ java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java \ java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java \ @@ -461,8 +479,6 @@ objectivec_EXTRA_DIST= \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ objectivec/ProtocolBuffers_iOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \ - objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/FFE465CA-0E74-40E8-9F09-500B66B7DCB2.plist \ - objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcbaselines/8BBEA4A5147C727100C4ADB7.xcbaseline/Info.plist \ objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj \ @@ -471,6 +487,33 @@ objectivec_EXTRA_DIST= \ objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \ objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \ objectivec/README.md \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/OSXCocoaPodsTester.xcscheme \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.h \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/AppDelegate.m \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Base.lproj/MainMenu.xib \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/Info.plist \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester/main.m \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework \ + objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static \ + objectivec/Tests/CocoaPods/README.md \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.pbxproj \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester.xcodeproj/xcshareddata/xcschemes/iOSCocoaPodsTester.xcscheme \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.h \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/AppDelegate.m \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Assets.xcassets/AppIcon.appiconset/Contents.json \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/LaunchScreen.storyboard \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Base.lproj/Main.storyboard \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/Info.plist \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.h \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/ViewController.m \ + objectivec/Tests/CocoaPods/iOSCocoaPodsTester/iOSCocoaPodsTester/main.m \ + objectivec/Tests/CocoaPods/run_tests.sh \ objectivec/Tests/golden_message \ objectivec/Tests/golden_packed_fields_message \ objectivec/Tests/GPBARCUnittestProtos.m \ @@ -485,7 +528,9 @@ objectivec_EXTRA_DIST= \ objectivec/Tests/GPBDictionaryTests+String.m \ objectivec/Tests/GPBDictionaryTests+UInt32.m \ objectivec/Tests/GPBDictionaryTests+UInt64.m \ + objectivec/Tests/GPBDictionaryTests.m \ objectivec/Tests/GPBDictionaryTests.pddm \ + objectivec/Tests/GPBExtensionRegistryTest.m \ objectivec/Tests/GPBMessageTests+Merge.m \ objectivec/Tests/GPBMessageTests+Runtime.m \ objectivec/Tests/GPBMessageTests+Serialization.m \ @@ -496,6 +541,7 @@ objectivec_EXTRA_DIST= \ objectivec/Tests/GPBTestUtilities.h \ objectivec/Tests/GPBTestUtilities.m \ objectivec/Tests/GPBUnittestProtos.m \ + objectivec/Tests/GPBUnittestProtos2.m \ objectivec/Tests/GPBUnknownFieldSetTest.m \ objectivec/Tests/GPBUtilitiesTests.m \ objectivec/Tests/GPBWellKnownTypesTest.m \ @@ -517,6 +563,15 @@ objectivec_EXTRA_DIST= \ objectivec/Tests/text_format_map_unittest_data.txt \ objectivec/Tests/text_format_unittest_data.txt \ objectivec/Tests/unittest_cycle.proto \ + objectivec/Tests/unittest_deprecated.proto \ + objectivec/Tests/unittest_deprecated_file.proto \ + objectivec/Tests/unittest_extension_chain_a.proto \ + objectivec/Tests/unittest_extension_chain_b.proto \ + objectivec/Tests/unittest_extension_chain_c.proto \ + objectivec/Tests/unittest_extension_chain_d.proto \ + objectivec/Tests/unittest_extension_chain_e.proto \ + objectivec/Tests/unittest_extension_chain_f.proto \ + objectivec/Tests/unittest_extension_chain_g.proto \ objectivec/Tests/unittest_objc.proto \ objectivec/Tests/unittest_objc_startup.proto \ objectivec/Tests/unittest_runtime_proto2.proto \ @@ -525,6 +580,112 @@ objectivec_EXTRA_DIST= \ objectivec/Tests/UnitTests-Info.plist \ Protobuf.podspec +php_EXTRA_DIST= \ + php/ext/google/protobuf/utf8.h \ + php/ext/google/protobuf/message.c \ + php/ext/google/protobuf/utf8.c \ + php/ext/google/protobuf/package.xml \ + php/ext/google/protobuf/upb.h \ + php/ext/google/protobuf/array.c \ + php/ext/google/protobuf/encode_decode.c \ + php/ext/google/protobuf/protobuf.h \ + php/ext/google/protobuf/type_check.c \ + php/ext/google/protobuf/def.c \ + php/ext/google/protobuf/storage.c \ + php/ext/google/protobuf/map.c \ + php/ext/google/protobuf/config.m4 \ + php/ext/google/protobuf/upb.c \ + php/ext/google/protobuf/protobuf.c \ + php/src/phpdoc.dist.xml \ + php/src/Google/Protobuf/Internal/CodedInputStream.php \ + php/src/Google/Protobuf/Internal/CodedOutputStream.php \ + php/src/Google/Protobuf/Internal/DescriptorPool.php \ + php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php \ + php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php \ + php/src/Google/Protobuf/Internal/DescriptorProto.php \ + php/src/Google/Protobuf/Internal/Descriptor.php \ + php/src/Google/Protobuf/Internal/EnumBuilderContext.php \ + php/src/Google/Protobuf/Internal/EnumDescriptor.php \ + php/src/Google/Protobuf/Internal/EnumDescriptorProto.php \ + php/src/Google/Protobuf/Internal/EnumOptions.php \ + php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php \ + php/src/Google/Protobuf/Internal/EnumValueDescriptor.php \ + php/src/Google/Protobuf/Internal/EnumValueOptions.php \ + php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php \ + php/src/Google/Protobuf/Internal/FieldDescriptorProto.php \ + php/src/Google/Protobuf/Internal/FieldDescriptor.php \ + php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php \ + php/src/Google/Protobuf/Internal/FieldOptions_CType.php \ + php/src/Google/Protobuf/Internal/FieldOptions_JSType.php \ + php/src/Google/Protobuf/Internal/FieldOptions.php \ + php/src/Google/Protobuf/Internal/FileDescriptorProto.php \ + php/src/Google/Protobuf/Internal/FileDescriptorSet.php \ + php/src/Google/Protobuf/Internal/FileDescriptor.php \ + php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php \ + php/src/Google/Protobuf/Internal/FileOptions.php \ + php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php \ + php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php \ + php/src/Google/Protobuf/Internal/GPBDecodeException.php \ + php/src/Google/Protobuf/Internal/GPBJsonWire.php \ + php/src/Google/Protobuf/Internal/GPBLabel.php \ + php/src/Google/Protobuf/Internal/GPBType.php \ + php/src/Google/Protobuf/Internal/GPBUtil.php \ + php/src/Google/Protobuf/Internal/GPBWireType.php \ + php/src/Google/Protobuf/Internal/GPBWire.php \ + php/src/Google/Protobuf/Internal/MapEntry.php \ + php/src/Google/Protobuf/Internal/MapFieldIter.php \ + php/src/Google/Protobuf/Internal/MapField.php \ + php/src/Google/Protobuf/Internal/MessageBuilderContext.php \ + php/src/Google/Protobuf/Internal/MessageOptions.php \ + php/src/Google/Protobuf/Internal/Message.php \ + php/src/Google/Protobuf/Internal/MethodDescriptorProto.php \ + php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php \ + php/src/Google/Protobuf/Internal/MethodOptions.php \ + php/src/Google/Protobuf/Internal/OneofDescriptorProto.php \ + php/src/Google/Protobuf/Internal/OneofDescriptor.php \ + php/src/Google/Protobuf/Internal/OneofField.php \ + php/src/Google/Protobuf/Internal/OneofOptions.php \ + php/src/Google/Protobuf/Internal/RawInputStream.php \ + php/src/Google/Protobuf/Internal/RepeatedFieldIter.php \ + php/src/Google/Protobuf/Internal/RepeatedField.php \ + php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php \ + php/src/Google/Protobuf/Internal/ServiceOptions.php \ + php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php \ + php/src/Google/Protobuf/Internal/SourceCodeInfo.php \ + php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php \ + php/src/Google/Protobuf/Internal/UninterpretedOption.php \ + php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php \ + php/tests/array_test.php \ + php/tests/autoload.php \ + php/tests/compatibility_test.sh \ + php/tests/encode_decode_test.php \ + php/tests/gdb_test.sh \ + php/tests/generated_class_test.php \ + php/tests/generated_phpdoc_test.php \ + php/tests/generated_service_test.php \ + php/tests/map_field_test.php \ + php/tests/memory_leak_test.php \ + php/tests/php_implementation_test.php \ + php/tests/proto/test_empty_php_namespace.proto \ + php/tests/proto/test_import_descriptor_proto.proto \ + php/tests/proto/test_include.proto \ + php/tests/proto/test.proto \ + php/tests/proto/test_no_namespace.proto \ + php/tests/proto/test_php_namespace.proto \ + php/tests/proto/test_prefix.proto \ + php/tests/proto/test_service.proto \ + php/tests/proto/test_service_namespace.proto \ + php/tests/test.sh \ + php/tests/test_base.php \ + php/tests/test_util.php \ + php/tests/well_known_test.php \ + php/tests/undefined_test.php \ + php/README.md \ + php/composer.json \ + php/generate_descriptor_protos.sh \ + php/phpunit.xml \ + composer.json + python_EXTRA_DIST= \ python/MANIFEST.in \ python/google/__init__.py \ @@ -549,6 +710,7 @@ python_EXTRA_DIST= \ python/google/protobuf/internal/enum_type_wrapper.py \ python/google/protobuf/internal/factory_test1.proto \ python/google/protobuf/internal/factory_test2.proto \ + python/google/protobuf/internal/file_options_test.proto \ python/google/protobuf/internal/generator_test.py \ python/google/protobuf/internal/import_test_package/__init__.py \ python/google/protobuf/internal/import_test_package/inner.proto \ @@ -565,11 +727,13 @@ python_EXTRA_DIST= \ python/google/protobuf/internal/packed_field_test.proto \ python/google/protobuf/internal/proto_builder_test.py \ python/google/protobuf/internal/python_message.py \ + python/google/protobuf/internal/python_protobuf.cc \ python/google/protobuf/internal/reflection_test.py \ python/google/protobuf/internal/service_reflection_test.py \ python/google/protobuf/internal/symbol_database_test.py \ python/google/protobuf/internal/test_bad_identifiers.proto \ python/google/protobuf/internal/test_util.py \ + python/google/protobuf/internal/testing_refleaks.py \ python/google/protobuf/internal/text_encoding_test.py \ python/google/protobuf/internal/text_format_test.py \ python/google/protobuf/internal/type_checkers.py \ @@ -601,14 +765,18 @@ python_EXTRA_DIST= \ python/google/protobuf/pyext/map_container.h \ python/google/protobuf/pyext/message.cc \ python/google/protobuf/pyext/message.h \ + python/google/protobuf/pyext/message_factory.cc \ + python/google/protobuf/pyext/message_factory.h \ + python/google/protobuf/pyext/message_module.cc \ python/google/protobuf/pyext/proto2_api_test.proto \ python/google/protobuf/pyext/python.proto \ - python/google/protobuf/pyext/python_protobuf.h \ python/google/protobuf/pyext/repeated_composite_container.cc \ python/google/protobuf/pyext/repeated_composite_container.h \ python/google/protobuf/pyext/repeated_scalar_container.cc \ python/google/protobuf/pyext/repeated_scalar_container.h \ + python/google/protobuf/pyext/safe_numerics.h \ python/google/protobuf/pyext/scoped_pyobject_ptr.h \ + python/google/protobuf/python_protobuf.h \ python/google/protobuf/reflection.py \ python/google/protobuf/service.py \ python/google/protobuf/service_reflection.py \ @@ -616,6 +784,7 @@ python_EXTRA_DIST= \ python/google/protobuf/text_encoding.py \ python/google/protobuf/text_format.py \ python/mox.py \ + python/setup.cfg \ python/setup.py \ python/stubout.py \ python/tox.ini \ @@ -623,10 +792,18 @@ python_EXTRA_DIST= \ ruby_EXTRA_DIST= \ ruby/Gemfile \ - ruby/Gemfile.lock \ ruby/.gitignore \ ruby/README.md \ ruby/Rakefile \ + ruby/compatibility_tests/v3.0.0/tests/test_import.proto \ + ruby/compatibility_tests/v3.0.0/tests/stress.rb \ + ruby/compatibility_tests/v3.0.0/tests/repeated_field_test.rb \ + ruby/compatibility_tests/v3.0.0/tests/generated_code_test.rb \ + ruby/compatibility_tests/v3.0.0/tests/generated_code.proto \ + ruby/compatibility_tests/v3.0.0/tests/basic.rb \ + ruby/compatibility_tests/v3.0.0/test.sh \ + ruby/compatibility_tests/v3.0.0/Rakefile \ + ruby/compatibility_tests/v3.0.0/README.md \ ruby/ext/google/protobuf_c/defs.c \ ruby/ext/google/protobuf_c/encode_decode.c \ ruby/ext/google/protobuf_c/extconf.rb \ @@ -638,9 +815,11 @@ ruby_EXTRA_DIST= \ ruby/ext/google/protobuf_c/storage.c \ ruby/ext/google/protobuf_c/upb.c \ ruby/ext/google/protobuf_c/upb.h \ + ruby/ext/google/protobuf_c/wrap_memcpy.c \ ruby/google-protobuf.gemspec \ ruby/lib/google/protobuf/message_exts.rb \ ruby/lib/google/protobuf/repeated_field.rb \ + ruby/lib/google/protobuf/well_known_types.rb \ ruby/lib/google/protobuf.rb \ ruby/pom.xml \ ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java \ @@ -665,44 +844,88 @@ ruby_EXTRA_DIST= \ ruby/tests/repeated_field_test.rb \ ruby/tests/stress.rb \ ruby/tests/generated_code.proto \ + ruby/tests/test_import.proto \ ruby/tests/generated_code_test.rb \ + ruby/tests/well_known_types_test.rb \ ruby/travis-test.sh -js_EXTRA_DIST= \ - js/README.md \ - js/binary/arith.js \ - js/binary/arith_test.js \ - js/binary/constants.js \ - js/binary/decoder.js \ - js/binary/decoder_test.js \ - js/binary/proto_test.js \ - js/binary/reader.js \ - js/binary/reader_test.js \ - js/binary/utils.js \ - js/binary/utils_test.js \ - js/binary/writer.js \ - js/binary/writer_test.js \ - js/data.proto \ - js/debug.js \ - js/debug_test.js \ - js/gulpfile.js \ - js/jasmine.json \ - js/message.js \ - js/message_test.js \ - js/node_loader.js \ - js/package.json \ - js/proto3_test.js \ - js/proto3_test.proto \ - js/test.proto \ - js/test2.proto \ - js/test3.proto \ - js/test4.proto \ - js/test5.proto \ - js/test_bootstrap.js \ - js/testbinary.proto \ +js_EXTRA_DIST= \ + js/README.md \ + js/binary/arith.js \ + js/binary/arith_test.js \ + js/binary/constants.js \ + js/binary/decoder.js \ + js/binary/decoder_test.js \ + js/binary/encoder.js \ + js/binary/message_test.js \ + js/binary/proto_test.js \ + js/binary/reader.js \ + js/binary/reader_test.js \ + js/binary/utils.js \ + js/binary/utils_test.js \ + js/binary/writer.js \ + js/binary/writer_test.js \ + js/commonjs/export.js \ + js/commonjs/export_asserts.js \ + js/commonjs/export_testdeps.js \ + js/commonjs/import_test.js \ + js/commonjs/jasmine.json \ + js/commonjs/rewrite_tests_for_commonjs.js \ + js/commonjs/test6/test6.proto \ + js/commonjs/test7/test7.proto \ + js/compatibility_tests/v3.0.0/binary/arith_test.js \ + js/compatibility_tests/v3.0.0/binary/decoder_test.js \ + js/compatibility_tests/v3.0.0/binary/proto_test.js \ + js/compatibility_tests/v3.0.0/binary/reader_test.js \ + js/compatibility_tests/v3.0.0/binary/utils_test.js \ + js/compatibility_tests/v3.0.0/binary/writer_test.js \ + js/compatibility_tests/v3.0.0/commonjs/export_asserts.js \ + js/compatibility_tests/v3.0.0/commonjs/export_testdeps.js \ + js/compatibility_tests/v3.0.0/commonjs/import_test.js \ + js/compatibility_tests/v3.0.0/commonjs/jasmine.json \ + js/compatibility_tests/v3.0.0/commonjs/rewrite_tests_for_commonjs.js \ + js/compatibility_tests/v3.0.0/commonjs/test6/test6.proto \ + js/compatibility_tests/v3.0.0/commonjs/test7/test7.proto \ + js/compatibility_tests/v3.0.0/data.proto \ + js/compatibility_tests/v3.0.0/debug_test.js \ + js/compatibility_tests/v3.0.0/jasmine1.json \ + js/compatibility_tests/v3.0.0/jasmine2.json \ + js/compatibility_tests/v3.0.0/jasmine3.json \ + js/compatibility_tests/v3.0.0/message_test.js \ + js/compatibility_tests/v3.0.0/proto3_test.js \ + js/compatibility_tests/v3.0.0/proto3_test.proto \ + js/compatibility_tests/v3.0.0/test2.proto \ + js/compatibility_tests/v3.0.0/test3.proto \ + js/compatibility_tests/v3.0.0/test4.proto \ + js/compatibility_tests/v3.0.0/test5.proto \ + js/compatibility_tests/v3.0.0/testbinary.proto \ + js/compatibility_tests/v3.0.0/testempty.proto \ + js/compatibility_tests/v3.0.0/test.proto \ + js/compatibility_tests/v3.0.0/test.sh \ + js/data.proto \ + js/debug.js \ + js/debug_test.js \ + js/gulpfile.js \ + js/jasmine.json \ + js/map.js \ + js/maps_test.js \ + js/message.js \ + js/message_test.js \ + js/node_loader.js \ + js/package.json \ + js/proto3_test.js \ + js/proto3_test.proto \ + js/test.proto \ + js/test2.proto \ + js/test3.proto \ + js/test4.proto \ + js/test5.proto \ + js/test8.proto \ + js/test_bootstrap.js \ + js/testbinary.proto \ js/testempty.proto -all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(javanano_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST) +all_EXTRA_DIST=$(csharp_EXTRA_DIST) $(java_EXTRA_DIST) $(javanano_EXTRA_DIST) $(objectivec_EXTRA_DIST) $(php_EXTRA_DIST) $(python_EXTRA_DIST) $(ruby_EXTRA_DIST) $(js_EXTRA_DIST) EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ autogen.sh \ @@ -717,6 +940,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ WORKSPACE \ cmake/CMakeLists.txt \ cmake/README.md \ + cmake/examples.cmake \ cmake/extract_includes.bat.in \ cmake/install.cmake \ cmake/libprotobuf.cmake \ @@ -725,11 +949,13 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ cmake/protobuf-config-version.cmake.in \ cmake/protobuf-config.cmake.in \ cmake/protobuf-module.cmake.in \ + cmake/protobuf-options.cmake \ cmake/protoc.cmake \ cmake/tests.cmake \ editors/README.txt \ editors/proto.vim \ editors/protobuf-mode.el \ + examples/CMakeLists.txt \ examples/README.txt \ examples/Makefile \ examples/addressbook.proto \ @@ -739,14 +965,20 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST) \ examples/list_people.cc \ examples/list_people.go \ examples/AddPerson.java \ + examples/CMakeLists.txt \ examples/ListPeople.java \ examples/add_person.py \ examples/list_people.py \ examples/list_people_test.go \ protobuf.bzl \ + python/release/wheel/build_wheel_manylinux.sh \ + python/release/wheel/Dockerfile \ + python/release/wheel/protobuf_optimized_pip.sh \ + python/release/wheel/README.md \ six.BUILD \ util/python/BUILD + # Deletes all the files generated by autogen.sh. MAINTAINERCLEANFILES = \ aclocal.m4 \ diff --git a/packager/third_party/protobuf/OWNERS b/packager/third_party/protobuf/OWNERS index e7125d323a..f52d95fff5 100644 --- a/packager/third_party/protobuf/OWNERS +++ b/packager/third_party/protobuf/OWNERS @@ -1,2 +1,4 @@ pkasting@chromium.org xyzzyz@chromium.org + +# COMPONENT: Internals diff --git a/packager/third_party/protobuf/Protobuf.podspec b/packager/third_party/protobuf/Protobuf.podspec index 0bbd06df01..249911c51e 100644 --- a/packager/third_party/protobuf/Protobuf.podspec +++ b/packager/third_party/protobuf/Protobuf.podspec @@ -5,11 +5,12 @@ # dependent projects use the :git notation to refer to the library. Pod::Spec.new do |s| s.name = 'Protobuf' - s.version = '3.0.0-beta-2' + s.version = '3.3.2' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.homepage = 'https://github.com/google/protobuf' - s.license = 'New BSD' + s.license = '3-Clause BSD License' s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' } + s.cocoapods_version = '>= 1.0' s.source = { :git => 'https://github.com/google/protobuf.git', :tag => "v#{s.version}" } @@ -17,24 +18,25 @@ Pod::Spec.new do |s| s.source_files = 'objectivec/*.{h,m}', 'objectivec/google/protobuf/Any.pbobjc.{h,m}', 'objectivec/google/protobuf/Api.pbobjc.{h,m}', - 'objectivec/google/protobuf/Duration.pbobjc.h', + 'objectivec/google/protobuf/Duration.pbobjc.{h,m}', 'objectivec/google/protobuf/Empty.pbobjc.{h,m}', 'objectivec/google/protobuf/FieldMask.pbobjc.{h,m}', 'objectivec/google/protobuf/SourceContext.pbobjc.{h,m}', 'objectivec/google/protobuf/Struct.pbobjc.{h,m}', - 'objectivec/google/protobuf/Timestamp.pbobjc.h', + 'objectivec/google/protobuf/Timestamp.pbobjc.{h,m}', 'objectivec/google/protobuf/Type.pbobjc.{h,m}', 'objectivec/google/protobuf/Wrappers.pbobjc.{h,m}' - # Timestamp.pbobjc.m and Duration.pbobjc.m are #imported by GPBWellKnownTypes.m. So we can't - # compile them (duplicate symbols), but we need them available for the importing: - s.preserve_paths = 'objectivec/google/protobuf/Duration.pbobjc.m', - 'objectivec/google/protobuf/Timestamp.pbobjc.m' # The following would cause duplicate symbol definitions. GPBProtocolBuffers is expected to be # left out, as it's an umbrella implementation file. s.exclude_files = 'objectivec/GPBProtocolBuffers.m' - s.header_mappings_dir = 'objectivec' - s.ios.deployment_target = '7.1' + # Set a CPP symbol so the code knows to use framework imports. + s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' } + s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1' } + + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' + s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' s.requires_arc = false end diff --git a/packager/third_party/protobuf/README.chromium b/packager/third_party/protobuf/README.chromium index 53aac51ecc..3a4f72f87c 100644 --- a/packager/third_party/protobuf/README.chromium +++ b/packager/third_party/protobuf/README.chromium @@ -3,14 +3,13 @@ Short Name: protobuf URL: https://github.com/google/protobuf License: BSD License File: LICENSE -Version: 3.0.0-beta-3 -Revision: 3470b6895aa659b7559ed678e029a5338e535f14 +Version: 3.3.0 +Revision: 040f56e61b379e92dfdf107b12244a7580f60823 Security Critical: yes Steps used to create the current version: 1. Pull the release from https://github.com/google/protobuf/releases -2. Add build files (BUILD.gn, proto_library.gni, protobuf.gyp, - protobuf_lite.gypi, protobuf_nacl.gyp). +2. Add build files (BUILD.gn, proto_library.gni). Be sure to update the list of source files, as additional .cc files and headers might have been added -- you need to find the transitive closure of @@ -18,40 +17,49 @@ Steps used to create the current version: Other things to care about are defines required by protobuf on various platforms, warnings generated by compilers, and new dependencies introduced. -3. Get open-source library six.py from https://pypi.python.org/pypi/six/ and add +3. Add DEPS and OWNERS. +4. Add mirclient.cc and mirclient.map. +5. Get open-source library six.py from https://pypi.python.org/pypi/six/ and add it to protobuf/third_party/six/six.py. -4. Apply patches in patches/ (see the description below): +6. Apply patches in patches/ (see the description below): $ for patch in patches/*; do patch -s -p1 < $patch; done For future releases, it will be worth looking into which patches still need - to be applied. -5. Generate descriptor_pb2.py using something like the following steps. Make - sure you've regenerated your buildfiles and will build protoc from the - newly-modified sources above. + to be applied. In case of conflict, update those patches accordingly and save + them back in place (i.e. in patches directory). +7. Generate well_known_types_embed.cc and descriptor_pb2.py using something like + the following steps. Make sure you've regenerated your buildfiles and will + build js_embed then protoc from the newly-modified sources above. + $ cd $SRC_DIR + $ gn gen out/Debug + $ ninja -C out/Debug js_embed + $ cd third_party/protobuf/src/google/protobuf/compiler/js + $ $SRC_DIR/out/Debug/js_embed \ + ./well_known_types/any.js ./well_known_types/struct.js \ + ./well_known_types/timestamp.js > well_known_types_embed.cc $ cd $SRC_DIR $ ninja -C out/Debug protoc $ cd third_party/protobuf/src - $ ../../../out/Debug/protoc --python_out=../python google/protobuf/descriptor.proto + $ $SRC_DIR/out/Debug/protoc --python_out=../python google/protobuf/descriptor.proto -6. Add an __init__.py to protobuf/ that adds third_party/six/ to Python path. -7. Update README.chromium. +8. Add an __init__.py to protobuf/ that adds third_party/six/ to Python path. +9. Update README.chromium. + +Note about libmirclient: + +On Ubuntu, Chromium has an indirect dependency on the system +libprotobuf-lite through libmirclient (through GTK). The symbols in +the system library conflict with Chromium's libprotobuf-lite used on +component builds. + +mirclient.* are added to stub out libmirclient.so.9 to prevent loading +the system libprotobuf-lite. Chromium's replacement libmirclient will +get loaded, but its symbols will never be used directly or indirectly. Description of the patches: -- 0001-ignore-option-retain-unknown-fields.patch - - Previous versions of protobuf in Chromium carried a local patch that retained - unknown fields in protobuf_lite mode. It was enabled by setting option - retain_unknown_fields = true in .proto file. Now that it is enabled by - default, this option is no longer recognized by protobuf, and so I had to - patch it so that I don't have to fix all .proto files in Chromium in a single - CL. - - I plan to remove those occurences, and then this patch will no longer be - necessary. - - 0003-remove-static-initializers.patch This patch removes all static initializers from Chromium. The change in Status @@ -67,13 +75,6 @@ Description of the patches: protobuf symbols in Linux .so libraries, so that protobuf can be built as a component (see http://crrev.com/179806). -- 0005-fix-include-js-generator.protobuf - - During merge with internal branch, the <> in one of the #includes were - accidentally replaced with "", which results in a failure in checkdeps. - - Fixed in https://github.com/google/protobuf/pull/1547. - - 0007-uninline_googleonce.patch - 0008-uninline_get_empty_string.patch - 0009-uninline-arenastring.patch @@ -82,9 +83,42 @@ Description of the patches: These patches uninline some functions, resulting in a significant reduction (somewhere between 500 KB and 1 MB) of binary size. -- 0011-libprotobuf_export.patch - - During merge with internal branch, the dll export attribute was accidentally - removed in C++11 mode. +- 0012-fixes-for-js-embed-cc.patch Fixed in https://github.com/google/protobuf/pull/1549 + +- 0013-fixes-expansion-to-defined.patch + + Fixes a macro whose expansion has a defined() in it. This is + results in undefined behavior and some compilers will warn/error + when seeing this. + +- 0014-truncate-uint8-constants.patch + + Fixed upstream in CL 161573822 + +- 0015-fixes-forcing-value-to-bool.patch + + Fixes an MSVC error that forbids conversion from int to bool. Needs + to be upstreamed. + +- 0014-truncate-uint8-constants.patch + + Fixed upstream in CL 163270735 + +- 0017-constexpr-for-vs-2017.patch + + Define PROTOBUF_CONSTEXPR_VAR as constexpr for VS 2017, also landed upstream + as https://github.com/google/protobuf/commit/210be267fd81d5aafdc049d197d57cb45b75f3ba + +- 0018-fallthrough.patch + + Cherry-picks upstream https://github.com/google/protobuf/commit/b8e47830d + +- 0019-rename-a-shadowed-variable.patch + + Cherry-picks upstream https://github.com/google/protobuf/commit/af3813cd7 + +- 0020-Add-support-for-libc-on-Windows.patch + + Cherry-picks upstream https://github.com/google/protobuf/commit/3ba21cd5f diff --git a/packager/third_party/protobuf/README.md b/packager/third_party/protobuf/README.md index ba9c589d2b..653f663276 100644 --- a/packager/third_party/protobuf/README.md +++ b/packager/third_party/protobuf/README.md @@ -1,7 +1,7 @@ Protocol Buffers - Google's data interchange format =================================================== -[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) +[![Build Status](https://travis-ci.org/google/protobuf.svg?branch=master)](https://travis-ci.org/google/protobuf) [![Build status](https://ci.appveyor.com/api/projects/status/73ctee6ua4w2ruin?svg=true)](https://ci.appveyor.com/project/protobuf/protobuf) [![Build Status](https://grpc-testing.appspot.com/buildStatus/icon?job=protobuf_branch)](https://grpc-testing.appspot.com/job/protobuf_branch) [![Build Status](https://grpc-testing.appspot.com/job/protobuf_branch_32/badge/icon)](https://grpc-testing.appspot.com/job/protobuf_branch_32) [![Build Status](http://ci.bazel.io/buildStatus/icon?job=protobuf)](http://ci.bazel.io/job/protobuf/) Copyright 2008 Google Inc. @@ -37,7 +37,7 @@ as well as a set of standard .proto files distributed along with protobuf. If you are looking for an old version that is not available in the release page, check out the maven repo here: - [http://repo1.maven.org/maven2/com/google/protobuf/protoc/](http://repo1.maven.org/maven2/com/google/protobuf/protoc/) + [https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/) These pre-built binaries are only provided for released versions. If you want to use the github master version at HEAD, or you need to modify protobuf code, @@ -54,18 +54,19 @@ Protobuf supports several different programming languages. For each programming language, you can find instructions in the corresponding source directory about how to install protobuf runtime for that specific language: -| Language | Source | -|--------------------------------------|-------------------------------------------------------| -| C++ (include C++ runtime and protoc) | [src](src) | -| Java | [java](java) | -| Python | [python](python) | -| Objective-C | [objectivec](objectivec) | -| C# | [csharp](csharp) | -| JavaNano | [javanano](javanano) | -| JavaScript | [js](js) | -| Ruby | [ruby](ruby) | -| Go | [golang/protobuf](https://github.com/golang/protobuf) | -| PHP | TBD | +| Language | Source | +|--------------------------------------|-------------------------------------------------------------| +| C++ (include C++ runtime and protoc) | [src](src) | +| Java | [java](java) | +| Python | [python](python) | +| Objective-C | [objectivec](objectivec) | +| C# | [csharp](csharp) | +| JavaNano | [javanano](javanano) | +| JavaScript | [js](js) | +| Ruby | [ruby](ruby) | +| Go | [golang/protobuf](https://github.com/golang/protobuf) | +| PHP | [php](php) | +| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) | Usage @@ -74,4 +75,4 @@ Usage The complete documentation for Protocol Buffers is available via the web at: - https://developers.google.com/protocol-buffers/ +https://developers.google.com/protocol-buffers/ diff --git a/packager/third_party/protobuf/README.txt b/packager/third_party/protobuf/README.txt deleted file mode 100644 index 17551a5a0c..0000000000 --- a/packager/third_party/protobuf/README.txt +++ /dev/null @@ -1,152 +0,0 @@ -Protocol Buffers - Google's data interchange format -Copyright 2008 Google Inc. -http://code.google.com/apis/protocolbuffers/ - -C++ Installation - Unix -======================= - -To build and install the C++ Protocol Buffer runtime and the Protocol -Buffer compiler (protoc) execute the following: - - $ ./configure - $ make - $ make check - $ make install - -If "make check" fails, you can still install, but it is likely that -some features of this library will not work correctly on your system. -Proceed at your own risk. - -"make install" may require superuser privileges. - -For advanced usage information on configure and make, see INSTALL.txt. - -** Hint on install location ** - - By default, the package will be installed to /usr/local. However, - on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH. - You can add it, but it may be easier to just install to /usr - instead. To do this, invoke configure as follows: - - ./configure --prefix=/usr - - If you already built the package with a different prefix, make sure - to run "make clean" before building again. - -** Compiling dependent packages ** - - To compile a package that uses Protocol Buffers, you need to pass - various flags to your compiler and linker. As of version 2.2.0, - Protocol Buffers integrates with pkg-config to manage this. If you - have pkg-config installed, then you can invoke it to get a list of - flags like so: - - pkg-config --cflags protobuf # print compiler flags - pkg-config --libs protobuf # print linker flags - pkg-config --cflags --libs protobuf # print both - - For example: - - c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf` - - Note that packages written prior to the 2.2.0 release of Protocol - Buffers may not yet integrate with pkg-config to get flags, and may - not pass the correct set of flags to correctly link against - libprotobuf. If the package in question uses autoconf, you can - often fix the problem by invoking its configure script like: - - configure CXXFLAGS="$(pkg-config --cflags protobuf)" \ - LIBS="$(pkg-config --libs protobuf)" - - This will force it to use the correct flags. - - If you are writing an autoconf-based package that uses Protocol - Buffers, you should probably use the PKG_CHECK_MODULES macro in your - configure script like: - - PKG_CHECK_MODULES([protobuf], [protobuf]) - - See the pkg-config man page for more info. - - If you only want protobuf-lite, substitute "protobuf-lite" in place - of "protobuf" in these examples. - -** Note for cross-compiling ** - - The makefiles normally invoke the protoc executable that they just - built in order to build tests. When cross-compiling, the protoc - executable may not be executable on the host machine. In this case, - you must build a copy of protoc for the host machine first, then use - the --with-protoc option to tell configure to use it instead. For - example: - - ./configure --with-protoc=protoc - - This will use the installed protoc (found in your $PATH) instead of - trying to execute the one built during the build process. You can - also use an executable that hasn't been installed. For example, if - you built the protobuf package for your host machine in ../host, - you might do: - - ./configure --with-protoc=../host/src/protoc - - Either way, you must make sure that the protoc executable you use - has the same version as the protobuf source code you are trying to - use it with. - -** Note for Solaris users ** - - Solaris 10 x86 has a bug that will make linking fail, complaining - about libstdc++.la being invalid. We have included a work-around - in this package. To use the work-around, run configure as follows: - - ./configure LDFLAGS=-L$PWD/src/solaris - - See src/solaris/libstdc++.la for more info on this bug. - -** Note for HP C++ Tru64 users ** - - To compile invoke configure as follows: - - ./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM" - - Also, you will need to use gmake instead of make. - -C++ Installation - Windows -========================== - -If you are using Microsoft Visual C++, see vsprojects/readme.txt. - -If you are using Cygwin or MinGW, follow the Unix installation -instructions, above. - -Binary Compatibility Warning -============================ - -Due to the nature of C++, it is unlikely that any two versions of the -Protocol Buffers C++ runtime libraries will have compatible ABIs. -That is, if you linked an executable against an older version of -libprotobuf, it is unlikely to work with a newer version without -re-compiling. This problem, when it occurs, will normally be detected -immediately on startup of your app. Still, you may want to consider -using static linkage. You can configure this package to install -static libraries only using: - - ./configure --disable-shared - -Java and Python Installation -============================ - -The Java and Python runtime libraries for Protocol Buffers are located -in the java and python directories. See the README file in each -directory for more information on how to compile and install them. -Note that both of them require you to first install the Protocol -Buffer compiler (protoc), which is part of the C++ package. - -Usage -===== - -The complete documentation for Protocol Buffers is available via the -web at: - - http://code.google.com/apis/protocolbuffers/ diff --git a/packager/third_party/protobuf/WORKSPACE b/packager/third_party/protobuf/WORKSPACE index 065dc81984..2a49e3723a 100644 --- a/packager/third_party/protobuf/WORKSPACE +++ b/packager/third_party/protobuf/WORKSPACE @@ -1,15 +1,15 @@ -new_http_archive( - name = "gmock_archive", - url = "https://googlemock.googlecode.com/files/gmock-1.7.0.zip", - sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b", +new_git_repository( + name = "googletest", build_file = "gmock.BUILD", + remote = "https://github.com/google/googletest", + tag = "release-1.8.0", ) new_http_archive( name = "six_archive", - url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", - sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", build_file = "six.BUILD", + sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a", + url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55", ) bind( @@ -19,12 +19,12 @@ bind( bind( name = "gtest", - actual = "@gmock_archive//:gtest", + actual = "@googletest//:gtest", ) bind( name = "gtest_main", - actual = "@gmock_archive//:gtest_main", + actual = "@googletest//:gtest_main", ) bind( @@ -33,8 +33,8 @@ bind( ) maven_jar( - name = "guava_maven", - artifact = "com.google.guava:guava:18.0", + name = "guava_maven", + artifact = "com.google.guava:guava:18.0", ) bind( @@ -43,8 +43,8 @@ bind( ) maven_jar( - name = "gson_maven", - artifact = "com.google.code.gson:gson:2.3", + name = "gson_maven", + artifact = "com.google.code.gson:gson:2.7", ) bind( diff --git a/packager/third_party/protobuf/appveyor.bat b/packager/third_party/protobuf/appveyor.bat index 9a46b92892..ca88b25c3e 100644 --- a/packager/third_party/protobuf/appveyor.bat +++ b/packager/third_party/protobuf/appveyor.bat @@ -10,7 +10,7 @@ goto :error echo Building C++ mkdir build_msvc cd build_msvc -cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% ../cmake +cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% ../cmake msbuild protobuf.sln /p:Platform=%vcplatform% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error cd %configuration% tests.exe || goto error @@ -19,9 +19,16 @@ goto :EOF :build_csharp echo Building C# cd csharp\src -nuget restore -msbuild Google.Protobuf.sln /p:Platform="Any CPU" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || goto error -nunit-console Google.Protobuf.Test\bin\%configuration%\Google.Protobuf.Test.dll || goto error +REM The platform environment variable is implicitly used by msbuild; +REM we don't want it. +set platform= +dotnet restore +dotnet build -c %configuration% || goto error + +echo Testing C# +dotnet run -c %configuration% -f netcoreapp1.0 -p Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error +dotnet run -c %configuration% -f net451 -p Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error + goto :EOF :error diff --git a/packager/third_party/protobuf/appveyor.yml b/packager/third_party/protobuf/appveyor.yml index c84ecae2f3..8b440b6396 100644 --- a/packager/third_party/protobuf/appveyor.yml +++ b/packager/third_party/protobuf/appveyor.yml @@ -11,13 +11,25 @@ environment: matrix: - language: cpp BUILD_DLL: ON + UNICODE: ON - language: csharp + image: Visual Studio 2017 + +# Our build scripts run tests automatically; we don't want AppVeyor +# to try to detect them itself. +test: off install: - - ps: Start-FileDownload https://googlemock.googlecode.com/files/gmock-1.7.0.zip - - 7z x gmock-1.7.0.zip - - rename gmock-1.7.0 gmock + - curl -L -o release-1.7.0.zip https://github.com/google/googlemock/archive/release-1.7.0.zip + - 7z x release-1.7.0.zip + - del /Q release-1.7.0.zip + - rename googlemock-release-1.7.0 gmock + - curl -L -o release-1.7.0.zip "https://github.com/google/googletest/archive/release-1.7.0.zip" + - 7z x release-1.7.0.zip + - del /Q release-1.7.0.zip + - rename googletest-release-1.7.0 gtest + - move gtest gmock before_build: - if %platform%==Win32 set generator=Visual Studio 12 diff --git a/packager/third_party/protobuf/autogen.sh b/packager/third_party/protobuf/autogen.sh index 5b4c29f8c0..9f26642585 100755 --- a/packager/third_party/protobuf/autogen.sh +++ b/packager/third_party/protobuf/autogen.sh @@ -31,10 +31,15 @@ fi # directory is set up as an SVN external. if test ! -e gmock; then echo "Google Mock not present. Fetching gmock-1.7.0 from the web..." - curl $curlopts -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip - unzip -q gmock-1.7.0.zip - rm gmock-1.7.0.zip - mv gmock-1.7.0 gmock + curl $curlopts -L -O https://github.com/google/googlemock/archive/release-1.7.0.zip + unzip -q release-1.7.0.zip + rm release-1.7.0.zip + mv googlemock-release-1.7.0 gmock + + curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip + unzip -q release-1.7.0.zip + rm release-1.7.0.zip + mv googletest-release-1.7.0 gmock/gtest fi set -ex diff --git a/packager/third_party/protobuf/benchmarks/Makefile.am b/packager/third_party/protobuf/benchmarks/Makefile.am index f730afe576..d98eae5ead 100644 --- a/packager/third_party/protobuf/benchmarks/Makefile.am +++ b/packager/third_party/protobuf/benchmarks/Makefile.am @@ -16,7 +16,9 @@ benchmarks_protoc_outputs_proto2 = \ benchmark_messages_proto2.pb.cc \ benchmark_messages_proto2.pb.h -bin_PROGRAMS = generate-datasets +AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare + +bin_PROGRAMS = generate-datasets cpp-benchmark generate_datasets_LDADD = $(top_srcdir)/src/libprotobuf.la generate_datasets_SOURCES = generate_datasets.cc @@ -30,6 +32,13 @@ nodist_generate_datasets_SOURCES = \ # See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually generate_datasets-generate_datasets.$(OBJEXT): benchmarks.pb.h +cpp_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a +cpp_benchmark_SOURCES = cpp_benchmark.cc +cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir) -I$(top_srcdir)/third_party/benchmark/include +nodist_cpp_benchmark_SOURCES = \ + $(benchmarks_protoc_outputs) \ + $(benchmarks_protoc_outputs_proto2) + $(benchmarks_protoc_outputs): protoc_middleman $(benchmarks_protoc_outputs_proto2): protoc_middleman2 diff --git a/packager/third_party/protobuf/benchmarks/benchmark_messages_proto2.proto b/packager/third_party/protobuf/benchmarks/benchmark_messages_proto2.proto index 01f67a1af3..590855033c 100644 --- a/packager/third_party/protobuf/benchmarks/benchmark_messages_proto2.proto +++ b/packager/third_party/protobuf/benchmarks/benchmark_messages_proto2.proto @@ -8,6 +8,8 @@ option java_package = "com.google.protobuf.benchmarks"; // This is the default, but we specify it here explicitly. option optimize_for = SPEED; +option cc_enable_arenas = true; + message GoogleMessage1 { required string field1 = 1; optional string field9 = 9; diff --git a/packager/third_party/protobuf/benchmarks/benchmark_messages_proto3.proto b/packager/third_party/protobuf/benchmarks/benchmark_messages_proto3.proto index 32f586986b..090b554be9 100644 --- a/packager/third_party/protobuf/benchmarks/benchmark_messages_proto3.proto +++ b/packager/third_party/protobuf/benchmarks/benchmark_messages_proto3.proto @@ -8,6 +8,8 @@ option java_package = "com.google.protobuf.benchmarks"; // This is the default, but we specify it here explicitly. option optimize_for = SPEED; +option cc_enable_arenas = true; + message GoogleMessage1 { string field1 = 1; string field9 = 9; diff --git a/packager/third_party/protobuf/benchmarks/cpp_benchmark.cc b/packager/third_party/protobuf/benchmarks/cpp_benchmark.cc new file mode 100644 index 0000000000..0e6febc2f1 --- /dev/null +++ b/packager/third_party/protobuf/benchmarks/cpp_benchmark.cc @@ -0,0 +1,242 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include "benchmark/benchmark_api.h" +#include "benchmarks.pb.h" +#include "benchmark_messages_proto2.pb.h" +#include "benchmark_messages_proto3.pb.h" + +#define PREFIX "dataset." +#define SUFFIX ".pb" + +using benchmarks::BenchmarkDataset; +using google::protobuf::Arena; +using google::protobuf::Descriptor; +using google::protobuf::DescriptorPool; +using google::protobuf::Message; +using google::protobuf::MessageFactory; + +class Fixture : public benchmark::Fixture { + public: + Fixture(const BenchmarkDataset& dataset, const std::string& suffix) { + for (int i = 0; i < dataset.payload_size(); i++) { + payloads_.push_back(dataset.payload(i)); + } + + const Descriptor* d = + DescriptorPool::generated_pool()->FindMessageTypeByName( + dataset.message_name()); + + if (!d) { + std::cerr << "Couldn't find message named '" << dataset.message_name() + << "\n"; + } + + prototype_ = MessageFactory::generated_factory()->GetPrototype(d); + SetName((dataset.name() + suffix).c_str()); + } + + protected: + std::vector payloads_; + const Message* prototype_; +}; + +class WrappingCounter { + public: + WrappingCounter(size_t limit) : value_(0), limit_(limit) {} + + size_t Next() { + size_t ret = value_; + if (++value_ == limit_) { + value_ = 0; + } + return ret; + } + + private: + size_t value_; + size_t limit_; +}; + +template +class ParseNewFixture : public Fixture { + public: + ParseNewFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_parse_new") {} + + virtual void BenchmarkCase(benchmark::State& state) { + WrappingCounter i(payloads_.size()); + size_t total = 0; + + while (state.KeepRunning()) { + T m; + const std::string& payload = payloads_[i.Next()]; + total += payload.size(); + m.ParseFromString(payload); + } + + state.SetBytesProcessed(total); + } +}; + +template +class ParseNewArenaFixture : public Fixture { + public: + ParseNewArenaFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_parse_newarena") {} + + virtual void BenchmarkCase(benchmark::State& state) { + WrappingCounter i(payloads_.size()); + size_t total = 0; + + while (state.KeepRunning()) { + Arena arena; + Message* m = Arena::CreateMessage(&arena); + const std::string& payload = payloads_[i.Next()]; + total += payload.size(); + m->ParseFromString(payload); + } + + state.SetBytesProcessed(total); + } +}; + +template +class ParseReuseFixture : public Fixture { + public: + ParseReuseFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_parse_reuse") {} + + virtual void BenchmarkCase(benchmark::State& state) { + T m; + WrappingCounter i(payloads_.size()); + size_t total = 0; + + while (state.KeepRunning()) { + const std::string& payload = payloads_[i.Next()]; + total += payload.size(); + m.ParseFromString(payload); + } + + state.SetBytesProcessed(total); + } +}; + +template +class SerializeFixture : public Fixture { + public: + SerializeFixture(const BenchmarkDataset& dataset) + : Fixture(dataset, "_serialize") { + for (size_t i = 0; i < payloads_.size(); i++) { + message_.push_back(new T); + message_.back()->ParseFromString(payloads_[i]); + } + } + + ~SerializeFixture() { + for (size_t i = 0; i < message_.size(); i++) { + delete message_[i]; + } + } + + virtual void BenchmarkCase(benchmark::State& state) { + size_t total = 0; + std::string str; + WrappingCounter i(payloads_.size()); + + while (state.KeepRunning()) { + str.clear(); + message_[i.Next()]->SerializeToString(&str); + total += str.size(); + } + + state.SetBytesProcessed(total); + } + + private: + std::vector message_; +}; + +std::string ReadFile(const std::string& name) { + std::ifstream file(name.c_str()); + GOOGLE_CHECK(file.is_open()) << "Couldn't find file '" << name << + "', please make sure you are running " + "this command from the benchmarks/ " + "directory.\n"; + return std::string((std::istreambuf_iterator(file)), + std::istreambuf_iterator()); +} + +template +void RegisterBenchmarksForType(const BenchmarkDataset& dataset) { + ::benchmark::internal::RegisterBenchmarkInternal( + new ParseNewFixture(dataset)); + ::benchmark::internal::RegisterBenchmarkInternal( + new ParseReuseFixture(dataset)); + ::benchmark::internal::RegisterBenchmarkInternal( + new ParseNewArenaFixture(dataset)); + ::benchmark::internal::RegisterBenchmarkInternal( + new SerializeFixture(dataset)); +} + +void RegisterBenchmarks(const std::string& dataset_bytes) { + BenchmarkDataset dataset; + GOOGLE_CHECK(dataset.ParseFromString(dataset_bytes)); + + if (dataset.message_name() == "benchmarks.proto3.GoogleMessage1") { + RegisterBenchmarksForType(dataset); + } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage1") { + RegisterBenchmarksForType(dataset); + } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { + RegisterBenchmarksForType(dataset); + } else { + std::cerr << "Unknown message type: " << dataset.message_name(); + exit(1); + } +} + +int main(int argc, char *argv[]) { + glob_t glob_result; + if (glob("dataset.*.pb", 0, NULL, &glob_result) != 0) { + fprintf(stderr, "No dataset files found.\n"); + return 1; + } + + for (size_t i = 0; i < glob_result.gl_pathc; i++) { + fprintf(stderr, "Found input dataset: %s\n", glob_result.gl_pathv[i]); + RegisterBenchmarks(ReadFile(glob_result.gl_pathv[i])); + } + + ::benchmark::Initialize(&argc, argv); + ::benchmark::RunSpecifiedBenchmarks(); +} diff --git a/packager/third_party/protobuf/benchmarks/readme.txt b/packager/third_party/protobuf/benchmarks/readme.txt index 2c836d0a1c..b08b8bc09c 100644 --- a/packager/third_party/protobuf/benchmarks/readme.txt +++ b/packager/third_party/protobuf/benchmarks/readme.txt @@ -22,29 +22,25 @@ Running a benchmark (Java) $ javac -d tmp -cp protobuf.jar ProtoBench.java 3) Generate code for the relevant benchmark protocol buffer, e.g. - $ protoc --java_out=tmp google_size.proto google_speed.proto + $ protoc --java_out=tmp google_size.proto 4) Build the generated code, e.g. - $ cd tmp - $ javac -d . -cp ../protobuf.jar benchmarks/*.java + $ javac -d tmp -cp protobuf.jar tmp/benchmarks/*.java 5) Run the test. Arguments are given in pairs - the first argument is the descriptor type; the second is the filename. For example: - $ java -cp .;../protobuf.jar com.google.protocolbuffers.ProtoBench - benchmarks.GoogleSize$SizeMessage1 ../google_message1.dat - benchmarks.GoogleSpeed$SpeedMessage1 ../google_message1.dat - benchmarks.GoogleSize$SizeMessage2 ../google_message2.dat - benchmarks.GoogleSpeed$SpeedMessage2 ../google_message2.dat + $ java -cp tmp:protobuf.jar com.google.protocolbuffers.ProtoBench \ + 'benchmarks.GoogleSize$SizeMessage1' google_message1.dat \ + 'benchmarks.GoogleSize$SizeMessage2' google_message2.dat -6) Wait! Each test runs for around 30 seconds, and there are 6 tests +6) Wait! Each test runs for around 30 seconds, and there are 8 tests per class/data combination. The above command would therefore take - about 12 minutes to run. + about 8 minutes to run. Benchmarks available -------------------- From Google: -google_size.proto and google_speed.proto, messages -google_message1.dat and google_message2.dat. The proto files are -equivalent, but optimized differently. +google_size.proto, +messages google_message1.dat and google_message2.dat. diff --git a/packager/third_party/protobuf/cmake/CMakeLists.txt b/packager/third_party/protobuf/cmake/CMakeLists.txt index f32a0e4e65..7618ba21a1 100644 --- a/packager/third_party/protobuf/cmake/CMakeLists.txt +++ b/packager/third_party/protobuf/cmake/CMakeLists.txt @@ -1,22 +1,28 @@ # Minimum CMake required -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.8.12) -# Project -project(protobuf C CXX) +if(protobuf_VERBOSE) + message(STATUS "Protocol Buffers Configuring...") +endif() # CMake policies cmake_policy(SET CMP0022 NEW) +# Project +project(protobuf C CXX) + # Options -option(protobuf_VERBOSE "Enable for verbose output" OFF) option(protobuf_BUILD_TESTS "Build tests" ON) +option(protobuf_BUILD_EXAMPLES "Build examples" OFF) if (BUILD_SHARED_LIBS) set(protobuf_BUILD_SHARED_LIBS_DEFAULT ON) else (BUILD_SHARED_LIBS) set(protobuf_BUILD_SHARED_LIBS_DEFAULT OFF) endif (BUILD_SHARED_LIBS) option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT}) -option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON) +include(CMakeDependentOption) +cmake_dependent_option(protobuf_MSVC_STATIC_RUNTIME "Link static runtime libraries" ON + "NOT protobuf_BUILD_SHARED_LIBS" OFF) if (MSVC) set(protobuf_WITH_ZLIB_DEFAULT OFF) else (MSVC) @@ -25,6 +31,9 @@ endif (MSVC) option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT}) set(protobuf_DEBUG_POSTFIX "d" CACHE STRING "Default debug postfix") +mark_as_advanced(protobuf_DEBUG_POSTFIX) +# User options +include(protobuf-options.cmake) # Path to main configure script set(protobuf_CONFIGURE_SCRIPT "../configure.ac") @@ -44,17 +53,24 @@ string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2" string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\3" protobuf_CONTACT "${protobuf_AC_INIT_LINE}") # Parse version tweaks -set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*$") +set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)$") string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\1" protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}") string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\2" protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}") string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\3" protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}") +string(REGEX REPLACE "${protobuf_VERSION_REGEX}" "\\4" + protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}") + # Package version set(protobuf_VERSION "${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}") +if(protobuf_VERSION_PRERELEASE) + set(protobuf_VERSION "${protobuf_VERSION}-${protobuf_VERSION_PRERELEASE}") +endif() + if(protobuf_VERBOSE) message(STATUS "Configuration script parsing status [") message(STATUS " Description : ${protobuf_DESCRIPTION}") @@ -70,6 +86,7 @@ if (CMAKE_USE_PTHREADS_INIT) add_definitions(-DHAVE_PTHREAD) endif (CMAKE_USE_PTHREADS_INIT) +set(_protobuf_FIND_ZLIB) if (protobuf_WITH_ZLIB) find_package(ZLIB) if (ZLIB_FOUND) @@ -80,6 +97,7 @@ if (protobuf_WITH_ZLIB) # Using imported target if exists if (TARGET ZLIB::ZLIB) set(ZLIB_LIBRARIES ZLIB::ZLIB) + set(_protobuf_FIND_ZLIB "if(NOT ZLIB_FOUND)\n find_package(ZLIB)\nendif()") endif (TARGET ZLIB::ZLIB) else (ZLIB_FOUND) set(HAVE_ZLIB 0) @@ -117,7 +135,7 @@ endif (protobuf_BUILD_SHARED_LIBS) if (MSVC) # Build with multiple processes add_definitions(/MP) - add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305) + add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305 /wd4309) # Allow big object add_definitions(/bigobj) string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) @@ -141,6 +159,10 @@ else (MSVC) set(LIB_PREFIX) endif (MSVC) +if (protobuf_UNICODE) + add_definitions(-DUNICODE -D_UNICODE) +endif (protobuf_UNICODE) + include(libprotobuf-lite.cmake) include(libprotobuf.cmake) include(libprotoc.cmake) @@ -151,3 +173,11 @@ if (protobuf_BUILD_TESTS) endif (protobuf_BUILD_TESTS) include(install.cmake) + +if (protobuf_BUILD_EXAMPLES) + include(examples.cmake) +endif (protobuf_BUILD_EXAMPLES) + +if(protobuf_VERBOSE) + message(STATUS "Protocol Buffers Configuring done") +endif() diff --git a/packager/third_party/protobuf/cmake/examples.cmake b/packager/third_party/protobuf/cmake/examples.cmake new file mode 100644 index 0000000000..e5cad63f67 --- /dev/null +++ b/packager/third_party/protobuf/cmake/examples.cmake @@ -0,0 +1,57 @@ +if(protobuf_VERBOSE) + message(STATUS "Protocol Buffers Examples Configuring...") +endif() + +get_filename_component(examples_dir "../examples" ABSOLUTE) + +if(protobuf_VERBOSE) + message(STATUS "Protocol Buffers Examples Configuring done") +endif() +include(ExternalProject) + +# Internal utility function: Create a custom target representing a build of examples with custom options. +function(add_examples_build NAME) + + ExternalProject_Add(${NAME} + PREFIX ${NAME} + SOURCE_DIR "${examples_dir}" + BINARY_DIR ${NAME} + STAMP_DIR ${NAME}/logs + INSTALL_COMMAND "" #Skip + LOG_CONFIGURE 1 + CMAKE_CACHE_ARGS "-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}" + "-Dprotobuf_VERBOSE:BOOL=${protobuf_VERBOSE}" + ${ARGN} + ) + set_property(TARGET ${NAME} PROPERTY FOLDER "Examples") + set_property(TARGET ${NAME} PROPERTY EXCLUDE_FROM_ALL TRUE) +endfunction() + +# Add examples as an external project. +# sub_directory cannot be used because the find_package(protobuf) call would cause failures with redefined targets. +add_examples_build(examples "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}") +add_dependencies(examples libprotobuf protoc) + +option(protobuf_BUILD_EXAMPLES_MULTITEST "Build Examples in multiple configurations. Useful for testing." OFF) +mark_as_advanced(protobuf_BUILD_EXAMPLES_MULTITEST) +if(protobuf_BUILD_EXAMPLES_MULTITEST) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) + + #Build using the legacy compatibility module. + add_examples_build(examples-legacy + "-Dprotobuf_DIR:PATH=${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}" + "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE" + ) + add_dependencies(examples-legacy libprotobuf protoc) + + #Build using the installed library. + add_examples_build(examples-installed + "-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" + ) + + #Build using the installed library in legacy compatibility mode. + add_examples_build(examples-installed-legacy + "-Dprotobuf_DIR:PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" + "-Dprotobuf_MODULE_COMPATIBLE:BOOL=TRUE" + ) +endif() diff --git a/packager/third_party/protobuf/cmake/extract_includes.bat.in b/packager/third_party/protobuf/cmake/extract_includes.bat.in index b593e0c9cc..1560a14bf3 100644 --- a/packager/third_party/protobuf/cmake/extract_includes.bat.in +++ b/packager/third_party/protobuf/cmake/extract_includes.bat.in @@ -8,117 +8,125 @@ mkdir include\google\protobuf\compiler\java mkdir include\google\protobuf\compiler\javanano mkdir include\google\protobuf\compiler\js mkdir include\google\protobuf\compiler\objectivec +mkdir include\google\protobuf\compiler\php mkdir include\google\protobuf\compiler\python mkdir include\google\protobuf\compiler\ruby mkdir include\google\protobuf\io mkdir include\google\protobuf\stubs mkdir include\google\protobuf\util -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h include\google\protobuf\any.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h include\google\protobuf\any.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h include\google\protobuf\api.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h include\google\protobuf\arena.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h include\google\protobuf\arenastring.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h include\google\protobuf\compiler\code_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h include\google\protobuf\compiler\command_line_interface.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h include\google\protobuf\compiler\cpp\cpp_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h include\google\protobuf\compiler\csharp\csharp_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h include\google\protobuf\compiler\csharp\csharp_names.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h include\google\protobuf\compiler\importer.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h include\google\protobuf\compiler\java\java_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h include\google\protobuf\compiler\java\java_names.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\javanano\javanano_generator.h include\google\protobuf\compiler\javanano\javanano_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h include\google\protobuf\compiler\js\js_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h include\google\protobuf\compiler\objectivec\objectivec_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h include\google\protobuf\compiler\objectivec\objectivec_helpers.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h include\google\protobuf\compiler\parser.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h include\google\protobuf\compiler\plugin.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h include\google\protobuf\compiler\plugin.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h include\google\protobuf\compiler\python\python_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h include\google\protobuf\compiler\ruby\ruby_generator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h include\google\protobuf\descriptor.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h include\google\protobuf\descriptor.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h include\google\protobuf\descriptor_database.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h include\google\protobuf\duration.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h include\google\protobuf\dynamic_message.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h include\google\protobuf\empty.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h include\google\protobuf\extension_set.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h include\google\protobuf\field_mask.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h include\google\protobuf\generated_enum_reflection.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h include\google\protobuf\generated_enum_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h include\google\protobuf\generated_message_reflection.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h include\google\protobuf\generated_message_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h include\google\protobuf\io\coded_stream.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h include\google\protobuf\io\gzip_stream.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h include\google\protobuf\io\printer.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h include\google\protobuf\io\strtod.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h include\google\protobuf\io\tokenizer.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h include\google\protobuf\io\zero_copy_stream.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h include\google\protobuf\io\zero_copy_stream_impl.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h include\google\protobuf\io\zero_copy_stream_impl_lite.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h include\google\protobuf\map.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h include\google\protobuf\map_entry.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h include\google\protobuf\map_entry_lite.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h include\google\protobuf\map_field.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h include\google\protobuf\map_field_inl.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h include\google\protobuf\map_field_lite.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h include\google\protobuf\map_type_handler.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h include\google\protobuf\message.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h include\google\protobuf\message_lite.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h include\google\protobuf\metadata.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h include\google\protobuf\reflection.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h include\google\protobuf\reflection_ops.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h include\google\protobuf\repeated_field.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field_reflection.h include\google\protobuf\repeated_field_reflection.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h include\google\protobuf\service.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h include\google\protobuf\source_context.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h include\google\protobuf\struct.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomic_sequence_num.h include\google\protobuf\stubs\atomic_sequence_num.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops.h include\google\protobuf\stubs\atomicops.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm64_gcc.h include\google\protobuf\stubs\atomicops_internals_arm64_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_gcc.h include\google\protobuf\stubs\atomicops_internals_arm_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_qnx.h include\google\protobuf\stubs\atomicops_internals_arm_qnx.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_atomicword_compat.h include\google\protobuf\stubs\atomicops_internals_atomicword_compat.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_gcc.h include\google\protobuf\stubs\atomicops_internals_generic_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_macosx.h include\google\protobuf\stubs\atomicops_internals_macosx.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_mips_gcc.h include\google\protobuf\stubs\atomicops_internals_mips_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_pnacl.h include\google\protobuf\stubs\atomicops_internals_pnacl.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_power.h include\google\protobuf\stubs\atomicops_internals_power.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_solaris.h include\google\protobuf\stubs\atomicops_internals_solaris.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_tsan.h include\google\protobuf\stubs\atomicops_internals_tsan.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_gcc.h include\google\protobuf\stubs\atomicops_internals_x86_gcc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_msvc.h include\google\protobuf\stubs\atomicops_internals_x86_msvc.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h include\google\protobuf\stubs\bytestream.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h include\google\protobuf\stubs\callback.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h include\google\protobuf\stubs\casts.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h include\google\protobuf\stubs\common.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h include\google\protobuf\stubs\fastmem.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h include\google\protobuf\stubs\hash.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h include\google\protobuf\stubs\logging.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h include\google\protobuf\stubs\macros.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h include\google\protobuf\stubs\mutex.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h include\google\protobuf\stubs\once.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h include\google\protobuf\stubs\platform_macros.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h include\google\protobuf\stubs\port.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\scoped_ptr.h include\google\protobuf\stubs\scoped_ptr.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h include\google\protobuf\stubs\shared_ptr.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h include\google\protobuf\stubs\singleton.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h include\google\protobuf\stubs\status.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h include\google\protobuf\stubs\stl_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h include\google\protobuf\stubs\stringpiece.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h include\google\protobuf\stubs\template_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\type_traits.h include\google\protobuf\stubs\type_traits.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h include\google\protobuf\text_format.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h include\google\protobuf\timestamp.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h include\google\protobuf\type.pb.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h include\google\protobuf\unknown_field_set.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_comparator.h include\google\protobuf\util\field_comparator.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_mask_util.h include\google\protobuf\util\field_mask_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\json_util.h include\google\protobuf\util\json_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\message_differencer.h include\google\protobuf\util\message_differencer.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\time_util.h include\google\protobuf\util\time_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h include\google\protobuf\util\type_resolver.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h include\google\protobuf\util\type_resolver_util.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h include\google\protobuf\wire_format.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h include\google\protobuf\wire_format_lite.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h include\google\protobuf\wire_format_lite_inl.h -copy ${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h include\google\protobuf\wrappers.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.h" include\google\protobuf\any.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.pb.h" include\google\protobuf\any.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.pb.h" include\google\protobuf\api.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arena.h" include\google\protobuf\arena.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\javanano\javanano_generator.h" include\google\protobuf\compiler\javanano\javanano_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\php\php_generator.h" include\google\protobuf\compiler\php\php_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.h" include\google\protobuf\compiler\plugin.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\plugin.pb.h" include\google\protobuf\compiler\plugin.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\profile.pb.h" include\google\protobuf\compiler\profile.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\python\python_generator.h" include\google\protobuf\compiler\python\python_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\ruby\ruby_generator.h" include\google\protobuf\compiler\ruby\ruby_generator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.h" include\google\protobuf\descriptor.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor.pb.h" include\google\protobuf\descriptor.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\descriptor_database.h" include\google\protobuf\descriptor_database.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_util.h" include\google\protobuf\generated_message_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\has_bits.h" include\google\protobuf\has_bits.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\coded_stream.h" include\google\protobuf\io\coded_stream.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\gzip_stream.h" include\google\protobuf\io\gzip_stream.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\printer.h" include\google\protobuf\io\printer.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\strtod.h" include\google\protobuf\io\strtod.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\tokenizer.h" include\google\protobuf\io\tokenizer.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream.h" include\google\protobuf\io\zero_copy_stream.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl.h" include\google\protobuf\io\zero_copy_stream_impl.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\io\zero_copy_stream_impl_lite.h" include\google\protobuf\io\zero_copy_stream_impl_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map.h" include\google\protobuf\map.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry.h" include\google\protobuf\map_entry.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_entry_lite.h" include\google\protobuf\map_entry_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field.h" include\google\protobuf\map_field.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_inl.h" include\google\protobuf\map_field_inl.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_field_lite.h" include\google\protobuf\map_field_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\map_type_handler.h" include\google\protobuf\map_type_handler.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\google\protobuf\message.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomic_sequence_num.h" include\google\protobuf\stubs\atomic_sequence_num.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops.h" include\google\protobuf\stubs\atomicops.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm64_gcc.h" include\google\protobuf\stubs\atomicops_internals_arm64_gcc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_gcc.h" include\google\protobuf\stubs\atomicops_internals_arm_gcc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_arm_qnx.h" include\google\protobuf\stubs\atomicops_internals_arm_qnx.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_atomicword_compat.h" include\google\protobuf\stubs\atomicops_internals_atomicword_compat.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_c11_atomic.h" include\google\protobuf\stubs\atomicops_internals_generic_c11_atomic.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_generic_gcc.h" include\google\protobuf\stubs\atomicops_internals_generic_gcc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_mips_gcc.h" include\google\protobuf\stubs\atomicops_internals_mips_gcc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_power.h" include\google\protobuf\stubs\atomicops_internals_power.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_ppc_gcc.h" include\google\protobuf\stubs\atomicops_internals_ppc_gcc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_solaris.h" include\google\protobuf\stubs\atomicops_internals_solaris.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_tsan.h" include\google\protobuf\stubs\atomicops_internals_tsan.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_gcc.h" include\google\protobuf\stubs\atomicops_internals_x86_gcc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\atomicops_internals_x86_msvc.h" include\google\protobuf\stubs\atomicops_internals_x86_msvc.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" include\google\protobuf\stubs\casts.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h" include\google\protobuf\stubs\fastmem.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h" include\google\protobuf\stubs\hash.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\scoped_ptr.h" include\google\protobuf\stubs\scoped_ptr.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\shared_ptr.h" include\google\protobuf\stubs\shared_ptr.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h" include\google\protobuf\stubs\singleton.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\type_traits.h" include\google\protobuf\stubs\type_traits.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\type.pb.h" include\google\protobuf\type.pb.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\unknown_field_set.h" include\google\protobuf\unknown_field_set.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\delimited_message_util.h" include\google\protobuf\util\delimited_message_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_comparator.h" include\google\protobuf\util\field_comparator.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\field_mask_util.h" include\google\protobuf\util\field_mask_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\json_util.h" include\google\protobuf\util\json_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\message_differencer.h" include\google\protobuf\util\message_differencer.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\time_util.h" include\google\protobuf\util\time_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h" include\google\protobuf\util\type_resolver.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h" include\google\protobuf\util\type_resolver_util.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" include\google\protobuf\wire_format.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h" include\google\protobuf\wire_format_lite_inl.h +copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h diff --git a/packager/third_party/protobuf/cmake/install.cmake b/packager/third_party/protobuf/cmake/install.cmake index dbb4265d45..28dc90dc3f 100644 --- a/packager/third_party/protobuf/cmake/install.cmake +++ b/packager/third_party/protobuf/cmake/install.cmake @@ -6,6 +6,7 @@ foreach(_library libprotoc) set_property(TARGET ${_library} PROPERTY INTERFACE_INCLUDE_DIRECTORIES + $ $) install(TARGETS ${_library} EXPORT protobuf-targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library} @@ -16,34 +17,26 @@ endforeach() install(TARGETS protoc EXPORT protobuf-targets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) -if(TRUE) - file(STRINGS extract_includes.bat.in _extract_strings - REGEX "^copy") - foreach(_extract_string ${_extract_strings}) - string(REPLACE "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\" "" - _extract_string ${_extract_string}) - string(REPLACE "\\" "/" _extract_string ${_extract_string}) - string(REGEX MATCH "^[^ ]+" - _extract_from ${_extract_string}) - string(REGEX REPLACE "^${_extract_from} ([^$]+)" "\\1" - _extract_to ${_extract_string}) - get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/${_extract_from}" ABSOLUTE) - get_filename_component(_extract_name ${_extract_to} NAME) - get_filename_component(_extract_to ${_extract_to} PATH) - string(REPLACE "include/" "${CMAKE_INSTALL_INCLUDEDIR}/" - _extract_to "${_extract_to}") - if(EXISTS "${_extract_from}") - install(FILES "${_extract_from}" - DESTINATION "${_extract_to}" - COMPONENT protobuf-headers - RENAME "${_extract_name}") - else() - message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in " - "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" " - "but there not exists. The file will not be installed.") - endif() - endforeach() -endif() +file(STRINGS extract_includes.bat.in _extract_strings + REGEX "^copy") +foreach(_extract_string ${_extract_strings}) + string(REGEX REPLACE "^.* .+ include\\\\(.+)$" "\\1" + _header ${_extract_string}) + string(REPLACE "\\" "/" _header ${_header}) + get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/../src/${_header}" ABSOLUTE) + get_filename_component(_extract_name ${_header} NAME) + get_filename_component(_extract_to "${CMAKE_INSTALL_INCLUDEDIR}/${_header}" PATH) + if(EXISTS "${_extract_from}") + install(FILES "${_extract_from}" + DESTINATION "${_extract_to}" + COMPONENT protobuf-headers + RENAME "${_extract_name}") + else() + message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in " + "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" " + "but there not exists. The file will not be installed.") + endif() +endforeach() # Internal function for parsing auto tools scripts function(_protobuf_auto_list FILE_NAME VARIABLE) @@ -82,22 +75,43 @@ foreach(_file ${nobase_dist_proto_DATA}) endif() endforeach() -# Export configuration - -install(EXPORT protobuf-targets - DESTINATION "lib/cmake/protobuf" - COMPONENT protobuf-export) +# Install configuration +set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake configuration files") +if(NOT MSVC) + set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRING "${_cmakedir_desc}") +else() + set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}") +endif() +mark_as_advanced(CMAKE_INSTALL_CMAKEDIR) configure_file(protobuf-config.cmake.in - protobuf-config.cmake @ONLY) + ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY) configure_file(protobuf-config-version.cmake.in - protobuf-config-version.cmake @ONLY) + ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY) configure_file(protobuf-module.cmake.in - protobuf-module.cmake @ONLY) + ${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY) +configure_file(protobuf-options.cmake + ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY) -install(FILES - "${protobuf_BINARY_DIR}/protobuf-config.cmake" - "${protobuf_BINARY_DIR}/protobuf-config-version.cmake" - "${protobuf_BINARY_DIR}/protobuf-module.cmake" - DESTINATION "lib/cmake/protobuf" +# Allows the build directory to be used as a find directory. +export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc + NAMESPACE protobuf:: + FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake +) + +install(EXPORT protobuf-targets + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" + NAMESPACE protobuf:: COMPONENT protobuf-export) + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/ + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" + COMPONENT protobuf-export + PATTERN protobuf-targets.cmake EXCLUDE +) + +option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF) +if(protobuf_INSTALL_EXAMPLES) + install(DIRECTORY ../examples/ DESTINATION examples + COMPONENT protobuf-examples) +endif() diff --git a/packager/third_party/protobuf/cmake/libprotobuf-lite.cmake b/packager/third_party/protobuf/cmake/libprotobuf-lite.cmake index 036b051707..1ee9b9c5df 100644 --- a/packager/third_party/protobuf/cmake/libprotobuf-lite.cmake +++ b/packager/third_party/protobuf/cmake/libprotobuf-lite.cmake @@ -24,8 +24,32 @@ set(libprotobuf_lite_files ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc ) +set(libprotobuf_lite_includes + ${protobuf_source_dir}/src/google/protobuf/arena.h + ${protobuf_source_dir}/src/google/protobuf/arenastring.h + ${protobuf_source_dir}/src/google/protobuf/extension_set.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_util.h + ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h + ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h + ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h + ${protobuf_source_dir}/src/google/protobuf/message_lite.h + ${protobuf_source_dir}/src/google/protobuf/repeated_field.h + ${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.h + ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h + ${protobuf_source_dir}/src/google/protobuf/stubs/common.h + ${protobuf_source_dir}/src/google/protobuf/stubs/int128.h + ${protobuf_source_dir}/src/google/protobuf/stubs/once.h + ${protobuf_source_dir}/src/google/protobuf/stubs/status.h + ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h + ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h + ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h + ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h + ${protobuf_source_dir}/src/google/protobuf/stubs/time.h + ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h +) + add_library(libprotobuf-lite ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files}) + ${libprotobuf_lite_files} ${libprotobuf_lite_includes}) target_link_libraries(libprotobuf-lite ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(libprotobuf-lite PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) diff --git a/packager/third_party/protobuf/cmake/libprotobuf.cmake b/packager/third_party/protobuf/cmake/libprotobuf.cmake index 8930c1ca1e..72db915bc9 100644 --- a/packager/third_party/protobuf/cmake/libprotobuf.cmake +++ b/packager/third_party/protobuf/cmake/libprotobuf.cmake @@ -13,6 +13,7 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc + ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc ${protobuf_source_dir}/src/google/protobuf/io/printer.cc ${protobuf_source_dir}/src/google/protobuf/io/strtod.cc @@ -30,6 +31,7 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.cc ${protobuf_source_dir}/src/google/protobuf/type.pb.cc ${protobuf_source_dir}/src/google/protobuf/unknown_field_set.cc + ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.cc ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.cc ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.cc ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.cc @@ -54,9 +56,68 @@ set(libprotobuf_files ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc ) +set(libprotobuf_includes + ${protobuf_source_dir}/src/google/protobuf/any.h + ${protobuf_source_dir}/src/google/protobuf/any.pb.h + ${protobuf_source_dir}/src/google/protobuf/api.pb.h + ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h + ${protobuf_source_dir}/src/google/protobuf/compiler/parser.h + ${protobuf_source_dir}/src/google/protobuf/descriptor.h + ${protobuf_source_dir}/src/google/protobuf/descriptor.pb.h + ${protobuf_source_dir}/src/google/protobuf/descriptor_database.h + ${protobuf_source_dir}/src/google/protobuf/duration.pb.h + ${protobuf_source_dir}/src/google/protobuf/dynamic_message.h + ${protobuf_source_dir}/src/google/protobuf/empty.pb.h + ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h + ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h + ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h + ${protobuf_source_dir}/src/google/protobuf/io/printer.h + ${protobuf_source_dir}/src/google/protobuf/io/strtod.h + ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h + ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h + ${protobuf_source_dir}/src/google/protobuf/map_field.h + ${protobuf_source_dir}/src/google/protobuf/message.h + ${protobuf_source_dir}/src/google/protobuf/reflection_ops.h + ${protobuf_source_dir}/src/google/protobuf/service.h + ${protobuf_source_dir}/src/google/protobuf/source_context.pb.h + ${protobuf_source_dir}/src/google/protobuf/struct.pb.h + ${protobuf_source_dir}/src/google/protobuf/stubs/mathlimits.h + ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h + ${protobuf_source_dir}/src/google/protobuf/text_format.h + ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h + ${protobuf_source_dir}/src/google/protobuf/type.pb.h + ${protobuf_source_dir}/src/google/protobuf/unknown_field_set.h + ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h + ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h + ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h + ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h + ${protobuf_source_dir}/src/google/protobuf/util/json_util.h + ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h + ${protobuf_source_dir}/src/google/protobuf/util/time_util.h + ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h + ${protobuf_source_dir}/src/google/protobuf/wire_format.h + ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h +) + add_library(libprotobuf ${protobuf_SHARED_OR_STATIC} - ${libprotobuf_lite_files} ${libprotobuf_files}) -target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) + ${libprotobuf_lite_files} ${libprotobuf_files} ${libprotobuf_includes}) +target_link_libraries(libprotobuf ${CMAKE_THREAD_LIBS_INIT}) +if(protobuf_WITH_ZLIB) + target_link_libraries(libprotobuf ${ZLIB_LIBRARIES}) +endif() target_include_directories(libprotobuf PUBLIC ${protobuf_source_dir}/src) if(MSVC AND protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotobuf diff --git a/packager/third_party/protobuf/cmake/libprotoc.cmake b/packager/third_party/protobuf/cmake/libprotoc.cmake index 8df8986a11..5122654030 100644 --- a/packager/third_party/protobuf/cmake/libprotoc.cmake +++ b/packager/third_party/protobuf/cmake/libprotoc.cmake @@ -72,6 +72,7 @@ set(libprotoc_files ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.cc @@ -84,16 +85,139 @@ set(libprotoc_files ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.cc ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/profile.pb.cc ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc ) +set(libprotoc_headers + ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h + ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h + ${protobuf_source_dir}/src/google/protobuf/compiler/mock_code_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/package_info.h + ${protobuf_source_dir}/src/google/protobuf/compiler/parser.h + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h + ${protobuf_source_dir}/src/google/protobuf/compiler/profile.pb.h + ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h + ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_lazy_message_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_params.h + ${protobuf_source_dir}/src/google/protobuf/compiler/javanano/javanano_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h + ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h + ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h + ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h +) + +set(js_well_known_types_sources + ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types/any.js + ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types/struct.js + ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types/timestamp.js +) +add_executable(js_embed ${protobuf_source_dir}/src/google/protobuf/compiler/js/embed.cc) +add_custom_command( + OUTPUT ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc + DEPENDS js_embed ${js_well_known_types_sources} + COMMAND js_embed ${js_well_known_types_sources} > ${protobuf_source_dir}/src/google/protobuf/compiler/js/well_known_types_embed.cc +) + add_library(libprotoc ${protobuf_SHARED_OR_STATIC} - ${libprotoc_files}) + ${libprotoc_files} ${libprotoc_headers}) target_link_libraries(libprotoc libprotobuf) if(MSVC AND protobuf_BUILD_SHARED_LIBS) target_compile_definitions(libprotoc diff --git a/packager/third_party/protobuf/cmake/protobuf-config-version.cmake.in b/packager/third_party/protobuf/cmake/protobuf-config-version.cmake.in index 1f171c6649..ca6da09ad7 100644 --- a/packager/third_party/protobuf/cmake/protobuf-config-version.cmake.in +++ b/packager/third_party/protobuf/cmake/protobuf-config-version.cmake.in @@ -1 +1,60 @@ -set(PACKAGE_VERSION @protobuf_VERSION@) +set(PACKAGE_VERSION "@protobuf_VERSION@") +set(${PACKAGE_FIND_NAME}_VERSION_PRERELEASE "@protobuf_VERSION_PRERELEASE@" PARENT_SCOPE) + +# Prerelease versions cannot be passed in directly via the find_package command, +# so we allow users to specify it in a variable +if(NOT DEFINED "${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE") + set("${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}" "") +else() + set(PACKAGE_FIND_VERSION ${PACKAGE_FIND_VERSION}-${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}) +endif() +set(PACKAGE_FIND_VERSION_PRERELEASE "${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}") + +# VERSION_EQUAL ignores the prerelease strings, so we use STREQUAL. +if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) +endif() + +set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise + +if(PACKAGE_FIND_VERSION) #Only perform version checks if one is given + if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@") + set(PACKAGE_VERSION_COMPATIBLE FALSE) + elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + elseif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) + # Do not match prerelease versions to non-prerelease version requests. + if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "" AND PACKAGE_FIND_VERSION_PRERELEASE STREQUAL "") + message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@' or greater.") + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + + # Not robustly SemVer compliant, but protobuf never uses '.' separated prerelease identifiers. + if(PACKAGE_FIND_VERSION_PRERELEASE STRGREATER "@protobuf_VERSION_PRERELEASE@") + set(PACKAGE_VERSION_COMPATIBLE FALSE) + endif() + endif() +endif() + +# Check and save build options used to create this package +macro(_check_and_save_build_option OPTION VALUE) + if(DEFINED ${PACKAGE_FIND_NAME}_${OPTION} AND + NOT ${PACKAGE_FIND_NAME}_${OPTION} STREQUAL ${VALUE}) + set(PACKAGE_VERSION_UNSUITABLE TRUE) + endif() + set(${PACKAGE_FIND_NAME}_${OPTION} ${VALUE} PARENT_SCOPE) +endmacro() +_check_and_save_build_option(WITH_ZLIB @protobuf_WITH_ZLIB@) +_check_and_save_build_option(MSVC_STATIC_RUNTIME @protobuf_MSVC_STATIC_RUNTIME@) +_check_and_save_build_option(BUILD_SHARED_LIBS @protobuf_BUILD_SHARED_LIBS@) + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "" AND NOT "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") + # check that the installed version has the same 32/64bit-ness as the one which is currently searching: + if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") + math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) + endif() +endif() + diff --git a/packager/third_party/protobuf/cmake/protobuf-config.cmake.in b/packager/third_party/protobuf/cmake/protobuf-config.cmake.in index bb0997b88b..8321354781 100644 --- a/packager/third_party/protobuf/cmake/protobuf-config.cmake.in +++ b/packager/third_party/protobuf/cmake/protobuf-config.cmake.in @@ -1,27 +1,112 @@ -# Version info variables -set(PROTOBUF_VERSION "@protobuf_VERSION@") -set(PROTOBUF_VERSION_STRING "@protobuf_VERSION_STRING@") +# User options +include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake") -# Current dir -get_filename_component(_PROTOBUF_PACKAGE_PREFIX - "${CMAKE_CURRENT_LIST_FILE}" PATH) +# Depend packages +@_protobuf_FIND_ZLIB@ # Imported targets -include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake") -# Compute the installation prefix relative to this file. -get_filename_component(_PROTOBUF_IMPORT_PREFIX - "${_PROTOBUF_PACKAGE_PREFIX}" PATH) -get_filename_component(_PROTOBUF_IMPORT_PREFIX - "${_PROTOBUF_IMPORT_PREFIX}" PATH) -get_filename_component(_PROTOBUF_IMPORT_PREFIX - "${_PROTOBUF_IMPORT_PREFIX}" PATH) +function(protobuf_generate) + include(CMakeParseArguments) + set(_singleargs LANGUAGE OUT_VAR) + if(COMMAND target_sources) + list(APPEND _singleargs TARGET) + endif() + + cmake_parse_arguments(protobuf_generate "APPEND_PATH" "${_singleargs}" "PROTOS IMPORT_DIRS GENERATE_EXTENSIONS" "${ARGN}") + + if(protobuf_generate_PROTOS AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without any targets or source files") + return() + endif() + + if(NOT protobuf_generate_OUT_VAR AND NOT protobuf_generate_TARGET) + message(SEND_ERROR "Error: protobuf_generate called without a target or output variable") + return() + endif() + + if(NOT protobuf_generate_LANGUAGE) + set(protobuf_generate_LANGUAGE cpp) + endif() + string(TOLOWER ${protobuf_generate_LANGUAGE} protobuf_generate_LANGUAGE) + + if(NOT protobuf_GENERATE_EXTENSIONS) + if(protobuf_generate_LANGUAGE STREQUAL cpp) + set(protobuf_GENERATE_EXTENSIONS .pb.h .pb.cc) + elseif(protobuf_generate_LANGUAGE STREQUAL python) + set(protobuf_GENERATE_EXTENSIONS _pb2.py) + else() + message(SEND_ERROR "Error: protobuf_generate given unknown Language ${LANGUAGE}, please provide a value for GENERATE_EXTENSIONS") + return() + endif() + endif() + + if(protobuf_generate_APPEND_PATH) + # Create an include path for each file specified + foreach(_file ${ARGN}) + get_filename_component(_abs_file ${_file} ABSOLUTE) + get_filename_component(_abs_path ${_abs_file} PATH) + list(FIND _protobuf_include_path ${_abs_path} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${_abs_path}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + foreach(DIR ${protobuf_generate_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + + if(protobuf_generate_TARGET) + get_target_property(_source_list ${protobuf_generate_TARGET} SOURCES) + foreach(_file ${_source_list}) + if(_file MATCHES "proto$") + list(APPEND protobuf_generate_PROTOS ${_file}) + endif() + endforeach() + endif() + + if(NOT protobuf_generate_PROTOS) + message(SEND_ERROR "Error: protobuf_generate could not find any .proto files") + return() + endif() + + set(_generated_srcs) + foreach(_proto ${protobuf_generate_PROTOS}) + get_filename_component(_abs_file ${_proto} ABSOLUTE) + get_filename_component(_basename ${_proto} NAME_WE) + + foreach(_ext ${_output_extensions}) + list(APPEND _generated_srcs "${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_ext}") + endforeach() + + add_custom_command( + OUTPUT ${_generated_srcs} + COMMAND protobuf::protoc + ARGS --${protobuf_generate_LANGUAGE}_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${_abs_file} + DEPENDS ${ABS_FIL} protobuf::protoc + COMMENT "Running ${protobuf_generate_LANGUAGE} protocol buffer compiler on ${_proto}" + VERBATIM ) + endforeach() + + set_source_files_properties(${_generated_srcs} PROPERTIES GENERATED TRUE) + if(protobuf_generate_OUT_VAR) + set(${protobuf_generate_OUT_VAR} ${_generated_srcs} PARENT_SCOPE) + endif() + if(protobuf_generate_TARGET) + target_sources(${protobuf_generate_TARGET} PUBLIC ${_generated_srcs}) + endif() + +endfunction() # CMake FindProtobuf module compatible file -if(NOT DEFINED PROTOBUF_MODULE_COMPATIBLE OR "${PROTOBUF_MODULE_COMPATIBLE}") - include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-module.cmake") +if(protobuf_MODULE_COMPATIBLE) + include("${CMAKE_CURRENT_LIST_DIR}/protobuf-module.cmake") endif() - -# Cleanup temporary variables. -set(_PROTOBUF_PACKAGE_PREFIX) -set(_PROTOBUF_IMPORT_PREFIX) diff --git a/packager/third_party/protobuf/cmake/protobuf-module.cmake.in b/packager/third_party/protobuf/cmake/protobuf-module.cmake.in index d81dc459b6..8e4920aa80 100644 --- a/packager/third_party/protobuf/cmake/protobuf-module.cmake.in +++ b/packager/third_party/protobuf/cmake/protobuf-module.cmake.in @@ -1,7 +1,5 @@ -if(PROTOBUF_SRC_ROOT_FOLDER) - message(AUTHOR_WARNING "Variable PROTOBUF_SRC_ROOT_FOLDER defined, but not" - " used in CONFIG mode") -endif() +# This file contains backwards compatibility patches for various legacy functions and variables +# Functions function(PROTOBUF_GENERATE_CPP SRCS HDRS) if(NOT ARGN) @@ -10,80 +8,99 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) endif() if(PROTOBUF_GENERATE_CPP_APPEND_PATH) - # Create an include path for each file specified - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(ABS_PATH ${ABS_FIL} PATH) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() - set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + set(_append_arg APPEND_PATH) endif() - # Add well-known type protos include path - list(APPEND _protobuf_include_path - -I "${_PROTOBUF_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@") - - if(DEFINED PROTOBUF_IMPORT_DIRS) - foreach(DIR ${PROTOBUF_IMPORT_DIRS}) - get_filename_component(ABS_PATH ${DIR} ABSOLUTE) - list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() + if(DEFINED Protobuf_IMPORT_DIRS) + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) endif() + set(_outvar) + protobuf_generate(${append_arg} LANGUAGE cpp OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) + set(${SRCS}) set(${HDRS}) - foreach(FIL ${ARGN}) - get_filename_component(ABS_FIL ${FIL} ABSOLUTE) - get_filename_component(FIL_WE ${FIL} NAME_WE) - - list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") - list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h") - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc" - "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" - COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} - ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} - COMMENT "Running C++ protocol buffer compiler on ${FIL}" - VERBATIM) + foreach(_file ${_outvar}) + if(_file MATCHES "cc$") + list(APPEND ${SRCS} ${_file}) + else() + list(APPEND ${HDRS} ${_file}) + endif() endforeach() - - set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) set(${SRCS} ${${SRCS}} PARENT_SCOPE) set(${HDRS} ${${HDRS}} PARENT_SCOPE) endfunction() +function(PROTOBUF_GENERATE_PYTHON SRCS) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_PYTHON() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + set(_append_arg APPEND_PATH) + endif() + + if(DEFINED Protobuf_IMPORT_DIRS) + set(_import_arg IMPORT_DIRS ${Protobuf_IMPORT_DIRS}) + endif() + + set(_outvar) + protobuf_generate(${append_arg} LANGUAGE cpp OUT_VAR _outvar ${_import_arg} PROTOS ${ARGN}) + set(${SRCS} ${_outvar} PARENT_SCOPE) +endfunction() + +# Environment + +# Backwards compatibility +# Define camel case versions of input variables +foreach(UPPER + PROTOBUF_SRC_ROOT_FOLDER + PROTOBUF_IMPORT_DIRS + PROTOBUF_DEBUG + PROTOBUF_LIBRARY + PROTOBUF_PROTOC_LIBRARY + PROTOBUF_INCLUDE_DIR + PROTOBUF_PROTOC_EXECUTABLE + PROTOBUF_LIBRARY_DEBUG + PROTOBUF_PROTOC_LIBRARY_DEBUG + PROTOBUF_LITE_LIBRARY + PROTOBUF_LITE_LIBRARY_DEBUG + ) + if (DEFINED ${UPPER}) + string(REPLACE "PROTOBUF_" "Protobuf_" Camel ${UPPER}) + if (NOT DEFINED ${Camel}) + set(${Camel} ${${UPPER}}) + endif() + endif() +endforeach() + +if(DEFINED Protobuf_SRC_ROOT_FOLDER) + message(AUTHOR_WARNING "Variable Protobuf_SRC_ROOT_FOLDER defined, but not" + " used in CONFIG mode") +endif() + +include(SelectLibraryConfigurations) + # Internal function: search for normal library as well as a debug one # if the debug one is specified also include debug/optimized keywords # in *_LIBRARIES variable function(_protobuf_find_libraries name filename) - get_target_property(${name}_LIBRARY lib${filename} - IMPORTED_LOCATION_RELEASE) - set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE) - get_target_property(${name}_LIBRARY_DEBUG lib${filename} - IMPORTED_LOCATION_DEBUG) - set(${name}_LIBRARY_DEBUG "${${name}_LIBRARY_DEBUG}" PARENT_SCOPE) + if(${name}_LIBRARIES) + # Use result recorded by a previous call. + elseif(${name}_LIBRARY) + # Honor cache entry used by CMake 3.5 and lower. + set(${name}_LIBRARIES "${${name}_LIBRARY}" PARENT_SCOPE) + else() + get_target_property(${name}_LIBRARY_RELEASE protobuf::lib${filename} + LOCATION_RELEASE) + get_target_property(${name}_LIBRARY_DEBUG protobuf::lib${filename} + LOCATION_DEBUG) - if(NOT ${name}_LIBRARY_DEBUG) - # There is no debug library - set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY} PARENT_SCOPE) - set(${name}_LIBRARIES ${${name}_LIBRARY} PARENT_SCOPE) - else() - # There IS a debug library - set(${name}_LIBRARIES - optimized ${${name}_LIBRARY} - debug ${${name}_LIBRARY_DEBUG} - PARENT_SCOPE - ) - endif() + select_library_configurations(${name}) + set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE) + set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE) + endif() endfunction() # Internal function: find threads library @@ -107,33 +124,59 @@ if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH) endif() # The Protobuf library -_protobuf_find_libraries(PROTOBUF protobuf) +_protobuf_find_libraries(Protobuf protobuf) # The Protobuf Lite library -_protobuf_find_libraries(PROTOBUF_LITE protobuf-lite) +_protobuf_find_libraries(Protobuf_LITE protobuf-lite) # The Protobuf Protoc Library -_protobuf_find_libraries(PROTOBUF_PROTOC protoc) +_protobuf_find_libraries(Protobuf_PROTOC protoc) if(UNIX) _protobuf_find_threads() endif() # Set the include directory -set(PROTOBUF_INCLUDE_DIR "${_PROTOBUF_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@") +get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf + INTERFACE_INCLUDE_DIRECTORIES) # Set the protoc Executable -get_target_property(PROTOBUF_PROTOC_EXECUTABLE protoc +get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc IMPORTED_LOCATION_RELEASE) -if(NOT PROTOBUF_PROTOC_EXECUTABLE) - get_target_property(PROTOBUF_PROTOC_EXECUTABLE protoc +if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") + get_target_property(Protobuf_PROTOC_EXECUTABLE protobuf::protoc IMPORTED_LOCATION_DEBUG) endif() -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG - PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) +# Version info variable +set(Protobuf_VERSION "@protobuf_VERSION@") -if(PROTOBUF_FOUND) - set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIR}) -endif() +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf + REQUIRED_VARS Protobuf_PROTOC_EXECUTABLE Protobuf_LIBRARIES Protobuf_INCLUDE_DIRS + VERSION_VAR Protobuf_VERSION +) + +# Backwards compatibility +# Define upper case versions of output variables +foreach(Camel + Protobuf_VERSION + Protobuf_SRC_ROOT_FOLDER + Protobuf_IMPORT_DIRS + Protobuf_DEBUG + Protobuf_INCLUDE_DIRS + Protobuf_LIBRARIES + Protobuf_PROTOC_LIBRARIES + Protobuf_LITE_LIBRARIES + Protobuf_LIBRARY + Protobuf_PROTOC_LIBRARY + Protobuf_INCLUDE_DIR + Protobuf_PROTOC_EXECUTABLE + Protobuf_LIBRARY_DEBUG + Protobuf_PROTOC_LIBRARY_DEBUG + Protobuf_LITE_LIBRARY + Protobuf_LITE_LIBRARY_DEBUG + ) + string(TOUPPER ${Camel} UPPER) + set(${UPPER} ${${Camel}}) +endforeach() diff --git a/packager/third_party/protobuf/cmake/protobuf-options.cmake b/packager/third_party/protobuf/cmake/protobuf-options.cmake new file mode 100644 index 0000000000..47fb158257 --- /dev/null +++ b/packager/third_party/protobuf/cmake/protobuf-options.cmake @@ -0,0 +1,7 @@ +# Verbose output +option(protobuf_VERBOSE "Enable for verbose output" OFF) +mark_as_advanced(protobuf_VERBOSE) + +# FindProtobuf module compatibel +option(protobuf_MODULE_COMPATIBLE "CMake build-in FindProtobuf.cmake module compatible" OFF) +mark_as_advanced(protobuf_MODULE_COMPATIBLE) diff --git a/packager/third_party/protobuf/cmake/tests.cmake b/packager/third_party/protobuf/cmake/tests.cmake index 76fdf8efdf..38dc0b522d 100644 --- a/packager/third_party/protobuf/cmake/tests.cmake +++ b/packager/third_party/protobuf/cmake/tests.cmake @@ -4,6 +4,7 @@ endif() option(protobuf_ABSOLUTE_TEST_PLUGIN_PATH "Using absolute test_plugin path in tests" ON) +mark_as_advanced(protobuf_ABSOLUTE_TEST_PLUGIN_PATH) include_directories( ${protobuf_source_dir}/gmock @@ -16,6 +17,7 @@ add_library(gmock STATIC ${protobuf_source_dir}/gmock/src/gmock-all.cc ${protobuf_source_dir}/gmock/gtest/src/gtest-all.cc ) +target_link_libraries(gmock ${CMAKE_THREAD_LIBS_INIT}) add_library(gmock_main STATIC ${protobuf_source_dir}/gmock/src/gmock_main.cc) target_link_libraries(gmock_main gmock) @@ -41,6 +43,9 @@ set(tests_protos google/protobuf/unittest_empty.proto google/protobuf/unittest_import.proto google/protobuf/unittest_import_public.proto + google/protobuf/unittest_lazy_dependencies.proto + google/protobuf/unittest_lazy_dependencies_custom_option.proto + google/protobuf/unittest_lazy_dependencies_enum.proto google/protobuf/unittest_lite_imports_nonlite.proto google/protobuf/unittest_mset.proto google/protobuf/unittest_mset_wire_format.proto @@ -62,8 +67,10 @@ set(tests_protos google/protobuf/util/internal/testdata/field_mask.proto google/protobuf/util/internal/testdata/maps.proto google/protobuf/util/internal/testdata/oneofs.proto + google/protobuf/util/internal/testdata/proto3.proto google/protobuf/util/internal/testdata/struct.proto google/protobuf/util/internal/testdata/timestamp_duration.proto + google/protobuf/util/internal/testdata/wrappers.proto google/protobuf/util/json_format_proto3.proto google/protobuf/util/message_differencer_unittest.proto ) @@ -119,6 +126,7 @@ set(tests_files ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/metadata_test.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/importer_unittest.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment_unittest.cc @@ -164,6 +172,7 @@ set(tests_files ${protobuf_source_dir}/src/google/protobuf/stubs/type_traits_unittest.cc ${protobuf_source_dir}/src/google/protobuf/text_format_unittest.cc ${protobuf_source_dir}/src/google/protobuf/unknown_field_set_unittest.cc + ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util_test.cc ${protobuf_source_dir}/src/google/protobuf/util/field_comparator_test.cc ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util_test.cc ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter_test.cc @@ -201,7 +210,7 @@ set(lite_test_files ${protobuf_source_dir}/src/google/protobuf/lite_unittest.cc ) add_executable(lite-test ${lite_test_files} ${common_lite_test_files} ${lite_test_proto_files}) -target_link_libraries(lite-test libprotobuf-lite) +target_link_libraries(lite-test libprotobuf-lite gmock_main) set(lite_arena_test_files ${protobuf_source_dir}/src/google/protobuf/lite_arena_unittest.cc @@ -211,4 +220,5 @@ target_link_libraries(lite-arena-test libprotobuf-lite gmock_main) add_custom_target(check COMMAND tests + DEPENDS tests test_plugin WORKING_DIRECTORY ${protobuf_source_dir}) diff --git a/packager/third_party/protobuf/composer.json b/packager/third_party/protobuf/composer.json new file mode 100644 index 0000000000..5b6c7ee239 --- /dev/null +++ b/packager/third_party/protobuf/composer.json @@ -0,0 +1,20 @@ +{ + "name": "google/protobuf", + "type": "library", + "description": "proto library for PHP", + "keywords": ["proto"], + "homepage": "https://developers.google.com/protocol-buffers/", + "license": "BSD-3-Clause", + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8.0" + }, + "autoload": { + "psr-4": { + "Google\\Protobuf\\Internal\\": "php/src/Google/Protobuf/Internal", + "GPBMetadata\\Google\\Protobuf\\Internal\\": "php/src/GPBMetadata/Google/Protobuf/Internal" + } + } +} diff --git a/packager/third_party/protobuf/config.h b/packager/third_party/protobuf/config.h deleted file mode 100644 index dc4f1a4558..0000000000 --- a/packager/third_party/protobuf/config.h +++ /dev/null @@ -1,196 +0,0 @@ -/* Modified for Chromium to support stlport and libc++ adaptively */ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* We want to detect which header files to include for the unordered (hash) - collections standardized in C++11 but first introduced as part of TR1. - Specifically, we want to avoid including ext/ headers when using libc++ as - it will generate noisy build warnings. - - We take a several-tier approach. First, attempt to use clang's __has_include - and test for libc++'s configuration header. If that isn't available, include - which will define libc++'s version macro (if using libc++). - - There are no really good alternative headers that do less work. For example, - ciso646 and cstdbool and commonly recommended, but they both have issues. - The first has side effects with MSVC, and the second does not exists on Apple - platforms (the system libstdc++ is too old). - - This dynamic check is necessary to allow using this normally dynamically - generated header with Chromium's many supported build configurations. It - should be expanded to import the right header on other platforms as - desired. */ - -#if defined(__has_include) -#if __has_include(<__config>) -#include <__config> -#else // __has_include(<__config>) -#include -#endif // __has_include(<__config>) -#endif // defined(__has_include) - -/* the name of */ -#if defined(_LIBCPP_VERSION) -#define HASH_MAP_CLASS unordered_map -#else -#define HASH_MAP_CLASS hash_map -#endif - -/* the location of or */ -#if defined(USE_STLPORT) -#define HASH_MAP_H -#elif defined(_LIBCPP_VERSION) -#define HASH_MAP_H -#else -#define HASH_MAP_H -#endif - -/* the namespace of hash_map/hash_set */ -#if defined(USE_STLPORT) || defined(_LIBCPP_VERSION) -#define HASH_NAMESPACE std -#else -#define HASH_NAMESPACE __gnu_cxx -#endif - -/* the name of */ -#if defined(_LIBCPP_VERSION) -#define HASH_SET_CLASS unordered_set -#else -#define HASH_SET_CLASS hash_set -#endif - -/* the location of or */ -#if defined(USE_STLPORT) -#define HASH_SET_H -#elif defined(_LIBCPP_VERSION) -#define HASH_SET_H -#else -#define HASH_SET_H -#endif - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `ftruncate' function. */ -#define HAVE_FTRUNCATE 1 - -/* define if the compiler has hash_map */ -#define HAVE_HASH_MAP 1 - -/* define if the compiler has hash_set */ -#define HAVE_HASH_SET 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have the `mkdir' function. */ -#define HAVE_MKDIR 1 - -/* Define if you have POSIX threads libraries and header files. */ -#define HAVE_PTHREAD 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strtol' function. */ -#define HAVE_STRTOL 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Enable classes using zlib compression. */ -#define HAVE_ZLIB 1 - -/* Name of package */ -#define PACKAGE "protobuf" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "protobuf@googlegroups.com" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Protocol Buffers" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Protocol Buffers 2.3.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "protobuf" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.3.0" - -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "2.3.0" - -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -/* # undef _ALL_SOURCE */ -#endif - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - -/* Define to 1 if on MINIX. */ -/* #undef _MINIX */ - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -/* #undef _POSIX_1_SOURCE */ - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* Enable extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 -#endif -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS 1 -#endif -#ifndef _TANDEM_SOURCE -# define _TANDEM_SOURCE 1 -#endif diff --git a/packager/third_party/protobuf/configure.ac b/packager/third_party/protobuf/configure.ac index bdc72ee696..e75bdbaac0 100644 --- a/packager/third_party/protobuf/configure.ac +++ b/packager/third_party/protobuf/configure.ac @@ -4,15 +4,20 @@ AC_PREREQ(2.59) # Note: If you change the version, you must also update it in: -# * java/pom.xml -# * python/setup.py +# * Protobuf.podspec +# * csharp/Google.Protobuf.Tools.nuspec +# * csharp/src/*/AssemblyInfo.cs +# * csharp/src/Google.Protobuf/Google.Protobuf.nuspec +# * java/*/pom.xml +# * python/google/protobuf/__init__.py +# * protoc-artifacts/pom.xml # * src/google/protobuf/stubs/common.h # * src/Makefile.am (Update -version-info for LDFLAGS if needed) # # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.0.0-beta-3],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.3.2],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) @@ -26,7 +31,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_ARG_VAR(DIST_LANG, [language to include in the distribution package (i.e., make dist)]) case "$DIST_LANG" in "") DIST_LANG=all ;; - all | cpp | csharp | java | python | javanano | objectivec | ruby | js) ;; + all | cpp | csharp | java | python | javanano | objectivec | ruby | js | php) ;; *) AC_MSG_FAILURE([unknown language: $DIST_LANG]) ;; esac AC_SUBST(DIST_LANG) @@ -55,6 +60,7 @@ AC_ARG_WITH([protoc], # Checks for programs. AC_PROG_CC AC_PROG_CXX +AC_PROG_CXX_FOR_BUILD AC_LANG([C++]) ACX_USE_SYSTEM_EXTENSIONS m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) @@ -87,6 +93,25 @@ ACX_CHECK_SUNCC # to the link AC_PROG_LIBTOOL +# Check whether the linker supports version scripts +AC_MSG_CHECKING([whether the linker supports version scripts]) +save_LDFLAGS=$LDFLAGS +LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map" +cat > conftest.map < conformance-csharp - @echo 'mono ../csharp/src/Google.Protobuf.Conformance/bin/Release/Google.Protobuf.Conformance.exe "$$@"' >> conformance-csharp + @echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp1.0/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp @chmod +x conformance-csharp +conformance-php: + @echo "Writing shortcut script conformance-php..." + @echo '#! /bin/sh' > conformance-php + @echo 'php -d auto_prepend_file=autoload.php ./conformance_php.php' >> conformance-php + @chmod +x conformance-php + +conformance-php-c: + @echo "Writing shortcut script conformance-php-c..." + @echo '#! /bin/sh' > conformance-php-c + @echo 'php -dextension=../php/ext/google/protobuf/modules/protobuf.so ./conformance_php.php' >> conformance-php-c + @chmod +x conformance-php-c + # Targets for actually running tests. test_cpp: protoc_middleman conformance-test-runner conformance-cpp - ./conformance-test-runner --failure_list failure_list_cpp.txt ./conformance-cpp + ./conformance-test-runner --enforce_recommended --failure_list failure_list_cpp.txt ./conformance-cpp test_java: protoc_middleman conformance-test-runner conformance-java - ./conformance-test-runner --failure_list failure_list_java.txt ./conformance-java + ./conformance-test-runner --enforce_recommended --failure_list failure_list_java.txt ./conformance-java test_java_lite: protoc_middleman conformance-test-runner conformance-java-lite - ./conformance-test-runner ./conformance-java-lite + ./conformance-test-runner --enforce_recommended ./conformance-java-lite test_csharp: protoc_middleman conformance-test-runner conformance-csharp - ./conformance-test-runner --failure_list failure_list_csharp.txt ./conformance-csharp + ./conformance-test-runner --enforce_recommended --failure_list failure_list_csharp.txt ./conformance-csharp test_ruby: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) - RUBYLIB=../ruby/lib:. ./conformance-test-runner --failure_list failure_list_ruby.txt ./conformance_ruby.rb + RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt ./conformance_ruby.rb + +test_php: protoc_middleman conformance-test-runner conformance-php $(other_language_protoc_outputs) + ./conformance-test-runner --enforce_recommended --failure_list failure_list_php.txt ./conformance-php + +test_php_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs) + ./conformance-test-runner --enforce_recommended --failure_list failure_list_php_c.txt ./conformance-php-c + +test_php_zts_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs) + ./conformance-test-runner --enforce_recommended --failure_list failure_list_php_zts_c.txt ./conformance-php-c # These depend on library paths being properly set up. The easiest way to # run them is to just use "tox" from the python dir. test_python: protoc_middleman conformance-test-runner - ./conformance-test-runner --failure_list failure_list_python.txt $(CONFORMANCE_PYTHON_EXTRA_FAILURES) ./conformance_python.py + ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt ./conformance_python.py test_python_cpp: protoc_middleman conformance-test-runner - ./conformance-test-runner --failure_list failure_list_python_cpp.txt $(CONFORMANCE_PYTHON_EXTRA_FAILURES) ./conformance_python.py + ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt ./conformance_python.py + +test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs) + NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js if OBJC_CONFORMANCE_TEST test_objc: protoc_middleman conformance-test-runner conformance-objc - ./conformance-test-runner --failure_list failure_list_objc.txt ./conformance-objc + ./conformance-test-runner --enforce_recommended --failure_list failure_list_objc.txt ./conformance-objc endif diff --git a/packager/third_party/protobuf/conformance/README.md b/packager/third_party/protobuf/conformance/README.md index 9388055fba..971fe8f60d 100644 --- a/packager/third_party/protobuf/conformance/README.md +++ b/packager/third_party/protobuf/conformance/README.md @@ -19,11 +19,39 @@ directory to build `protoc`, since all the tests depend on it. $ make -Then to run the tests against the C++ implementation, run: +Running the tests for C++ +------------------------- + +To run the tests against the C++ implementation, run: $ cd conformance && make test_cpp -More tests and languages will be added soon! +Running the tests for JavaScript (Node.js) +------------------------------------------ + +To run the JavaScript tests against Node.js, make sure you have "node" +on your path and then run: + + $ cd conformance && make test_nodejs + +Running the tests for Ruby (MRI) +-------------------------------- + +To run the Ruby tests against MRI, first build the C extension: + + $ cd ruby && rake + +Then run the tests like so: + + $ cd conformance && make test_ruby + +Running the tests for other languages +------------------------------------- + +Most of the languages in the Protobuf source tree are set up to run +conformance tests. However some of them are more tricky to set up +properly. See `tests.sh` in the base of the repository to see how +Travis runs the tests. Testing other Protocol Buffer implementations --------------------------------------------- diff --git a/packager/third_party/protobuf/conformance/autoload.php b/packager/third_party/protobuf/conformance/autoload.php new file mode 100644 index 0000000000..2cee31c476 --- /dev/null +++ b/packager/third_party/protobuf/conformance/autoload.php @@ -0,0 +1,21 @@ + map_int32_int32 = 56; - map < int64, int64> map_int64_int64 = 57; - map < uint32, uint32> map_uint32_uint32 = 58; - map < uint64, uint64> map_uint64_uint64 = 59; - map < sint32, sint32> map_sint32_sint32 = 60; - map < sint64, sint64> map_sint64_sint64 = 61; - map < fixed32, fixed32> map_fixed32_fixed32 = 62; - map < fixed64, fixed64> map_fixed64_fixed64 = 63; - map map_sfixed32_sfixed32 = 64; - map map_sfixed64_sfixed64 = 65; - map < int32, float> map_int32_float = 66; - map < int32, double> map_int32_double = 67; - map < bool, bool> map_bool_bool = 68; - map < string, string> map_string_string = 69; - map < string, bytes> map_string_bytes = 70; - map < string, NestedMessage> map_string_nested_message = 71; - map < string, ForeignMessage> map_string_foreign_message = 72; - map < string, NestedEnum> map_string_nested_enum = 73; - map < string, ForeignEnum> map_string_foreign_enum = 74; - - oneof oneof_field { - uint32 oneof_uint32 = 111; - NestedMessage oneof_nested_message = 112; - string oneof_string = 113; - bytes oneof_bytes = 114; - } - - // Well-known types - google.protobuf.BoolValue optional_bool_wrapper = 201; - google.protobuf.Int32Value optional_int32_wrapper = 202; - google.protobuf.Int64Value optional_int64_wrapper = 203; - google.protobuf.UInt32Value optional_uint32_wrapper = 204; - google.protobuf.UInt64Value optional_uint64_wrapper = 205; - google.protobuf.FloatValue optional_float_wrapper = 206; - google.protobuf.DoubleValue optional_double_wrapper = 207; - google.protobuf.StringValue optional_string_wrapper = 208; - google.protobuf.BytesValue optional_bytes_wrapper = 209; - - repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; - repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; - repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; - repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; - repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; - repeated google.protobuf.FloatValue repeated_float_wrapper = 216; - repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; - repeated google.protobuf.StringValue repeated_string_wrapper = 218; - repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; - - google.protobuf.Duration optional_duration = 301; - google.protobuf.Timestamp optional_timestamp = 302; - google.protobuf.FieldMask optional_field_mask = 303; - google.protobuf.Struct optional_struct = 304; - google.protobuf.Any optional_any = 305; - google.protobuf.Value optional_value = 306; - - repeated google.protobuf.Duration repeated_duration = 311; - repeated google.protobuf.Timestamp repeated_timestamp = 312; - repeated google.protobuf.FieldMask repeated_fieldmask = 313; - repeated google.protobuf.Struct repeated_struct = 324; - repeated google.protobuf.Any repeated_any = 315; - repeated google.protobuf.Value repeated_value = 316; - - // Test field-name-to-JSON-name convention. - int32 fieldname1 = 401; - int32 field_name2 = 402; - int32 _field_name3 = 403; - int32 field__name4_ = 404; - int32 field0name5 = 405; - int32 field_0_name6 = 406; - int32 fieldName7 = 407; - int32 FieldName8 = 408; - int32 field_Name9 = 409; - int32 Field_Name10 = 410; - int32 FIELD_NAME11 = 411; - int32 FIELD_name12 = 412; -} - -message ForeignMessage { - int32 c = 1; -} - -enum ForeignEnum { - FOREIGN_FOO = 0; - FOREIGN_BAR = 1; - FOREIGN_BAZ = 2; -} diff --git a/packager/third_party/protobuf/conformance/conformance_cpp.cc b/packager/third_party/protobuf/conformance/conformance_cpp.cc index 1a26549325..b865cd93ed 100644 --- a/packager/third_party/protobuf/conformance/conformance_cpp.cc +++ b/packager/third_party/protobuf/conformance/conformance_cpp.cc @@ -33,12 +33,12 @@ #include #include "conformance.pb.h" +#include #include #include using conformance::ConformanceRequest; using conformance::ConformanceResponse; -using conformance::TestAllTypes; using google::protobuf::Descriptor; using google::protobuf::DescriptorPool; using google::protobuf::internal::scoped_ptr; @@ -47,6 +47,7 @@ using google::protobuf::util::JsonToBinaryString; using google::protobuf::util::NewTypeResolverForDescriptorPool; using google::protobuf::util::Status; using google::protobuf::util::TypeResolver; +using protobuf_test_messages::proto3::TestAllTypes; using std::string; static const char kTypeUrlPrefix[] = "type.googleapis.com"; diff --git a/packager/third_party/protobuf/conformance/conformance_nodejs.js b/packager/third_party/protobuf/conformance/conformance_nodejs.js new file mode 100755 index 0000000000..5ee3726994 --- /dev/null +++ b/packager/third_party/protobuf/conformance/conformance_nodejs.js @@ -0,0 +1,168 @@ +#!/usr/bin/env node + +/* + * Protocol Buffers - Google's data interchange format + * Copyright 2008 Google Inc. All rights reserved. + * https://developers.google.com/protocol-buffers/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var conformance = require('conformance_pb'); +var test_messages_proto3 = require('google/protobuf/test_messages_proto3_pb'); +var fs = require('fs'); + +var testCount = 0; + +function doTest(request) { + var testMessage; + var response = new conformance.ConformanceResponse(); + + try { + if (request.getRequestedOutputFormat() === conformance.WireFormat.JSON) { + response.setSkipped("JSON not supported."); + return response; + } + + switch (request.getPayloadCase()) { + case conformance.ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD: + try { + testMessage = test_messages_proto3.TestAllTypes.deserializeBinary( + request.getProtobufPayload()); + } catch (err) { + response.setParseError(err.toString()); + return response; + } + + case conformance.ConformanceRequest.PayloadCase.JSON_PAYLOAD: + response.setSkipped("JSON not supported."); + return response; + + case conformance.ConformanceRequest.PayloadCase.PAYLOAD_NOT_SET: + response.setRuntimeError("Request didn't have payload"); + return response; + } + + switch (request.getRequestedOutputFormat()) { + case conformance.WireFormat.UNSPECIFIED: + response.setRuntimeError("Unspecified output format"); + return response; + + case conformance.WireFormat.PROTOBUF: + response.setProtobufPayload(testMessage.serializeBinary()); + + case conformance.WireFormat.JSON: + response.setSkipped("JSON not supported."); + return response; + + default: + throw "Request didn't have requested output format"; + } + } catch (err) { + response.setRuntimeError(err.toString()); + } + + return response; +} + +function onEof(totalRead) { + if (totalRead == 0) { + return undefined; + } else { + throw "conformance_nodejs: premature EOF on stdin."; + } +} + +// Utility function to read a buffer of N bytes. +function readBuffer(bytes) { + var buf = new Buffer(bytes); + var totalRead = 0; + while (totalRead < bytes) { + var read = 0; + try { + read = fs.readSync(process.stdin.fd, buf, totalRead, bytes - totalRead); + } catch (e) { + if (e.code == 'EOF') { + return onEof(totalRead) + } else if (e.code == 'EAGAIN') { + } else { + throw "conformance_nodejs: Error reading from stdin." + e; + } + } + + totalRead += read; + } + + return buf; +} + +function writeBuffer(buffer) { + var totalWritten = 0; + while (totalWritten < buffer.length) { + totalWritten += fs.writeSync( + process.stdout.fd, buffer, totalWritten, buffer.length - totalWritten); + } +} + +// Returns true if the test ran successfully, false on legitimate EOF. +// If EOF is encountered in an unexpected place, raises IOError. +function doTestIo() { + var lengthBuf = readBuffer(4); + if (!lengthBuf) { + return false; + } + + var length = lengthBuf.readInt32LE(0); + var serializedRequest = readBuffer(length); + if (!serializedRequest) { + throw "conformance_nodejs: Failed to read request."; + } + + serializedRequest = new Uint8Array(serializedRequest); + var request = + conformance.ConformanceRequest.deserializeBinary(serializedRequest); + var response = doTest(request); + + var serializedResponse = response.serializeBinary(); + + lengthBuf = new Buffer(4); + lengthBuf.writeInt32LE(serializedResponse.length, 0); + writeBuffer(lengthBuf); + writeBuffer(new Buffer(serializedResponse)); + + testCount += 1 + + return true; +} + +while (true) { + if (!doTestIo()) { + console.error('conformance_nodejs: received EOF from test runner ' + + "after " + testCount + " tests, exiting") + break; + } +} diff --git a/packager/third_party/protobuf/conformance/conformance_objc.m b/packager/third_party/protobuf/conformance/conformance_objc.m index 1124bfeba1..ef037f8496 100644 --- a/packager/third_party/protobuf/conformance/conformance_objc.m +++ b/packager/third_party/protobuf/conformance/conformance_objc.m @@ -31,6 +31,7 @@ #import #import "Conformance.pbobjc.h" +#import "google/protobuf/TestMessagesProto3.pbobjc.h" static void Die(NSString *format, ...) __dead2; diff --git a/packager/third_party/protobuf/conformance/conformance_php.php b/packager/third_party/protobuf/conformance/conformance_php.php new file mode 100755 index 0000000000..d5e912582e --- /dev/null +++ b/packager/third_party/protobuf/conformance/conformance_php.php @@ -0,0 +1,113 @@ +getPayload() == "protobuf_payload") { + try { + $test_message->mergeFromString($request->getProtobufPayload()); + } catch (Exception $e) { + $response->setParseError($e->getMessage()); + return $response; + } + } elseif ($request->getPayload() == "json_payload") { + try { + $test_message->mergeFromJsonString($request->getJsonPayload()); + } catch (Exception $e) { + $response->setParseError($e->getMessage()); + return $response; + } + } else { + trigger_error("Request didn't have payload.", E_USER_ERROR); + } + + if ($request->getRequestedOutputFormat() == WireFormat::UNSPECIFIED) { + trigger_error("Unspecified output format.", E_USER_ERROR); + } elseif ($request->getRequestedOutputFormat() == WireFormat::PROTOBUF) { + $response->setProtobufPayload($test_message->serializeToString()); + } elseif ($request->getRequestedOutputFormat() == WireFormat::JSON) { + $response->setJsonPayload($test_message->serializeToJsonString()); + } + + return $response; +} + +function doTestIO() +{ + $length_bytes = fread(STDIN, 4); + if (strlen($length_bytes) == 0) { + return false; # EOF + } elseif (strlen($length_bytes) != 4) { + fwrite(STDERR, "I/O error\n"); + return false; + } + + $length = unpack("V", $length_bytes)[1]; + $serialized_request = fread(STDIN, $length); + if (strlen($serialized_request) != $length) { + trigger_error("I/O error", E_USER_ERROR); + } + + $request = new \Conformance\ConformanceRequest(); + $request->mergeFromString($serialized_request); + + $response = doTest($request); + + $serialized_response = $response->serializeToString(); + fwrite(STDOUT, pack("V", strlen($serialized_response))); + fwrite(STDOUT, $serialized_response); + + $GLOBALS['test_count'] += 1; + + return true; +} + +while(true){ + if (!doTestIO()) { + fprintf(STDERR, + "conformance_php: received EOF from test runner " + + "after %d tests, exiting\n", $test_count); + exit; + } +} diff --git a/packager/third_party/protobuf/conformance/conformance_python.py b/packager/third_party/protobuf/conformance/conformance_python.py index a490c8e8e5..7ace9b1672 100755 --- a/packager/third_party/protobuf/conformance/conformance_python.py +++ b/packager/third_party/protobuf/conformance/conformance_python.py @@ -38,8 +38,9 @@ See conformance.proto for more information. import struct import sys import os -from google.protobuf import message from google.protobuf import json_format +from google.protobuf import message +from google.protobuf import test_messages_proto3_pb2 import conformance_pb2 sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0) @@ -52,9 +53,9 @@ class ProtocolError(Exception): pass def do_test(request): - test_message = conformance_pb2.TestAllTypes() + test_message = test_messages_proto3_pb2.TestAllTypes() response = conformance_pb2.ConformanceResponse() - test_message = conformance_pb2.TestAllTypes() + test_message = test_messages_proto3_pb2.TestAllTypes() try: if request.WhichOneof('payload') == 'protobuf_payload': @@ -67,7 +68,7 @@ def do_test(request): elif request.WhichOneof('payload') == 'json_payload': try: json_format.Parse(request.json_payload, test_message) - except json_format.ParseError as e: + except Exception as e: response.parse_error = str(e) return response @@ -81,7 +82,11 @@ def do_test(request): response.protobuf_payload = test_message.SerializeToString() elif request.requested_output_format == conformance_pb2.JSON: - response.json_payload = json_format.MessageToJson(test_message) + try: + response.json_payload = json_format.MessageToJson(test_message) + except Exception as e: + response.serialize_error = str(e) + return response except Exception as e: response.runtime_error = str(e) diff --git a/packager/third_party/protobuf/conformance/conformance_ruby.rb b/packager/third_party/protobuf/conformance/conformance_ruby.rb index c716facdd6..b7b7cf1c6c 100755 --- a/packager/third_party/protobuf/conformance/conformance_ruby.rb +++ b/packager/third_party/protobuf/conformance/conformance_ruby.rb @@ -30,21 +30,22 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -require 'conformance' +require 'conformance_pb' +require 'google/protobuf/test_messages_proto3_pb' $test_count = 0 $verbose = false def do_test(request) - test_message = Conformance::TestAllTypes.new + test_message = ProtobufTestMessages::Proto3::TestAllTypes.new response = Conformance::ConformanceResponse.new begin case request.payload when :protobuf_payload begin - test_message = - Conformance::TestAllTypes.decode(request.protobuf_payload) + test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode( + request.protobuf_payload) rescue Google::Protobuf::ParseError => err response.parse_error = err.message.encode('utf-8') return response @@ -52,7 +53,8 @@ def do_test(request) when :json_payload begin - test_message = Conformance::TestAllTypes.decode_json(request.json_payload) + test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode_json( + request.json_payload) rescue Google::Protobuf::ParseError => err response.parse_error = err.message.encode('utf-8') return response diff --git a/packager/third_party/protobuf/conformance/conformance_test.cc b/packager/third_party/protobuf/conformance/conformance_test.cc index fc0605bfc4..8fa9f53c4b 100644 --- a/packager/third_party/protobuf/conformance/conformance_test.cc +++ b/packager/third_party/protobuf/conformance/conformance_test.cc @@ -30,14 +30,17 @@ #include #include +#include #include "conformance.pb.h" #include "conformance_test.h" +#include + #include #include #include -#include #include +#include #include #include #include @@ -46,7 +49,6 @@ using conformance::ConformanceRequest; using conformance::ConformanceResponse; -using conformance::TestAllTypes; using conformance::WireFormat; using google::protobuf::Descriptor; using google::protobuf::FieldDescriptor; @@ -57,6 +59,7 @@ using google::protobuf::util::JsonToBinaryString; using google::protobuf::util::MessageDifferencer; using google::protobuf::util::NewTypeResolverForDescriptorPool; using google::protobuf::util::Status; +using protobuf_test_messages::proto3::TestAllTypes; using std::string; namespace { @@ -106,13 +109,18 @@ string cat(const string& a, const string& b, // The maximum number of bytes that it takes to encode a 64-bit varint. #define VARINT_MAX_LEN 10 -size_t vencode64(uint64_t val, char *buf) { +size_t vencode64(uint64_t val, int over_encoded_bytes, char *buf) { if (val == 0) { buf[0] = 0; return 1; } size_t i = 0; while (val) { uint8_t byte = val & 0x7fU; val >>= 7; - if (val) byte |= 0x80U; + if (val || over_encoded_bytes) byte |= 0x80U; + buf[i++] = byte; + } + while (over_encoded_bytes--) { + assert(i < 10); + uint8_t byte = over_encoded_bytes ? 0x80 : 0; buf[i++] = byte; } return i; @@ -120,7 +128,15 @@ size_t vencode64(uint64_t val, char *buf) { string varint(uint64_t x) { char buf[VARINT_MAX_LEN]; - size_t len = vencode64(x, buf); + size_t len = vencode64(x, 0, buf); + return string(buf, len); +} + +// Encodes a varint that is |extra| bytes longer than it needs to be, but still +// valid. +string longvarint(uint64_t x, int extra) { + char buf[VARINT_MAX_LEN]; + size_t len = vencode64(x, extra, buf); return string(buf, len); } @@ -129,8 +145,8 @@ string fixed32(void *data) { return string(static_cast(data), 4); } string fixed64(void *data) { return string(static_cast(data), 8); } string delim(const string& buf) { return cat(varint(buf.size()), buf); } -string uint32(uint32_t u32) { return fixed32(&u32); } -string uint64(uint64_t u64) { return fixed64(&u64); } +string u32(uint32_t u32) { return fixed32(&u32); } +string u64(uint64_t u64) { return fixed64(&u64); } string flt(float f) { return fixed32(&f); } string dbl(double d) { return fixed64(&d); } string zz32(int32_t x) { return varint(WireFormatLite::ZigZagEncode32(x)); } @@ -146,16 +162,17 @@ string submsg(uint32_t fn, const string& buf) { #define UNKNOWN_FIELD 666 -uint32_t GetFieldNumberForType(FieldDescriptor::Type type, bool repeated) { +const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type, + bool repeated) { const Descriptor* d = TestAllTypes().GetDescriptor(); for (int i = 0; i < d->field_count(); i++) { const FieldDescriptor* f = d->field(i); if (f->type() == type && f->is_repeated() == repeated) { - return f->number(); + return f; } } GOOGLE_LOG(FATAL) << "Couldn't find field with type " << (int)type; - return 0; + return nullptr; } string UpperCase(string str) { @@ -182,6 +199,7 @@ void ConformanceTestSuite::ReportSuccess(const string& test_name) { } void ConformanceTestSuite::ReportFailure(const string& test_name, + ConformanceLevel level, const ConformanceRequest& request, const ConformanceResponse& response, const char* fmt, ...) { @@ -189,6 +207,8 @@ void ConformanceTestSuite::ReportFailure(const string& test_name, expected_failures_++; if (!verbose_) return; + } else if (level == RECOMMENDED && !enforce_recommended_) { + StringAppendF(&output_, "WARNING, test=%s: ", test_name.c_str()); } else { StringAppendF(&output_, "ERROR, test=%s: ", test_name.c_str()); unexpected_failing_tests_.insert(test_name); @@ -213,6 +233,15 @@ void ConformanceTestSuite::ReportSkip(const string& test_name, skipped_.insert(test_name); } +string ConformanceTestSuite::ConformanceLevelToString(ConformanceLevel level) { + switch (level) { + case REQUIRED: return "Required"; + case RECOMMENDED: return "Recommended"; + } + GOOGLE_LOG(FATAL) << "Unknown value: " << level; + return ""; +} + void ConformanceTestSuite::RunTest(const string& test_name, const ConformanceRequest& request, ConformanceResponse* response) { @@ -240,8 +269,9 @@ void ConformanceTestSuite::RunTest(const string& test_name, } void ConformanceTestSuite::RunValidInputTest( - const string& test_name, const string& input, WireFormat input_format, - const string& equivalent_text_format, WireFormat requested_output) { + const string& test_name, ConformanceLevel level, const string& input, + WireFormat input_format, const string& equivalent_text_format, + WireFormat requested_output) { TestAllTypes reference_message; GOOGLE_CHECK( TextFormat::ParseFromString(equivalent_text_format, &reference_message)) @@ -271,11 +301,16 @@ void ConformanceTestSuite::RunValidInputTest( TestAllTypes test_message; switch (response.result_case()) { + case ConformanceResponse::RESULT_NOT_SET: + ReportFailure(test_name, level, request, response, + "Response didn't have any field in the Response."); + return; + case ConformanceResponse::kParseError: case ConformanceResponse::kRuntimeError: case ConformanceResponse::kSerializeError: - ReportFailure(test_name, request, response, - "Failed to parse JSON input or produce JSON output."); + ReportFailure(test_name, level, request, response, + "Failed to parse input or produce output."); return; case ConformanceResponse::kSkipped: @@ -285,7 +320,7 @@ void ConformanceTestSuite::RunValidInputTest( case ConformanceResponse::kJsonPayload: { if (requested_output != conformance::JSON) { ReportFailure( - test_name, request, response, + test_name, level, request, response, "Test was asked for protobuf output but provided JSON instead."); return; } @@ -294,13 +329,13 @@ void ConformanceTestSuite::RunValidInputTest( JsonToBinaryString(type_resolver_.get(), type_url_, response.json_payload(), &binary_protobuf); if (!status.ok()) { - ReportFailure(test_name, request, response, + ReportFailure(test_name, level, request, response, "JSON output we received from test was unparseable."); return; } if (!test_message.ParseFromString(binary_protobuf)) { - ReportFailure(test_name, request, response, + ReportFailure(test_name, level, request, response, "INTERNAL ERROR: internal JSON->protobuf transcode " "yielded unparseable proto."); return; @@ -312,13 +347,13 @@ void ConformanceTestSuite::RunValidInputTest( case ConformanceResponse::kProtobufPayload: { if (requested_output != conformance::PROTOBUF) { ReportFailure( - test_name, request, response, + test_name, level, request, response, "Test was asked for JSON output but provided protobuf instead."); return; } if (!test_message.ParseFromString(response.protobuf_payload())) { - ReportFailure(test_name, request, response, + ReportFailure(test_name, level, request, response, "Protobuf output we received from test was unparseable."); return; } @@ -341,7 +376,7 @@ void ConformanceTestSuite::RunValidInputTest( if (differencer.Compare(reference_message, test_message)) { ReportSuccess(test_name); } else { - ReportFailure(test_name, request, response, + ReportFailure(test_name, level, request, response, "Output was not equivalent to reference message: %s.", differences.c_str()); } @@ -349,11 +384,12 @@ void ConformanceTestSuite::RunValidInputTest( // Expect that this precise protobuf will cause a parse error. void ConformanceTestSuite::ExpectParseFailureForProto( - const string& proto, const string& test_name) { + const string& proto, const string& test_name, ConformanceLevel level) { ConformanceRequest request; ConformanceResponse response; request.set_protobuf_payload(proto); - string effective_test_name = "ProtobufInput." + test_name; + string effective_test_name = ConformanceLevelToString(level) + + ".ProtobufInput." + test_name; // We don't expect output, but if the program erroneously accepts the protobuf // we let it send its response as this. We must not leave it unspecified. @@ -365,7 +401,7 @@ void ConformanceTestSuite::ExpectParseFailureForProto( } else if (response.result_case() == ConformanceResponse::kSkipped) { ReportSkip(effective_test_name, request, response); } else { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Should have failed to parse, but didn't."); } } @@ -376,27 +412,49 @@ void ConformanceTestSuite::ExpectParseFailureForProto( // // TODO(haberman): implement the second of these. void ConformanceTestSuite::ExpectHardParseFailureForProto( - const string& proto, const string& test_name) { - return ExpectParseFailureForProto(proto, test_name); + const string& proto, const string& test_name, ConformanceLevel level) { + return ExpectParseFailureForProto(proto, test_name, level); } void ConformanceTestSuite::RunValidJsonTest( - const string& test_name, const string& input_json, + const string& test_name, ConformanceLevel level, const string& input_json, const string& equivalent_text_format) { - RunValidInputTest("JsonInput." + test_name + ".ProtobufOutput", input_json, - conformance::JSON, equivalent_text_format, - conformance::PROTOBUF); - RunValidInputTest("JsonInput." + test_name + ".JsonOutput", input_json, - conformance::JSON, equivalent_text_format, - conformance::JSON); + RunValidInputTest( + ConformanceLevelToString(level) + ".JsonInput." + test_name + + ".ProtobufOutput", level, input_json, conformance::JSON, + equivalent_text_format, conformance::PROTOBUF); + RunValidInputTest( + ConformanceLevelToString(level) + ".JsonInput." + test_name + + ".JsonOutput", level, input_json, conformance::JSON, + equivalent_text_format, conformance::JSON); } void ConformanceTestSuite::RunValidJsonTestWithProtobufInput( - const string& test_name, const TestAllTypes& input, + const string& test_name, ConformanceLevel level, const TestAllTypes& input, const string& equivalent_text_format) { - RunValidInputTest("ProtobufInput." + test_name + ".JsonOutput", - input.SerializeAsString(), conformance::PROTOBUF, - equivalent_text_format, conformance::JSON); + RunValidInputTest( + ConformanceLevelToString(level) + ".ProtobufInput." + test_name + + ".JsonOutput", level, input.SerializeAsString(), conformance::PROTOBUF, + equivalent_text_format, conformance::JSON); +} + +void ConformanceTestSuite::RunValidProtobufTest( + const string& test_name, ConformanceLevel level, + const string& input_protobuf, const string& equivalent_text_format) { + RunValidInputTest( + ConformanceLevelToString(level) + ".ProtobufInput." + test_name + + ".ProtobufOutput", level, input_protobuf, conformance::PROTOBUF, + equivalent_text_format, conformance::PROTOBUF); + RunValidInputTest( + ConformanceLevelToString(level) + ".ProtobufInput." + test_name + + ".JsonOutput", level, input_protobuf, conformance::PROTOBUF, + equivalent_text_format, conformance::JSON); +} + +void ConformanceTestSuite::RunValidProtobufTestWithMessage( + const string& test_name, ConformanceLevel level, const TestAllTypes& input, + const string& equivalent_text_format) { + RunValidProtobufTest(test_name, level, input.SerializeAsString(), equivalent_text_format); } // According to proto3 JSON specification, JSON serializers follow more strict @@ -405,14 +463,15 @@ void ConformanceTestSuite::RunValidJsonTestWithProtobufInput( // method allows strict checking on a proto3 JSON serializer by inspecting // the JSON output directly. void ConformanceTestSuite::RunValidJsonTestWithValidator( - const string& test_name, const string& input_json, + const string& test_name, ConformanceLevel level, const string& input_json, const Validator& validator) { ConformanceRequest request; ConformanceResponse response; request.set_json_payload(input_json); request.set_requested_output_format(conformance::JSON); - string effective_test_name = "JsonInput." + test_name + ".Validator"; + string effective_test_name = ConformanceLevelToString(level) + + ".JsonInput." + test_name + ".Validator"; RunTest(effective_test_name, request, &response); @@ -422,7 +481,7 @@ void ConformanceTestSuite::RunValidJsonTestWithValidator( } if (response.result_case() != ConformanceResponse::kJsonPayload) { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Expected JSON payload but got type %d.", response.result_case()); return; @@ -430,13 +489,13 @@ void ConformanceTestSuite::RunValidJsonTestWithValidator( Json::Reader reader; Json::Value value; if (!reader.parse(response.json_payload(), value)) { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "JSON payload cannot be parsed as valid JSON: %s", reader.getFormattedErrorMessages().c_str()); return; } if (!validator(value)) { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "JSON payload validation failed."); return; } @@ -444,11 +503,12 @@ void ConformanceTestSuite::RunValidJsonTestWithValidator( } void ConformanceTestSuite::ExpectParseFailureForJson( - const string& test_name, const string& input_json) { + const string& test_name, ConformanceLevel level, const string& input_json) { ConformanceRequest request; ConformanceResponse response; request.set_json_payload(input_json); - string effective_test_name = "JsonInput." + test_name; + string effective_test_name = + ConformanceLevelToString(level) + ".JsonInput." + test_name; // We don't expect output, but if the program erroneously accepts the protobuf // we let it send its response as this. We must not leave it unspecified. @@ -460,13 +520,13 @@ void ConformanceTestSuite::ExpectParseFailureForJson( } else if (response.result_case() == ConformanceResponse::kSkipped) { ReportSkip(effective_test_name, request, response); } else { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Should have failed to parse, but didn't."); } } void ConformanceTestSuite::ExpectSerializeFailureForJson( - const string& test_name, const string& text_format) { + const string& test_name, ConformanceLevel level, const string& text_format) { TestAllTypes payload_message; GOOGLE_CHECK( TextFormat::ParseFromString(text_format, &payload_message)) @@ -475,7 +535,8 @@ void ConformanceTestSuite::ExpectSerializeFailureForJson( ConformanceRequest request; ConformanceResponse response; request.set_protobuf_payload(payload_message.SerializeAsString()); - string effective_test_name = test_name + ".JsonOutput"; + string effective_test_name = + ConformanceLevelToString(level) + "." + test_name + ".JsonOutput"; request.set_requested_output_format(conformance::JSON); RunTest(effective_test_name, request, &response); @@ -484,7 +545,7 @@ void ConformanceTestSuite::ExpectSerializeFailureForJson( } else if (response.result_case() == ConformanceResponse::kSkipped) { ReportSkip(effective_test_name, request, response); } else { - ReportFailure(effective_test_name, request, response, + ReportFailure(effective_test_name, level, request, response, "Should have failed to serialize, but didn't."); } } @@ -500,8 +561,8 @@ void ConformanceTestSuite::TestPrematureEOFForType(FieldDescriptor::Type type) { string("abc") // 32BIT }; - uint32_t fieldnum = GetFieldNumberForType(type, false); - uint32_t rep_fieldnum = GetFieldNumberForType(type, true); + const FieldDescriptor* field = GetFieldForType(type, false); + const FieldDescriptor* rep_field = GetFieldForType(type, true); WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( static_cast(type)); const string& incomplete = incompletes[wire_type]; @@ -509,42 +570,44 @@ void ConformanceTestSuite::TestPrematureEOFForType(FieldDescriptor::Type type) { UpperCase(string(".") + FieldDescriptor::TypeName(type)); ExpectParseFailureForProto( - tag(fieldnum, wire_type), - "PrematureEofBeforeKnownNonRepeatedValue" + type_name); + tag(field->number(), wire_type), + "PrematureEofBeforeKnownNonRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( - tag(rep_fieldnum, wire_type), - "PrematureEofBeforeKnownRepeatedValue" + type_name); + tag(rep_field->number(), wire_type), + "PrematureEofBeforeKnownRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( tag(UNKNOWN_FIELD, wire_type), - "PrematureEofBeforeUnknownValue" + type_name); + "PrematureEofBeforeUnknownValue" + type_name, REQUIRED); ExpectParseFailureForProto( - cat( tag(fieldnum, wire_type), incomplete ), - "PrematureEofInsideKnownNonRepeatedValue" + type_name); + cat( tag(field->number(), wire_type), incomplete ), + "PrematureEofInsideKnownNonRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( - cat( tag(rep_fieldnum, wire_type), incomplete ), - "PrematureEofInsideKnownRepeatedValue" + type_name); + cat( tag(rep_field->number(), wire_type), incomplete ), + "PrematureEofInsideKnownRepeatedValue" + type_name, REQUIRED); ExpectParseFailureForProto( cat( tag(UNKNOWN_FIELD, wire_type), incomplete ), - "PrematureEofInsideUnknownValue" + type_name); + "PrematureEofInsideUnknownValue" + type_name, REQUIRED); if (wire_type == WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { ExpectParseFailureForProto( - cat( tag(fieldnum, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForKnownNonRepeatedValue" + type_name); + cat( tag(field->number(), wire_type), varint(1) ), + "PrematureEofInDelimitedDataForKnownNonRepeatedValue" + type_name, + REQUIRED); ExpectParseFailureForProto( - cat( tag(rep_fieldnum, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForKnownRepeatedValue" + type_name); + cat( tag(rep_field->number(), wire_type), varint(1) ), + "PrematureEofInDelimitedDataForKnownRepeatedValue" + type_name, + REQUIRED); // EOF in the middle of delimited data for unknown value. ExpectParseFailureForProto( cat( tag(UNKNOWN_FIELD, wire_type), varint(1) ), - "PrematureEofInDelimitedDataForUnknownValue" + type_name); + "PrematureEofInDelimitedDataForUnknownValue" + type_name, REQUIRED); if (type == FieldDescriptor::TYPE_MESSAGE) { // Submessage ends in the middle of a value. @@ -552,51 +615,114 @@ void ConformanceTestSuite::TestPrematureEOFForType(FieldDescriptor::Type type) { cat( tag(WireFormatLite::TYPE_INT32, WireFormatLite::WIRETYPE_VARINT), incompletes[WireFormatLite::WIRETYPE_VARINT] ); ExpectHardParseFailureForProto( - cat( tag(fieldnum, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + cat( tag(field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), varint(incomplete_submsg.size()), incomplete_submsg ), - "PrematureEofInSubmessageValue" + type_name); + "PrematureEofInSubmessageValue" + type_name, REQUIRED); } } else if (type != FieldDescriptor::TYPE_GROUP) { // Non-delimited, non-group: eligible for packing. // Packed region ends in the middle of a value. ExpectHardParseFailureForProto( - cat( tag(rep_fieldnum, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - varint(incomplete.size()), - incomplete ), - "PrematureEofInPackedFieldValue" + type_name); + cat(tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + varint(incomplete.size()), incomplete), + "PrematureEofInPackedFieldValue" + type_name, REQUIRED); // EOF in the middle of packed region. ExpectParseFailureForProto( - cat( tag(rep_fieldnum, WireFormatLite::WIRETYPE_LENGTH_DELIMITED), - varint(1) ), - "PrematureEofInPackedField" + type_name); + cat(tag(rep_field->number(), WireFormatLite::WIRETYPE_LENGTH_DELIMITED), + varint(1)), + "PrematureEofInPackedField" + type_name, REQUIRED); } } -void ConformanceTestSuite::SetFailureList(const vector& failure_list) { +void ConformanceTestSuite::TestValidDataForType( + FieldDescriptor::Type type, + std::vector> values) { + const string type_name = + UpperCase(string(".") + FieldDescriptor::TypeName(type)); + WireFormatLite::WireType wire_type = WireFormatLite::WireTypeForFieldType( + static_cast(type)); + const FieldDescriptor* field = GetFieldForType(type, false); + const FieldDescriptor* rep_field = GetFieldForType(type, true); + + RunValidProtobufTest("ValidDataScalar" + type_name, REQUIRED, + cat(tag(field->number(), wire_type), values[0].first), + field->name() + ": " + values[0].second); + + string proto; + string text = field->name() + ": " + values.back().second; + for (size_t i = 0; i < values.size(); i++) { + proto += cat(tag(field->number(), wire_type), values[i].first); + } + RunValidProtobufTest("RepeatedScalarSelectsLast" + type_name, REQUIRED, + proto, text); + + proto.clear(); + text.clear(); + + for (size_t i = 0; i < values.size(); i++) { + proto += cat(tag(rep_field->number(), wire_type), values[i].first); + text += rep_field->name() + ": " + values[i].second + " "; + } + RunValidProtobufTest("ValidDataRepeated" + type_name, REQUIRED, proto, text); +} + +void ConformanceTestSuite::SetFailureList(const string& filename, + const vector& failure_list) { + failure_list_filename_ = filename; expected_to_fail_.clear(); std::copy(failure_list.begin(), failure_list.end(), std::inserter(expected_to_fail_, expected_to_fail_.end())); } -bool ConformanceTestSuite::CheckSetEmpty(const set& set_to_check, - const char* msg) { +bool ConformanceTestSuite::CheckSetEmpty(const std::set& set_to_check, + const std::string& write_to_file, + const std::string& msg) { if (set_to_check.empty()) { return true; } else { StringAppendF(&output_, "\n"); - StringAppendF(&output_, "%s:\n", msg); - for (set::const_iterator iter = set_to_check.begin(); + StringAppendF(&output_, "%s\n\n", msg.c_str()); + for (std::set::const_iterator iter = set_to_check.begin(); iter != set_to_check.end(); ++iter) { StringAppendF(&output_, " %s\n", iter->c_str()); } StringAppendF(&output_, "\n"); + + if (!write_to_file.empty()) { + std::ofstream os(write_to_file); + if (os) { + for (std::set::const_iterator iter = set_to_check.begin(); + iter != set_to_check.end(); ++iter) { + os << *iter << "\n"; + } + } else { + StringAppendF(&output_, "Failed to open file: %s\n", + write_to_file.c_str()); + } + } + return false; } } +void ConformanceTestSuite::TestIllegalTags() { + // field num 0 is illegal + string nullfield[] = { + "\1DEADBEEF", + "\2\1\1", + "\3\4", + "\5DEAD" + }; + for (int i = 0; i < 4; i++) { + string name = "IllegalZeroFieldNum_Case_0"; + name.back() += i; + ExpectParseFailureForProto(nullfield[i], name, REQUIRED); + } +} + bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, std::string* output) { runner_ = runner; @@ -617,24 +743,122 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, TestPrematureEOFForType(static_cast(i)); } - RunValidJsonTest("HelloWorld", "{\"optionalString\":\"Hello, World!\"}", + TestIllegalTags(); + + int64 kInt64Min = -9223372036854775808ULL; + int64 kInt64Max = 9223372036854775807ULL; + uint64 kUint64Max = 18446744073709551615ULL; + int32 kInt32Max = 2147483647; + int32 kInt32Min = -2147483648; + uint32 kUint32Max = 4294967295UL; + + TestValidDataForType(FieldDescriptor::TYPE_DOUBLE, { + {dbl(0.1), "0.1"}, + {dbl(1.7976931348623157e+308), "1.7976931348623157e+308"}, + {dbl(2.22507385850720138309e-308), "2.22507385850720138309e-308"} + }); + TestValidDataForType(FieldDescriptor::TYPE_FLOAT, { + {flt(0.1), "0.1"}, + {flt(1.00000075e-36), "1.00000075e-36"}, + {flt(3.402823e+38), "3.402823e+38"}, // 3.40282347e+38 + {flt(1.17549435e-38f), "1.17549435e-38"} + }); + TestValidDataForType(FieldDescriptor::TYPE_INT64, { + {varint(12345), "12345"}, + {varint(kInt64Max), std::to_string(kInt64Max)}, + {varint(kInt64Min), std::to_string(kInt64Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_UINT64, { + {varint(12345), "12345"}, + {varint(kUint64Max), std::to_string(kUint64Max)}, + {varint(0), "0"} + }); + TestValidDataForType(FieldDescriptor::TYPE_INT32, { + {varint(12345), "12345"}, + {longvarint(12345, 2), "12345"}, + {longvarint(12345, 7), "12345"}, + {varint(kInt32Max), std::to_string(kInt32Max)}, + {varint(kInt32Min), std::to_string(kInt32Min)}, + {varint(1LL << 33), std::to_string(static_cast(1LL << 33))}, + {varint((1LL << 33) - 1), + std::to_string(static_cast((1LL << 33) - 1))}, + }); + TestValidDataForType(FieldDescriptor::TYPE_UINT32, { + {varint(12345), "12345"}, + {longvarint(12345, 2), "12345"}, + {longvarint(12345, 7), "12345"}, + {varint(kUint32Max), std::to_string(kUint32Max)}, // UINT32_MAX + {varint(0), "0"}, + {varint(1LL << 33), std::to_string(static_cast(1LL << 33))}, + {varint((1LL << 33) - 1), + std::to_string(static_cast((1LL << 33) - 1))}, + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED64, { + {u64(12345), "12345"}, + {u64(kUint64Max), std::to_string(kUint64Max)}, + {u64(0), "0"} + }); + TestValidDataForType(FieldDescriptor::TYPE_FIXED32, { + {u32(12345), "12345"}, + {u32(kUint32Max), std::to_string(kUint32Max)}, // UINT32_MAX + {u32(0), "0"} + }); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED64, { + {u64(12345), "12345"}, + {u64(kInt64Max), std::to_string(kInt64Max)}, + {u64(kInt64Min), std::to_string(kInt64Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_SFIXED32, { + {u32(12345), "12345"}, + {u32(kInt32Max), std::to_string(kInt32Max)}, + {u32(kInt32Min), std::to_string(kInt32Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_BOOL, { + {varint(1), "true"}, + {varint(0), "false"}, + {varint(12345678), "true"} + }); + TestValidDataForType(FieldDescriptor::TYPE_SINT32, { + {zz32(12345), "12345"}, + {zz32(kInt32Max), std::to_string(kInt32Max)}, + {zz32(kInt32Min), std::to_string(kInt32Min)} + }); + TestValidDataForType(FieldDescriptor::TYPE_SINT64, { + {zz64(12345), "12345"}, + {zz64(kInt64Max), std::to_string(kInt64Max)}, + {zz64(kInt64Min), std::to_string(kInt64Min)} + }); + + // TODO(haberman): + // TestValidDataForType(FieldDescriptor::TYPE_STRING + // TestValidDataForType(FieldDescriptor::TYPE_GROUP + // TestValidDataForType(FieldDescriptor::TYPE_MESSAGE + // TestValidDataForType(FieldDescriptor::TYPE_BYTES + // TestValidDataForType(FieldDescriptor::TYPE_ENUM + + RunValidJsonTest("HelloWorld", REQUIRED, + "{\"optionalString\":\"Hello, World!\"}", "optional_string: 'Hello, World!'"); + // NOTE: The spec for JSON support is still being sorted out, these may not + // all be correct. // Test field name conventions. RunValidJsonTest( - "FieldNameInSnakeCase", + "FieldNameInSnakeCase", REQUIRED, R"({ "fieldname1": 1, "fieldName2": 2, - "FieldName3": 3 + "FieldName3": 3, + "fieldName4": 4 })", R"( fieldname1: 1 field_name2: 2 _field_name3: 3 + field__name4_: 4 )"); RunValidJsonTest( - "FieldNameWithNumbers", + "FieldNameWithNumbers", REQUIRED, R"({ "field0name5": 5, "field0Name6": 6 @@ -644,14 +868,14 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, field_0_name6: 6 )"); RunValidJsonTest( - "FieldNameWithMixedCases", + "FieldNameWithMixedCases", REQUIRED, R"({ "fieldName7": 7, - "fieldName8": 8, + "FieldName8": 8, "fieldName9": 9, - "fieldName10": 10, - "fIELDNAME11": 11, - "fIELDName12": 12 + "FieldName10": 10, + "FIELDNAME11": 11, + "FIELDName12": 12 })", R"( fieldName7: 7 @@ -661,13 +885,32 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, FIELD_NAME11: 11 FIELD_name12: 12 )"); + RunValidJsonTest( + "FieldNameWithDoubleUnderscores", RECOMMENDED, + R"({ + "FieldName13": 13, + "FieldName14": 14, + "fieldName15": 15, + "fieldName16": 16, + "fieldName17": 17, + "FieldName18": 18 + })", + R"( + __field_name13: 13 + __Field_name14: 14 + field__name15: 15 + field__Name16: 16 + field_name17__: 17 + Field_name18__: 18 + )"); // Using the original proto field name in JSON is also allowed. RunValidJsonTest( - "OriginalProtoFieldName", + "OriginalProtoFieldName", REQUIRED, R"({ "fieldname1": 1, "field_name2": 2, "_field_name3": 3, + "field__name4_": 4, "field0name5": 5, "field_0_name6": 6, "fieldName7": 7, @@ -675,12 +918,19 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, "field_Name9": 9, "Field_Name10": 10, "FIELD_NAME11": 11, - "FIELD_name12": 12 + "FIELD_name12": 12, + "__field_name13": 13, + "__Field_name14": 14, + "field__name15": 15, + "field__Name16": 16, + "field_name17__": 17, + "Field_name18__": 18 })", R"( fieldname1: 1 field_name2: 2 _field_name3: 3 + field__name4_: 4 field0name5: 5 field_0_name6: 6 fieldName7: 7 @@ -689,61 +939,120 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, Field_Name10: 10 FIELD_NAME11: 11 FIELD_name12: 12 + __field_name13: 13 + __Field_name14: 14 + field__name15: 15 + field__Name16: 16 + field_name17__: 17 + Field_name18__: 18 )"); // Field names can be escaped. RunValidJsonTest( - "FieldNameEscaped", + "FieldNameEscaped", REQUIRED, R"({"fieldn\u0061me1": 1})", "fieldname1: 1"); + // String ends with escape character. + ExpectParseFailureForJson( + "StringEndsWithEscapeChar", RECOMMENDED, + "{\"optionalString\": \"abc\\"); // Field names must be quoted (or it's not valid JSON). ExpectParseFailureForJson( - "FieldNameNotQuoted", + "FieldNameNotQuoted", RECOMMENDED, "{fieldname1: 1}"); // Trailing comma is not allowed (not valid JSON). ExpectParseFailureForJson( - "TrailingCommaInAnObject", + "TrailingCommaInAnObject", RECOMMENDED, R"({"fieldname1":1,})"); + ExpectParseFailureForJson( + "TrailingCommaInAnObjectWithSpace", RECOMMENDED, + R"({"fieldname1":1 ,})"); + ExpectParseFailureForJson( + "TrailingCommaInAnObjectWithSpaceCommaSpace", RECOMMENDED, + R"({"fieldname1":1 , })"); + ExpectParseFailureForJson( + "TrailingCommaInAnObjectWithNewlines", RECOMMENDED, + R"({ + "fieldname1":1, + })"); // JSON doesn't support comments. ExpectParseFailureForJson( - "JsonWithComments", + "JsonWithComments", RECOMMENDED, R"({ // This is a comment. "fieldname1": 1 })"); + // JSON spec says whitespace doesn't matter, so try a few spacings to be sure. + RunValidJsonTest( + "OneLineNoSpaces", RECOMMENDED, + "{\"optionalInt32\":1,\"optionalInt64\":2}", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + RunValidJsonTest( + "OneLineWithSpaces", RECOMMENDED, + "{ \"optionalInt32\" : 1 , \"optionalInt64\" : 2 }", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + RunValidJsonTest( + "MultilineNoSpaces", RECOMMENDED, + "{\n\"optionalInt32\"\n:\n1\n,\n\"optionalInt64\"\n:\n2\n}", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + RunValidJsonTest( + "MultilineWithSpaces", RECOMMENDED, + "{\n \"optionalInt32\" : 1\n ,\n \"optionalInt64\" : 2\n}\n", + R"( + optional_int32: 1 + optional_int64: 2 + )"); + // Missing comma between key/value pairs. + ExpectParseFailureForJson( + "MissingCommaOneLine", RECOMMENDED, + "{ \"optionalInt32\": 1 \"optionalInt64\": 2 }"); + ExpectParseFailureForJson( + "MissingCommaMultiline", RECOMMENDED, + "{\n \"optionalInt32\": 1\n \"optionalInt64\": 2\n}"); // Duplicated field names are not allowed. ExpectParseFailureForJson( - "FieldNameDuplicate", + "FieldNameDuplicate", RECOMMENDED, R"({ "optionalNestedMessage": {a: 1}, "optionalNestedMessage": {} })"); ExpectParseFailureForJson( - "FieldNameDuplicateDifferentCasing1", + "FieldNameDuplicateDifferentCasing1", RECOMMENDED, R"({ "optional_nested_message": {a: 1}, "optionalNestedMessage": {} })"); ExpectParseFailureForJson( - "FieldNameDuplicateDifferentCasing2", + "FieldNameDuplicateDifferentCasing2", RECOMMENDED, R"({ "optionalNestedMessage": {a: 1}, "optional_nested_message": {} })"); // Serializers should use lowerCamelCase by default. RunValidJsonTestWithValidator( - "FieldNameInLowerCamelCase", + "FieldNameInLowerCamelCase", REQUIRED, R"({ "fieldname1": 1, "fieldName2": 2, - "FieldName3": 3 + "FieldName3": 3, + "fieldName4": 4 })", [](const Json::Value& value) { return value.isMember("fieldname1") && value.isMember("fieldName2") && - value.isMember("FieldName3"); + value.isMember("FieldName3") && + value.isMember("fieldName4"); }); RunValidJsonTestWithValidator( - "FieldNameWithNumbers", + "FieldNameWithNumbers", REQUIRED, R"({ "field0name5": 5, "field0Name6": 6 @@ -753,169 +1062,195 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, value.isMember("field0Name6"); }); RunValidJsonTestWithValidator( - "FieldNameWithMixedCases", + "FieldNameWithMixedCases", REQUIRED, R"({ "fieldName7": 7, - "fieldName8": 8, + "FieldName8": 8, "fieldName9": 9, - "fieldName10": 10, - "fIELDNAME11": 11, - "fIELDName12": 12 + "FieldName10": 10, + "FIELDNAME11": 11, + "FIELDName12": 12 })", [](const Json::Value& value) { return value.isMember("fieldName7") && - value.isMember("fieldName8") && + value.isMember("FieldName8") && value.isMember("fieldName9") && - value.isMember("fieldName10") && - value.isMember("fIELDNAME11") && - value.isMember("fIELDName12"); + value.isMember("FieldName10") && + value.isMember("FIELDNAME11") && + value.isMember("FIELDName12"); + }); + RunValidJsonTestWithValidator( + "FieldNameWithDoubleUnderscores", RECOMMENDED, + R"({ + "FieldName13": 13, + "FieldName14": 14, + "fieldName15": 15, + "fieldName16": 16, + "fieldName17": 17, + "FieldName18": 18 + })", + [](const Json::Value& value) { + return value.isMember("FieldName13") && + value.isMember("FieldName14") && + value.isMember("fieldName15") && + value.isMember("fieldName16") && + value.isMember("fieldName17") && + value.isMember("FieldName18"); }); // Integer fields. RunValidJsonTest( - "Int32FieldMaxValue", + "Int32FieldMaxValue", REQUIRED, R"({"optionalInt32": 2147483647})", "optional_int32: 2147483647"); RunValidJsonTest( - "Int32FieldMinValue", + "Int32FieldMinValue", REQUIRED, R"({"optionalInt32": -2147483648})", "optional_int32: -2147483648"); RunValidJsonTest( - "Uint32FieldMaxValue", + "Uint32FieldMaxValue", REQUIRED, R"({"optionalUint32": 4294967295})", "optional_uint32: 4294967295"); RunValidJsonTest( - "Int64FieldMaxValue", + "Int64FieldMaxValue", REQUIRED, R"({"optionalInt64": "9223372036854775807"})", "optional_int64: 9223372036854775807"); RunValidJsonTest( - "Int64FieldMinValue", + "Int64FieldMinValue", REQUIRED, R"({"optionalInt64": "-9223372036854775808"})", "optional_int64: -9223372036854775808"); RunValidJsonTest( - "Uint64FieldMaxValue", + "Uint64FieldMaxValue", REQUIRED, R"({"optionalUint64": "18446744073709551615"})", "optional_uint64: 18446744073709551615"); + // While not the largest Int64, this is the largest + // Int64 which can be exactly represented within an + // IEEE-754 64-bit float, which is the expected level + // of interoperability guarantee. Larger values may + // work in some implementations, but should not be + // relied upon. RunValidJsonTest( - "Int64FieldMaxValueNotQuoted", - R"({"optionalInt64": 9223372036854775807})", - "optional_int64: 9223372036854775807"); + "Int64FieldMaxValueNotQuoted", REQUIRED, + R"({"optionalInt64": 9223372036854774784})", + "optional_int64: 9223372036854774784"); RunValidJsonTest( - "Int64FieldMinValueNotQuoted", + "Int64FieldMinValueNotQuoted", REQUIRED, R"({"optionalInt64": -9223372036854775808})", "optional_int64: -9223372036854775808"); + // Largest interoperable Uint64; see comment above + // for Int64FieldMaxValueNotQuoted. RunValidJsonTest( - "Uint64FieldMaxValueNotQuoted", - R"({"optionalUint64": 18446744073709551615})", - "optional_uint64: 18446744073709551615"); + "Uint64FieldMaxValueNotQuoted", REQUIRED, + R"({"optionalUint64": 18446744073709549568})", + "optional_uint64: 18446744073709549568"); // Values can be represented as JSON strings. RunValidJsonTest( - "Int32FieldStringValue", + "Int32FieldStringValue", REQUIRED, R"({"optionalInt32": "2147483647"})", "optional_int32: 2147483647"); RunValidJsonTest( - "Int32FieldStringValueEscaped", + "Int32FieldStringValueEscaped", REQUIRED, R"({"optionalInt32": "2\u003147483647"})", "optional_int32: 2147483647"); // Parsers reject out-of-bound integer values. ExpectParseFailureForJson( - "Int32FieldTooLarge", + "Int32FieldTooLarge", REQUIRED, R"({"optionalInt32": 2147483648})"); ExpectParseFailureForJson( - "Int32FieldTooSmall", + "Int32FieldTooSmall", REQUIRED, R"({"optionalInt32": -2147483649})"); ExpectParseFailureForJson( - "Uint32FieldTooLarge", + "Uint32FieldTooLarge", REQUIRED, R"({"optionalUint32": 4294967296})"); ExpectParseFailureForJson( - "Int64FieldTooLarge", + "Int64FieldTooLarge", REQUIRED, R"({"optionalInt64": "9223372036854775808"})"); ExpectParseFailureForJson( - "Int64FieldTooSmall", + "Int64FieldTooSmall", REQUIRED, R"({"optionalInt64": "-9223372036854775809"})"); ExpectParseFailureForJson( - "Uint64FieldTooLarge", + "Uint64FieldTooLarge", REQUIRED, R"({"optionalUint64": "18446744073709551616"})"); // Parser reject non-integer numeric values as well. ExpectParseFailureForJson( - "Int32FieldNotInteger", + "Int32FieldNotInteger", REQUIRED, R"({"optionalInt32": 0.5})"); ExpectParseFailureForJson( - "Uint32FieldNotInteger", + "Uint32FieldNotInteger", REQUIRED, R"({"optionalUint32": 0.5})"); ExpectParseFailureForJson( - "Int64FieldNotInteger", + "Int64FieldNotInteger", REQUIRED, R"({"optionalInt64": "0.5"})"); ExpectParseFailureForJson( - "Uint64FieldNotInteger", + "Uint64FieldNotInteger", REQUIRED, R"({"optionalUint64": "0.5"})"); // Integers but represented as float values are accepted. RunValidJsonTest( - "Int32FieldFloatTrailingZero", + "Int32FieldFloatTrailingZero", REQUIRED, R"({"optionalInt32": 100000.000})", "optional_int32: 100000"); RunValidJsonTest( - "Int32FieldExponentialFormat", + "Int32FieldExponentialFormat", REQUIRED, R"({"optionalInt32": 1e5})", "optional_int32: 100000"); RunValidJsonTest( - "Int32FieldMaxFloatValue", + "Int32FieldMaxFloatValue", REQUIRED, R"({"optionalInt32": 2.147483647e9})", "optional_int32: 2147483647"); RunValidJsonTest( - "Int32FieldMinFloatValue", + "Int32FieldMinFloatValue", REQUIRED, R"({"optionalInt32": -2.147483648e9})", "optional_int32: -2147483648"); RunValidJsonTest( - "Uint32FieldMaxFloatValue", + "Uint32FieldMaxFloatValue", REQUIRED, R"({"optionalUint32": 4.294967295e9})", "optional_uint32: 4294967295"); // Parser reject non-numeric values. ExpectParseFailureForJson( - "Int32FieldNotNumber", + "Int32FieldNotNumber", REQUIRED, R"({"optionalInt32": "3x3"})"); ExpectParseFailureForJson( - "Uint32FieldNotNumber", + "Uint32FieldNotNumber", REQUIRED, R"({"optionalUint32": "3x3"})"); ExpectParseFailureForJson( - "Int64FieldNotNumber", + "Int64FieldNotNumber", REQUIRED, R"({"optionalInt64": "3x3"})"); ExpectParseFailureForJson( - "Uint64FieldNotNumber", + "Uint64FieldNotNumber", REQUIRED, R"({"optionalUint64": "3x3"})"); // JSON does not allow "+" on numric values. ExpectParseFailureForJson( - "Int32FieldPlusSign", + "Int32FieldPlusSign", REQUIRED, R"({"optionalInt32": +1})"); // JSON doesn't allow leading 0s. ExpectParseFailureForJson( - "Int32FieldLeadingZero", + "Int32FieldLeadingZero", REQUIRED, R"({"optionalInt32": 01})"); ExpectParseFailureForJson( - "Int32FieldNegativeWithLeadingZero", + "Int32FieldNegativeWithLeadingZero", REQUIRED, R"({"optionalInt32": -01})"); // String values must follow the same syntax rule. Specifically leading - // or traling spaces are not allowed. + // or trailing spaces are not allowed. ExpectParseFailureForJson( - "Int32FieldLeadingSpace", + "Int32FieldLeadingSpace", REQUIRED, R"({"optionalInt32": " 1"})"); ExpectParseFailureForJson( - "Int32FieldTrailingSpace", + "Int32FieldTrailingSpace", REQUIRED, R"({"optionalInt32": "1 "})"); // 64-bit values are serialized as strings. RunValidJsonTestWithValidator( - "Int64FieldBeString", + "Int64FieldBeString", RECOMMENDED, R"({"optionalInt64": 1})", [](const Json::Value& value) { return value["optionalInt64"].type() == Json::stringValue && value["optionalInt64"].asString() == "1"; }); RunValidJsonTestWithValidator( - "Uint64FieldBeString", + "Uint64FieldBeString", RECOMMENDED, R"({"optionalUint64": 1})", [](const Json::Value& value) { return value["optionalUint64"].type() == Json::stringValue && @@ -924,73 +1259,73 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // Bool fields. RunValidJsonTest( - "BoolFieldTrue", + "BoolFieldTrue", REQUIRED, R"({"optionalBool":true})", "optional_bool: true"); RunValidJsonTest( - "BoolFieldFalse", + "BoolFieldFalse", REQUIRED, R"({"optionalBool":false})", "optional_bool: false"); // Other forms are not allowed. ExpectParseFailureForJson( - "BoolFieldIntegerZero", + "BoolFieldIntegerZero", RECOMMENDED, R"({"optionalBool":0})"); ExpectParseFailureForJson( - "BoolFieldIntegerOne", + "BoolFieldIntegerOne", RECOMMENDED, R"({"optionalBool":1})"); ExpectParseFailureForJson( - "BoolFieldCamelCaseTrue", + "BoolFieldCamelCaseTrue", RECOMMENDED, R"({"optionalBool":True})"); ExpectParseFailureForJson( - "BoolFieldCamelCaseFalse", + "BoolFieldCamelCaseFalse", RECOMMENDED, R"({"optionalBool":False})"); ExpectParseFailureForJson( - "BoolFieldAllCapitalTrue", + "BoolFieldAllCapitalTrue", RECOMMENDED, R"({"optionalBool":TRUE})"); ExpectParseFailureForJson( - "BoolFieldAllCapitalFalse", + "BoolFieldAllCapitalFalse", RECOMMENDED, R"({"optionalBool":FALSE})"); ExpectParseFailureForJson( - "BoolFieldDoubleQuotedTrue", + "BoolFieldDoubleQuotedTrue", RECOMMENDED, R"({"optionalBool":"true"})"); ExpectParseFailureForJson( - "BoolFieldDoubleQuotedFalse", + "BoolFieldDoubleQuotedFalse", RECOMMENDED, R"({"optionalBool":"false"})"); // Float fields. RunValidJsonTest( - "FloatFieldMinPositiveValue", + "FloatFieldMinPositiveValue", REQUIRED, R"({"optionalFloat": 1.175494e-38})", "optional_float: 1.175494e-38"); RunValidJsonTest( - "FloatFieldMaxNegativeValue", + "FloatFieldMaxNegativeValue", REQUIRED, R"({"optionalFloat": -1.175494e-38})", "optional_float: -1.175494e-38"); RunValidJsonTest( - "FloatFieldMaxPositiveValue", + "FloatFieldMaxPositiveValue", REQUIRED, R"({"optionalFloat": 3.402823e+38})", "optional_float: 3.402823e+38"); RunValidJsonTest( - "FloatFieldMinNegativeValue", + "FloatFieldMinNegativeValue", REQUIRED, R"({"optionalFloat": 3.402823e+38})", "optional_float: 3.402823e+38"); // Values can be quoted. RunValidJsonTest( - "FloatFieldQuotedValue", + "FloatFieldQuotedValue", REQUIRED, R"({"optionalFloat": "1"})", "optional_float: 1"); // Special values. RunValidJsonTest( - "FloatFieldNan", + "FloatFieldNan", REQUIRED, R"({"optionalFloat": "NaN"})", "optional_float: nan"); RunValidJsonTest( - "FloatFieldInfinity", + "FloatFieldInfinity", REQUIRED, R"({"optionalFloat": "Infinity"})", "optional_float: inf"); RunValidJsonTest( - "FloatFieldNegativeInfinity", + "FloatFieldNegativeInfinity", REQUIRED, R"({"optionalFloat": "-Infinity"})", "optional_float: -inf"); // Non-cannonical Nan will be correctly normalized. @@ -1001,68 +1336,68 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, message.set_optional_float( WireFormatLite::DecodeFloat(0x7FA12345)); RunValidJsonTestWithProtobufInput( - "FloatFieldNormalizeQuietNan", message, + "FloatFieldNormalizeQuietNan", REQUIRED, message, "optional_float: nan"); // IEEE floating-point standard 64-bit signaling NaN: // 1111 1111 1xxx xxxx xxxx xxxx xxxx xxxx message.set_optional_float( WireFormatLite::DecodeFloat(0xFFB54321)); RunValidJsonTestWithProtobufInput( - "FloatFieldNormalizeSignalingNan", message, + "FloatFieldNormalizeSignalingNan", REQUIRED, message, "optional_float: nan"); } // Special values must be quoted. ExpectParseFailureForJson( - "FloatFieldNanNotQuoted", + "FloatFieldNanNotQuoted", RECOMMENDED, R"({"optionalFloat": NaN})"); ExpectParseFailureForJson( - "FloatFieldInfinityNotQuoted", + "FloatFieldInfinityNotQuoted", RECOMMENDED, R"({"optionalFloat": Infinity})"); ExpectParseFailureForJson( - "FloatFieldNegativeInfinityNotQuoted", + "FloatFieldNegativeInfinityNotQuoted", RECOMMENDED, R"({"optionalFloat": -Infinity})"); // Parsers should reject out-of-bound values. ExpectParseFailureForJson( - "FloatFieldTooSmall", + "FloatFieldTooSmall", REQUIRED, R"({"optionalFloat": -3.502823e+38})"); ExpectParseFailureForJson( - "FloatFieldTooLarge", + "FloatFieldTooLarge", REQUIRED, R"({"optionalFloat": 3.502823e+38})"); // Double fields. RunValidJsonTest( - "DoubleFieldMinPositiveValue", + "DoubleFieldMinPositiveValue", REQUIRED, R"({"optionalDouble": 2.22507e-308})", "optional_double: 2.22507e-308"); RunValidJsonTest( - "DoubleFieldMaxNegativeValue", + "DoubleFieldMaxNegativeValue", REQUIRED, R"({"optionalDouble": -2.22507e-308})", "optional_double: -2.22507e-308"); RunValidJsonTest( - "DoubleFieldMaxPositiveValue", + "DoubleFieldMaxPositiveValue", REQUIRED, R"({"optionalDouble": 1.79769e+308})", "optional_double: 1.79769e+308"); RunValidJsonTest( - "DoubleFieldMinNegativeValue", + "DoubleFieldMinNegativeValue", REQUIRED, R"({"optionalDouble": -1.79769e+308})", "optional_double: -1.79769e+308"); // Values can be quoted. RunValidJsonTest( - "DoubleFieldQuotedValue", + "DoubleFieldQuotedValue", REQUIRED, R"({"optionalDouble": "1"})", "optional_double: 1"); // Speical values. RunValidJsonTest( - "DoubleFieldNan", + "DoubleFieldNan", REQUIRED, R"({"optionalDouble": "NaN"})", "optional_double: nan"); RunValidJsonTest( - "DoubleFieldInfinity", + "DoubleFieldInfinity", REQUIRED, R"({"optionalDouble": "Infinity"})", "optional_double: inf"); RunValidJsonTest( - "DoubleFieldNegativeInfinity", + "DoubleFieldNegativeInfinity", REQUIRED, R"({"optionalDouble": "-Infinity"})", "optional_double: -inf"); // Non-cannonical Nan will be correctly normalized. @@ -1071,55 +1406,55 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, message.set_optional_double( WireFormatLite::DecodeDouble(0x7FFA123456789ABCLL)); RunValidJsonTestWithProtobufInput( - "DoubleFieldNormalizeQuietNan", message, + "DoubleFieldNormalizeQuietNan", REQUIRED, message, "optional_double: nan"); message.set_optional_double( WireFormatLite::DecodeDouble(0xFFFBCBA987654321LL)); RunValidJsonTestWithProtobufInput( - "DoubleFieldNormalizeSignalingNan", message, + "DoubleFieldNormalizeSignalingNan", REQUIRED, message, "optional_double: nan"); } // Special values must be quoted. ExpectParseFailureForJson( - "DoubleFieldNanNotQuoted", + "DoubleFieldNanNotQuoted", RECOMMENDED, R"({"optionalDouble": NaN})"); ExpectParseFailureForJson( - "DoubleFieldInfinityNotQuoted", + "DoubleFieldInfinityNotQuoted", RECOMMENDED, R"({"optionalDouble": Infinity})"); ExpectParseFailureForJson( - "DoubleFieldNegativeInfinityNotQuoted", + "DoubleFieldNegativeInfinityNotQuoted", RECOMMENDED, R"({"optionalDouble": -Infinity})"); // Parsers should reject out-of-bound values. ExpectParseFailureForJson( - "DoubleFieldTooSmall", + "DoubleFieldTooSmall", REQUIRED, R"({"optionalDouble": -1.89769e+308})"); ExpectParseFailureForJson( - "DoubleFieldTooLarge", + "DoubleFieldTooLarge", REQUIRED, R"({"optionalDouble": +1.89769e+308})"); // Enum fields. RunValidJsonTest( - "EnumField", + "EnumField", REQUIRED, R"({"optionalNestedEnum": "FOO"})", "optional_nested_enum: FOO"); // Enum values must be represented as strings. ExpectParseFailureForJson( - "EnumFieldNotQuoted", + "EnumFieldNotQuoted", REQUIRED, R"({"optionalNestedEnum": FOO})"); // Numeric values are allowed. RunValidJsonTest( - "EnumFieldNumericValueZero", + "EnumFieldNumericValueZero", REQUIRED, R"({"optionalNestedEnum": 0})", "optional_nested_enum: FOO"); RunValidJsonTest( - "EnumFieldNumericValueNonZero", + "EnumFieldNumericValueNonZero", REQUIRED, R"({"optionalNestedEnum": 1})", "optional_nested_enum: BAR"); // Unknown enum values are represented as numeric values. RunValidJsonTestWithValidator( - "EnumFieldUnknownValue", + "EnumFieldUnknownValue", REQUIRED, R"({"optionalNestedEnum": 123})", [](const Json::Value& value) { return value["optionalNestedEnum"].type() == Json::intValue && @@ -1128,177 +1463,241 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // String fields. RunValidJsonTest( - "StringField", + "StringField", REQUIRED, R"({"optionalString": "Hello world!"})", "optional_string: \"Hello world!\""); RunValidJsonTest( - "StringFieldUnicode", + "StringFieldUnicode", REQUIRED, // Google in Chinese. R"({"optionalString": "è°·æ­Œ"})", R"(optional_string: "è°·æ­Œ")"); RunValidJsonTest( - "StringFieldEscape", + "StringFieldEscape", REQUIRED, R"({"optionalString": "\"\\\/\b\f\n\r\t"})", R"(optional_string: "\"\\/\b\f\n\r\t")"); RunValidJsonTest( - "StringFieldUnicodeEscape", + "StringFieldUnicodeEscape", REQUIRED, R"({"optionalString": "\u8C37\u6B4C"})", R"(optional_string: "è°·æ­Œ")"); RunValidJsonTest( - "StringFieldUnicodeEscapeWithLowercaseHexLetters", + "StringFieldUnicodeEscapeWithLowercaseHexLetters", REQUIRED, R"({"optionalString": "\u8c37\u6b4c"})", R"(optional_string: "è°·æ­Œ")"); RunValidJsonTest( - "StringFieldSurrogatePair", + "StringFieldSurrogatePair", REQUIRED, // The character is an emoji: grinning face with smiling eyes. 😠R"({"optionalString": "\uD83D\uDE01"})", R"(optional_string: "\xF0\x9F\x98\x81")"); // Unicode escapes must start with "\u" (lowercase u). ExpectParseFailureForJson( - "StringFieldUppercaseEscapeLetter", + "StringFieldUppercaseEscapeLetter", RECOMMENDED, R"({"optionalString": "\U8C37\U6b4C"})"); ExpectParseFailureForJson( - "StringFieldInvalidEscape", + "StringFieldInvalidEscape", RECOMMENDED, R"({"optionalString": "\uXXXX\u6B4C"})"); ExpectParseFailureForJson( - "StringFieldUnterminatedEscape", + "StringFieldUnterminatedEscape", RECOMMENDED, R"({"optionalString": "\u8C3"})"); ExpectParseFailureForJson( - "StringFieldUnpairedHighSurrogate", + "StringFieldUnpairedHighSurrogate", RECOMMENDED, R"({"optionalString": "\uD800"})"); ExpectParseFailureForJson( - "StringFieldUnpairedLowSurrogate", + "StringFieldUnpairedLowSurrogate", RECOMMENDED, R"({"optionalString": "\uDC00"})"); ExpectParseFailureForJson( - "StringFieldSurrogateInWrongOrder", + "StringFieldSurrogateInWrongOrder", RECOMMENDED, R"({"optionalString": "\uDE01\uD83D"})"); ExpectParseFailureForJson( - "StringFieldNotAString", + "StringFieldNotAString", REQUIRED, R"({"optionalString": 12345})"); // Bytes fields. RunValidJsonTest( - "BytesField", + "BytesField", REQUIRED, R"({"optionalBytes": "AQI="})", R"(optional_bytes: "\x01\x02")"); ExpectParseFailureForJson( - "BytesFieldNoPadding", - R"({"optionalBytes": "AQI"})"); - ExpectParseFailureForJson( - "BytesFieldInvalidBase64Characters", + "BytesFieldInvalidBase64Characters", REQUIRED, R"({"optionalBytes": "-_=="})"); // Message fields. RunValidJsonTest( - "MessageField", + "MessageField", REQUIRED, R"({"optionalNestedMessage": {"a": 1234}})", "optional_nested_message: {a: 1234}"); // Oneof fields. ExpectParseFailureForJson( - "OneofFieldDuplicate", + "OneofFieldDuplicate", REQUIRED, R"({"oneofUint32": 1, "oneofString": "test"})"); + // Ensure zero values for oneof make it out/backs. + { + TestAllTypes message; + message.set_oneof_uint32(0); + RunValidProtobufTestWithMessage( + "OneofZeroUint32", RECOMMENDED, message, "oneof_uint32: 0"); + message.mutable_oneof_nested_message()->set_a(0); + RunValidProtobufTestWithMessage( + "OneofZeroMessage", RECOMMENDED, message, "oneof_nested_message: {}"); + message.set_oneof_string(""); + RunValidProtobufTestWithMessage( + "OneofZeroString", RECOMMENDED, message, "oneof_string: \"\""); + message.set_oneof_bytes(""); + RunValidProtobufTestWithMessage( + "OneofZeroBytes", RECOMMENDED, message, "oneof_bytes: \"\""); + message.set_oneof_bool(false); + RunValidProtobufTestWithMessage( + "OneofZeroBool", RECOMMENDED, message, "oneof_bool: false"); + message.set_oneof_uint64(0); + RunValidProtobufTestWithMessage( + "OneofZeroUint64", RECOMMENDED, message, "oneof_uint64: 0"); + message.set_oneof_float(0.0f); + RunValidProtobufTestWithMessage( + "OneofZeroFloat", RECOMMENDED, message, "oneof_float: 0"); + message.set_oneof_double(0.0); + RunValidProtobufTestWithMessage( + "OneofZeroDouble", RECOMMENDED, message, "oneof_double: 0"); + message.set_oneof_enum(TestAllTypes::FOO); + RunValidProtobufTestWithMessage( + "OneofZeroEnum", RECOMMENDED, message, "oneof_enum: FOO"); + } + RunValidJsonTest( + "OneofZeroUint32", RECOMMENDED, + R"({"oneofUint32": 0})", "oneof_uint32: 0"); + RunValidJsonTest( + "OneofZeroMessage", RECOMMENDED, + R"({"oneofNestedMessage": {}})", "oneof_nested_message: {}"); + RunValidJsonTest( + "OneofZeroString", RECOMMENDED, + R"({"oneofString": ""})", "oneof_string: \"\""); + RunValidJsonTest( + "OneofZeroBytes", RECOMMENDED, + R"({"oneofBytes": ""})", "oneof_bytes: \"\""); + RunValidJsonTest( + "OneofZeroBool", RECOMMENDED, + R"({"oneofBool": false})", "oneof_bool: false"); + RunValidJsonTest( + "OneofZeroUint64", RECOMMENDED, + R"({"oneofUint64": 0})", "oneof_uint64: 0"); + RunValidJsonTest( + "OneofZeroFloat", RECOMMENDED, + R"({"oneofFloat": 0.0})", "oneof_float: 0"); + RunValidJsonTest( + "OneofZeroDouble", RECOMMENDED, + R"({"oneofDouble": 0.0})", "oneof_double: 0"); + RunValidJsonTest( + "OneofZeroEnum", RECOMMENDED, + R"({"oneofEnum":"FOO"})", "oneof_enum: FOO"); // Repeated fields. RunValidJsonTest( - "PrimitiveRepeatedField", + "PrimitiveRepeatedField", REQUIRED, R"({"repeatedInt32": [1, 2, 3, 4]})", "repeated_int32: [1, 2, 3, 4]"); RunValidJsonTest( - "EnumRepeatedField", + "EnumRepeatedField", REQUIRED, R"({"repeatedNestedEnum": ["FOO", "BAR", "BAZ"]})", "repeated_nested_enum: [FOO, BAR, BAZ]"); RunValidJsonTest( - "StringRepeatedField", + "StringRepeatedField", REQUIRED, R"({"repeatedString": ["Hello", "world"]})", R"(repeated_string: ["Hello", "world"])"); RunValidJsonTest( - "BytesRepeatedField", + "BytesRepeatedField", REQUIRED, R"({"repeatedBytes": ["AAEC", "AQI="]})", R"(repeated_bytes: ["\x00\x01\x02", "\x01\x02"])"); RunValidJsonTest( - "MessageRepeatedField", + "MessageRepeatedField", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1234}, {"a": 5678}]})", "repeated_nested_message: {a: 1234}" "repeated_nested_message: {a: 5678}"); // Repeated field elements are of incorrect type. ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingIntegersGotBool", + "RepeatedFieldWrongElementTypeExpectingIntegersGotBool", REQUIRED, R"({"repeatedInt32": [1, false, 3, 4]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingIntegersGotString", + "RepeatedFieldWrongElementTypeExpectingIntegersGotString", REQUIRED, R"({"repeatedInt32": [1, 2, "name", 4]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingIntegersGotMessage", + "RepeatedFieldWrongElementTypeExpectingIntegersGotMessage", REQUIRED, R"({"repeatedInt32": [1, 2, 3, {"a": 4}]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingStringsGotInt", + "RepeatedFieldWrongElementTypeExpectingStringsGotInt", REQUIRED, R"({"repeatedString": ["1", 2, "3", "4"]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingStringsGotBool", + "RepeatedFieldWrongElementTypeExpectingStringsGotBool", REQUIRED, R"({"repeatedString": ["1", "2", false, "4"]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingStringsGotMessage", + "RepeatedFieldWrongElementTypeExpectingStringsGotMessage", REQUIRED, R"({"repeatedString": ["1", 2, "3", {"a": 4}]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingMessagesGotInt", + "RepeatedFieldWrongElementTypeExpectingMessagesGotInt", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1}, 2]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingMessagesGotBool", + "RepeatedFieldWrongElementTypeExpectingMessagesGotBool", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1}, false]})"); ExpectParseFailureForJson( - "RepeatedFieldWrongElementTypeExpectingMessagesGotString", + "RepeatedFieldWrongElementTypeExpectingMessagesGotString", REQUIRED, R"({"repeatedNestedMessage": [{"a": 1}, "2"]})"); // Trailing comma in the repeated field is not allowed. ExpectParseFailureForJson( - "RepeatedFieldTrailingComma", + "RepeatedFieldTrailingComma", RECOMMENDED, R"({"repeatedInt32": [1, 2, 3, 4,]})"); + ExpectParseFailureForJson( + "RepeatedFieldTrailingCommaWithSpace", RECOMMENDED, + "{\"repeatedInt32\": [1, 2, 3, 4 ,]}"); + ExpectParseFailureForJson( + "RepeatedFieldTrailingCommaWithSpaceCommaSpace", RECOMMENDED, + "{\"repeatedInt32\": [1, 2, 3, 4 , ]}"); + ExpectParseFailureForJson( + "RepeatedFieldTrailingCommaWithNewlines", RECOMMENDED, + "{\"repeatedInt32\": [\n 1,\n 2,\n 3,\n 4,\n]}"); // Map fields. RunValidJsonTest( - "Int32MapField", + "Int32MapField", REQUIRED, R"({"mapInt32Int32": {"1": 2, "3": 4}})", "map_int32_int32: {key: 1 value: 2}" "map_int32_int32: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Int32MapFieldKeyNotQuoted", + "Int32MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapInt32Int32": {1: 2, 3: 4}})"); RunValidJsonTest( - "Uint32MapField", + "Uint32MapField", REQUIRED, R"({"mapUint32Uint32": {"1": 2, "3": 4}})", "map_uint32_uint32: {key: 1 value: 2}" "map_uint32_uint32: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Uint32MapFieldKeyNotQuoted", + "Uint32MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapUint32Uint32": {1: 2, 3: 4}})"); RunValidJsonTest( - "Int64MapField", + "Int64MapField", REQUIRED, R"({"mapInt64Int64": {"1": 2, "3": 4}})", "map_int64_int64: {key: 1 value: 2}" "map_int64_int64: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Int64MapFieldKeyNotQuoted", + "Int64MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapInt64Int64": {1: 2, 3: 4}})"); RunValidJsonTest( - "Uint64MapField", + "Uint64MapField", REQUIRED, R"({"mapUint64Uint64": {"1": 2, "3": 4}})", "map_uint64_uint64: {key: 1 value: 2}" "map_uint64_uint64: {key: 3 value: 4}"); ExpectParseFailureForJson( - "Uint64MapFieldKeyNotQuoted", + "Uint64MapFieldKeyNotQuoted", RECOMMENDED, R"({"mapUint64Uint64": {1: 2, 3: 4}})"); RunValidJsonTest( - "BoolMapField", + "BoolMapField", REQUIRED, R"({"mapBoolBool": {"true": true, "false": false}})", "map_bool_bool: {key: true value: true}" "map_bool_bool: {key: false value: false}"); ExpectParseFailureForJson( - "BoolMapFieldKeyNotQuoted", + "BoolMapFieldKeyNotQuoted", RECOMMENDED, R"({"mapBoolBool": {true: true, false: false}})"); RunValidJsonTest( - "MessageMapField", + "MessageMapField", REQUIRED, R"({ "mapStringNestedMessage": { "hello": {"a": 1234}, @@ -1317,21 +1716,21 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, )"); // Since Map keys are represented as JSON strings, escaping should be allowed. RunValidJsonTest( - "Int32MapEscapedKey", + "Int32MapEscapedKey", REQUIRED, R"({"mapInt32Int32": {"\u0031": 2}})", "map_int32_int32: {key: 1 value: 2}"); RunValidJsonTest( - "Int64MapEscapedKey", + "Int64MapEscapedKey", REQUIRED, R"({"mapInt64Int64": {"\u0031": 2}})", "map_int64_int64: {key: 1 value: 2}"); RunValidJsonTest( - "BoolMapEscapedKey", + "BoolMapEscapedKey", REQUIRED, R"({"mapBoolBool": {"tr\u0075e": true}})", "map_bool_bool: {key: true value: true}"); // "null" is accepted for all fields types. RunValidJsonTest( - "AllFieldAcceptNull", + "AllFieldAcceptNull", REQUIRED, R"({ "optionalInt32": null, "optionalInt64": null, @@ -1359,59 +1758,71 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // Repeated field elements cannot be null. ExpectParseFailureForJson( - "RepeatedFieldPrimitiveElementIsNull", + "RepeatedFieldPrimitiveElementIsNull", RECOMMENDED, R"({"repeatedInt32": [1, null, 2]})"); ExpectParseFailureForJson( - "RepeatedFieldMessageElementIsNull", + "RepeatedFieldMessageElementIsNull", RECOMMENDED, R"({"repeatedNestedMessage": [{"a":1}, null, {"a":2}]})"); // Map field keys cannot be null. ExpectParseFailureForJson( - "MapFieldKeyIsNull", + "MapFieldKeyIsNull", RECOMMENDED, R"({"mapInt32Int32": {null: 1}})"); // Map field values cannot be null. ExpectParseFailureForJson( - "MapFieldValueIsNull", + "MapFieldValueIsNull", RECOMMENDED, R"({"mapInt32Int32": {"0": null}})"); + // http://www.rfc-editor.org/rfc/rfc7159.txt says strings have to use double + // quotes. + ExpectParseFailureForJson( + "StringFieldSingleQuoteKey", RECOMMENDED, + R"({'optionalString': "Hello world!"})"); + ExpectParseFailureForJson( + "StringFieldSingleQuoteValue", RECOMMENDED, + R"({"optionalString": 'Hello world!'})"); + ExpectParseFailureForJson( + "StringFieldSingleQuoteBoth", RECOMMENDED, + R"({'optionalString': 'Hello world!'})"); + // Wrapper types. RunValidJsonTest( - "OptionalBoolWrapper", + "OptionalBoolWrapper", REQUIRED, R"({"optionalBoolWrapper": false})", "optional_bool_wrapper: {value: false}"); RunValidJsonTest( - "OptionalInt32Wrapper", + "OptionalInt32Wrapper", REQUIRED, R"({"optionalInt32Wrapper": 0})", "optional_int32_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalUint32Wrapper", + "OptionalUint32Wrapper", REQUIRED, R"({"optionalUint32Wrapper": 0})", "optional_uint32_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalInt64Wrapper", + "OptionalInt64Wrapper", REQUIRED, R"({"optionalInt64Wrapper": 0})", "optional_int64_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalUint64Wrapper", + "OptionalUint64Wrapper", REQUIRED, R"({"optionalUint64Wrapper": 0})", "optional_uint64_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalFloatWrapper", + "OptionalFloatWrapper", REQUIRED, R"({"optionalFloatWrapper": 0})", "optional_float_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalDoubleWrapper", + "OptionalDoubleWrapper", REQUIRED, R"({"optionalDoubleWrapper": 0})", "optional_double_wrapper: {value: 0}"); RunValidJsonTest( - "OptionalStringWrapper", + "OptionalStringWrapper", REQUIRED, R"({"optionalStringWrapper": ""})", R"(optional_string_wrapper: {value: ""})"); RunValidJsonTest( - "OptionalBytesWrapper", + "OptionalBytesWrapper", REQUIRED, R"({"optionalBytesWrapper": ""})", R"(optional_bytes_wrapper: {value: ""})"); RunValidJsonTest( - "OptionalWrapperTypesWithNonDefaultValue", + "OptionalWrapperTypesWithNonDefaultValue", REQUIRED, R"({ "optionalBoolWrapper": true, "optionalInt32Wrapper": 1, @@ -1435,56 +1846,56 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, optional_bytes_wrapper: {value: "\x01\x02"} )"); RunValidJsonTest( - "RepeatedBoolWrapper", + "RepeatedBoolWrapper", REQUIRED, R"({"repeatedBoolWrapper": [true, false]})", "repeated_bool_wrapper: {value: true}" "repeated_bool_wrapper: {value: false}"); RunValidJsonTest( - "RepeatedInt32Wrapper", + "RepeatedInt32Wrapper", REQUIRED, R"({"repeatedInt32Wrapper": [0, 1]})", "repeated_int32_wrapper: {value: 0}" "repeated_int32_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedUint32Wrapper", + "RepeatedUint32Wrapper", REQUIRED, R"({"repeatedUint32Wrapper": [0, 1]})", "repeated_uint32_wrapper: {value: 0}" "repeated_uint32_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedInt64Wrapper", + "RepeatedInt64Wrapper", REQUIRED, R"({"repeatedInt64Wrapper": [0, 1]})", "repeated_int64_wrapper: {value: 0}" "repeated_int64_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedUint64Wrapper", + "RepeatedUint64Wrapper", REQUIRED, R"({"repeatedUint64Wrapper": [0, 1]})", "repeated_uint64_wrapper: {value: 0}" "repeated_uint64_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedFloatWrapper", + "RepeatedFloatWrapper", REQUIRED, R"({"repeatedFloatWrapper": [0, 1]})", "repeated_float_wrapper: {value: 0}" "repeated_float_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedDoubleWrapper", + "RepeatedDoubleWrapper", REQUIRED, R"({"repeatedDoubleWrapper": [0, 1]})", "repeated_double_wrapper: {value: 0}" "repeated_double_wrapper: {value: 1}"); RunValidJsonTest( - "RepeatedStringWrapper", + "RepeatedStringWrapper", REQUIRED, R"({"repeatedStringWrapper": ["", "AQI="]})", R"( repeated_string_wrapper: {value: ""} repeated_string_wrapper: {value: "AQI="} )"); RunValidJsonTest( - "RepeatedBytesWrapper", + "RepeatedBytesWrapper", REQUIRED, R"({"repeatedBytesWrapper": ["", "AQI="]})", R"( repeated_bytes_wrapper: {value: ""} repeated_bytes_wrapper: {value: "\x01\x02"} )"); RunValidJsonTest( - "WrapperTypesWithNullValue", + "WrapperTypesWithNullValue", REQUIRED, R"({ "optionalBoolWrapper": null, "optionalInt32Wrapper": null, @@ -1509,55 +1920,55 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // Duration RunValidJsonTest( - "DurationMinValue", + "DurationMinValue", REQUIRED, R"({"optionalDuration": "-315576000000.999999999s"})", "optional_duration: {seconds: -315576000000 nanos: -999999999}"); RunValidJsonTest( - "DurationMaxValue", + "DurationMaxValue", REQUIRED, R"({"optionalDuration": "315576000000.999999999s"})", "optional_duration: {seconds: 315576000000 nanos: 999999999}"); RunValidJsonTest( - "DurationRepeatedValue", + "DurationRepeatedValue", REQUIRED, R"({"repeatedDuration": ["1.5s", "-1.5s"]})", "repeated_duration: {seconds: 1 nanos: 500000000}" "repeated_duration: {seconds: -1 nanos: -500000000}"); ExpectParseFailureForJson( - "DurationMissingS", + "DurationMissingS", REQUIRED, R"({"optionalDuration": "1"})"); ExpectParseFailureForJson( - "DurationJsonInputTooSmall", + "DurationJsonInputTooSmall", REQUIRED, R"({"optionalDuration": "-315576000001.000000000s"})"); ExpectParseFailureForJson( - "DurationJsonInputTooLarge", + "DurationJsonInputTooLarge", REQUIRED, R"({"optionalDuration": "315576000001.000000000s"})"); ExpectSerializeFailureForJson( - "DurationProtoInputTooSmall", + "DurationProtoInputTooSmall", REQUIRED, "optional_duration: {seconds: -315576000001 nanos: 0}"); ExpectSerializeFailureForJson( - "DurationProtoInputTooLarge", + "DurationProtoInputTooLarge", REQUIRED, "optional_duration: {seconds: 315576000001 nanos: 0}"); RunValidJsonTestWithValidator( - "DurationHasZeroFractionalDigit", + "DurationHasZeroFractionalDigit", RECOMMENDED, R"({"optionalDuration": "1.000000000s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1s"; }); RunValidJsonTestWithValidator( - "DurationHas3FractionalDigits", + "DurationHas3FractionalDigits", RECOMMENDED, R"({"optionalDuration": "1.010000000s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1.010s"; }); RunValidJsonTestWithValidator( - "DurationHas6FractionalDigits", + "DurationHas6FractionalDigits", RECOMMENDED, R"({"optionalDuration": "1.000010000s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1.000010s"; }); RunValidJsonTestWithValidator( - "DurationHas9FractionalDigits", + "DurationHas9FractionalDigits", RECOMMENDED, R"({"optionalDuration": "1.000000010s"})", [](const Json::Value& value) { return value["optionalDuration"].asString() == "1.000000010s"; @@ -1565,15 +1976,15 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // Timestamp RunValidJsonTest( - "TimestampMinValue", + "TimestampMinValue", REQUIRED, R"({"optionalTimestamp": "0001-01-01T00:00:00Z"})", "optional_timestamp: {seconds: -62135596800}"); RunValidJsonTest( - "TimestampMaxValue", + "TimestampMaxValue", REQUIRED, R"({"optionalTimestamp": "9999-12-31T23:59:59.999999999Z"})", "optional_timestamp: {seconds: 253402300799 nanos: 999999999}"); RunValidJsonTest( - "TimestampRepeatedValue", + "TimestampRepeatedValue", REQUIRED, R"({ "repeatedTimestamp": [ "0001-01-01T00:00:00Z", @@ -1583,68 +1994,68 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, "repeated_timestamp: {seconds: -62135596800}" "repeated_timestamp: {seconds: 253402300799 nanos: 999999999}"); RunValidJsonTest( - "TimestampWithPositiveOffset", + "TimestampWithPositiveOffset", REQUIRED, R"({"optionalTimestamp": "1970-01-01T08:00:00+08:00"})", "optional_timestamp: {seconds: 0}"); RunValidJsonTest( - "TimestampWithNegativeOffset", + "TimestampWithNegativeOffset", REQUIRED, R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})", "optional_timestamp: {seconds: 0}"); ExpectParseFailureForJson( - "TimestampJsonInputTooSmall", + "TimestampJsonInputTooSmall", REQUIRED, R"({"optionalTimestamp": "0000-01-01T00:00:00Z"})"); ExpectParseFailureForJson( - "TimestampJsonInputTooLarge", + "TimestampJsonInputTooLarge", REQUIRED, R"({"optionalTimestamp": "10000-01-01T00:00:00Z"})"); ExpectParseFailureForJson( - "TimestampJsonInputMissingZ", + "TimestampJsonInputMissingZ", REQUIRED, R"({"optionalTimestamp": "0001-01-01T00:00:00"})"); ExpectParseFailureForJson( - "TimestampJsonInputMissingT", + "TimestampJsonInputMissingT", REQUIRED, R"({"optionalTimestamp": "0001-01-01 00:00:00Z"})"); ExpectParseFailureForJson( - "TimestampJsonInputLowercaseZ", + "TimestampJsonInputLowercaseZ", REQUIRED, R"({"optionalTimestamp": "0001-01-01T00:00:00z"})"); ExpectParseFailureForJson( - "TimestampJsonInputLowercaseT", + "TimestampJsonInputLowercaseT", REQUIRED, R"({"optionalTimestamp": "0001-01-01t00:00:00Z"})"); ExpectSerializeFailureForJson( - "TimestampProtoInputTooSmall", + "TimestampProtoInputTooSmall", REQUIRED, "optional_timestamp: {seconds: -62135596801}"); ExpectSerializeFailureForJson( - "TimestampProtoInputTooLarge", + "TimestampProtoInputTooLarge", REQUIRED, "optional_timestamp: {seconds: 253402300800}"); RunValidJsonTestWithValidator( - "TimestampZeroNormalized", + "TimestampZeroNormalized", RECOMMENDED, R"({"optionalTimestamp": "1969-12-31T16:00:00-08:00"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00Z"; }); RunValidJsonTestWithValidator( - "TimestampHasZeroFractionalDigit", + "TimestampHasZeroFractionalDigit", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.000000000Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00Z"; }); RunValidJsonTestWithValidator( - "TimestampHas3FractionalDigits", + "TimestampHas3FractionalDigits", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.010000000Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00.010Z"; }); RunValidJsonTestWithValidator( - "TimestampHas6FractionalDigits", + "TimestampHas6FractionalDigits", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.000010000Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == "1970-01-01T00:00:00.000010Z"; }); RunValidJsonTestWithValidator( - "TimestampHas9FractionalDigits", + "TimestampHas9FractionalDigits", RECOMMENDED, R"({"optionalTimestamp": "1970-01-01T00:00:00.000000010Z"})", [](const Json::Value& value) { return value["optionalTimestamp"].asString() == @@ -1653,25 +2064,25 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // FieldMask RunValidJsonTest( - "FieldMask", + "FieldMask", REQUIRED, R"({"optionalFieldMask": "foo,barBaz"})", R"(optional_field_mask: {paths: "foo" paths: "bar_baz"})"); ExpectParseFailureForJson( - "FieldMaskInvalidCharacter", + "FieldMaskInvalidCharacter", RECOMMENDED, R"({"optionalFieldMask": "foo,bar_bar"})"); ExpectSerializeFailureForJson( - "FieldMaskPathsDontRoundTrip", + "FieldMaskPathsDontRoundTrip", RECOMMENDED, R"(optional_field_mask: {paths: "fooBar"})"); ExpectSerializeFailureForJson( - "FieldMaskNumbersDontRoundTrip", + "FieldMaskNumbersDontRoundTrip", RECOMMENDED, R"(optional_field_mask: {paths: "foo_3_bar"})"); ExpectSerializeFailureForJson( - "FieldMaskTooManyUnderscore", + "FieldMaskTooManyUnderscore", RECOMMENDED, R"(optional_field_mask: {paths: "foo__bar"})"); // Struct RunValidJsonTest( - "Struct", + "Struct", REQUIRED, R"({ "optionalStruct": { "nullValue": null, @@ -1737,27 +2148,27 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, )"); // Value RunValidJsonTest( - "ValueAcceptInteger", + "ValueAcceptInteger", REQUIRED, R"({"optionalValue": 1})", "optional_value: { number_value: 1}"); RunValidJsonTest( - "ValueAcceptFloat", + "ValueAcceptFloat", REQUIRED, R"({"optionalValue": 1.5})", "optional_value: { number_value: 1.5}"); RunValidJsonTest( - "ValueAcceptBool", + "ValueAcceptBool", REQUIRED, R"({"optionalValue": false})", "optional_value: { bool_value: false}"); RunValidJsonTest( - "ValueAcceptNull", + "ValueAcceptNull", REQUIRED, R"({"optionalValue": null})", "optional_value: { null_value: NULL_VALUE}"); RunValidJsonTest( - "ValueAcceptString", + "ValueAcceptString", REQUIRED, R"({"optionalValue": "hello"})", R"(optional_value: { string_value: "hello"})"); RunValidJsonTest( - "ValueAcceptList", + "ValueAcceptList", REQUIRED, R"({"optionalValue": [0, "hello"]})", R"( optional_value: { @@ -1772,7 +2183,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "ValueAcceptObject", + "ValueAcceptObject", REQUIRED, R"({"optionalValue": {"value": 1}})", R"( optional_value: { @@ -1789,27 +2200,27 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, // Any RunValidJsonTest( - "Any", + "Any", REQUIRED, R"({ "optionalAny": { - "@type": "type.googleapis.com/conformance.TestAllTypes", + "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypes", "optionalInt32": 12345 } })", R"( optional_any: { - [type.googleapis.com/conformance.TestAllTypes] { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypes] { optional_int32: 12345 } } )"); RunValidJsonTest( - "AnyNested", + "AnyNested", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Any", "value": { - "@type": "type.googleapis.com/conformance.TestAllTypes", + "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypes", "optionalInt32": 12345 } } @@ -1817,7 +2228,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, R"( optional_any: { [type.googleapis.com/google.protobuf.Any] { - [type.googleapis.com/conformance.TestAllTypes] { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypes] { optional_int32: 12345 } } @@ -1825,23 +2236,23 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, )"); // The special "@type" tag is not required to appear first. RunValidJsonTest( - "AnyUnorderedTypeTag", + "AnyUnorderedTypeTag", REQUIRED, R"({ "optionalAny": { "optionalInt32": 12345, - "@type": "type.googleapis.com/conformance.TestAllTypes" + "@type": "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypes" } })", R"( optional_any: { - [type.googleapis.com/conformance.TestAllTypes] { + [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypes] { optional_int32: 12345 } } )"); // Well-known types in Any. RunValidJsonTest( - "AnyWithInt32ValueWrapper", + "AnyWithInt32ValueWrapper", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Int32Value", @@ -1856,7 +2267,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "AnyWithDuration", + "AnyWithDuration", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Duration", @@ -1872,7 +2283,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "AnyWithTimestamp", + "AnyWithTimestamp", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Timestamp", @@ -1888,7 +2299,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "AnyWithFieldMask", + "AnyWithFieldMask", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.FieldMask", @@ -1903,7 +2314,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "AnyWithStruct", + "AnyWithStruct", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Struct", @@ -1925,7 +2336,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "AnyWithValueForJsonObject", + "AnyWithValueForJsonObject", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Value", @@ -1949,7 +2360,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, } )"); RunValidJsonTest( - "AnyWithValueForInteger", + "AnyWithValueForInteger", REQUIRED, R"({ "optionalAny": { "@type": "type.googleapis.com/google.protobuf.Value", @@ -1965,27 +2376,34 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner, )"); bool ok = true; - if (!CheckSetEmpty(expected_to_fail_, + if (!CheckSetEmpty(expected_to_fail_, "nonexistent_tests.txt", "These tests were listed in the failure list, but they " - "don't exist. Remove them from the failure list")) { + "don't exist. Remove them from the failure list by " + "running:\n" + " ./update_failure_list.py " + failure_list_filename_ + + " --remove nonexistent_tests.txt")) { ok = false; } - if (!CheckSetEmpty(unexpected_failing_tests_, + if (!CheckSetEmpty(unexpected_failing_tests_, "failing_tests.txt", "These tests failed. If they can't be fixed right now, " "you can add them to the failure list so the overall " - "suite can succeed")) { + "suite can succeed. Add them to the failure list by " + "running:\n" + " ./update_failure_list.py " + failure_list_filename_ + + " --add failing_tests.txt")) { + ok = false; + } + if (!CheckSetEmpty(unexpected_succeeding_tests_, "succeeding_tests.txt", + "These tests succeeded, even though they were listed in " + "the failure list. Remove them from the failure list " + "by running:\n" + " ./update_failure_list.py " + failure_list_filename_ + + " --remove succeeding_tests.txt")) { ok = false; } - // Sometimes the testee may be fixed before we update the failure list (e.g., - // the testee is from a different component). We warn about this case but - // don't consider it an overall test failure. - CheckSetEmpty(unexpected_succeeding_tests_, - "These tests succeeded, even though they were listed in " - "the failure list. Remove them from the failure list"); - if (verbose_) { - CheckSetEmpty(skipped_, + CheckSetEmpty(skipped_, "", "These tests were skipped (probably because support for some " "features is not implemented)"); } diff --git a/packager/third_party/protobuf/conformance/conformance_test.h b/packager/third_party/protobuf/conformance/conformance_test.h index 75fc97bc1a..581c747204 100644 --- a/packager/third_party/protobuf/conformance/conformance_test.h +++ b/packager/third_party/protobuf/conformance/conformance_test.h @@ -49,9 +49,14 @@ namespace conformance { class ConformanceRequest; class ConformanceResponse; -class TestAllTypes; } // namespace conformance +namespace protobuf_test_messages { +namespace proto3 { +class TestAllTypes; +} // namespace proto3 +} // namespace protobuf_test_messages + namespace google { namespace protobuf { @@ -91,14 +96,30 @@ class ConformanceTestRunner { // class ConformanceTestSuite { public: - ConformanceTestSuite() : verbose_(false) {} + ConformanceTestSuite() : verbose_(false), enforce_recommended_(false) {} void SetVerbose(bool verbose) { verbose_ = verbose; } // Sets the list of tests that are expected to fail when RunSuite() is called. // RunSuite() will fail unless the set of failing tests is exactly the same // as this list. - void SetFailureList(const std::vector& failure_list); + // + // The filename here is *only* used to create/format useful error messages for + // how to update the failure list. We do NOT read this file at all. + void SetFailureList(const std::string& filename, + const std::vector& failure_list); + + // Whether to require the testee to pass RECOMMENDED tests. By default failing + // a RECOMMENDED test case will not fail the entire suite but will only + // generated a warning. If this flag is set to true, RECOMMENDED tests will + // be treated the same way as REQUIRED tests and failing a RECOMMENDED test + // case will cause the entire test suite to fail as well. An implementation + // can enable this if it wants to be strictly conforming to protobuf spec. + // See the comments about ConformanceLevel below to learn more about the + // difference between REQUIRED and RECOMMENDED test cases. + void SetEnforceRecommended(bool value) { + enforce_recommended_ = value; + } // Run all the conformance tests against the given test runner. // Test output will be stored in "output". @@ -109,8 +130,27 @@ class ConformanceTestSuite { bool RunSuite(ConformanceTestRunner* runner, std::string* output); private: + // Test cases are classified into a few categories: + // REQUIRED: the test case must be passed for an implementation to be + // interoperable with other implementations. For example, a + // parser implementaiton must accept both packed and unpacked + // form of repeated primitive fields. + // RECOMMENDED: the test case is not required for the implementation to + // be interoperable with other implementations, but is + // recommended for best performance and compatibility. For + // example, a proto3 serializer should serialize repeated + // primitive fields in packed form, but an implementation + // failing to do so will still be able to communicate with + // other implementations. + enum ConformanceLevel { + REQUIRED = 0, + RECOMMENDED = 1, + }; + string ConformanceLevelToString(ConformanceLevel level); + void ReportSuccess(const std::string& test_name); void ReportFailure(const string& test_name, + ConformanceLevel level, const conformance::ConformanceRequest& request, const conformance::ConformanceResponse& response, const char* fmt, ...); @@ -120,35 +160,60 @@ class ConformanceTestSuite { void RunTest(const std::string& test_name, const conformance::ConformanceRequest& request, conformance::ConformanceResponse* response); - void RunValidInputTest(const string& test_name, const string& input, + void RunValidInputTest(const string& test_name, + ConformanceLevel level, + const string& input, conformance::WireFormat input_format, const string& equivalent_text_format, conformance::WireFormat requested_output); - void RunValidJsonTest(const string& test_name, const string& input_json, + void RunValidJsonTest(const string& test_name, + ConformanceLevel level, + const string& input_json, const string& equivalent_text_format); - void RunValidJsonTestWithProtobufInput(const string& test_name, - const conformance::TestAllTypes& input, - const string& equivalent_text_format); + void RunValidJsonTestWithProtobufInput( + const string& test_name, + ConformanceLevel level, + const protobuf_test_messages::proto3::TestAllTypes& input, + const string& equivalent_text_format); + void RunValidProtobufTest(const string& test_name, ConformanceLevel level, + const string& input_protobuf, + const string& equivalent_text_format); + void RunValidProtobufTestWithMessage( + const string& test_name, ConformanceLevel level, + const protobuf_test_messages::proto3::TestAllTypes& input, + const string& equivalent_text_format); typedef std::function Validator; void RunValidJsonTestWithValidator(const string& test_name, + ConformanceLevel level, const string& input_json, const Validator& validator); void ExpectParseFailureForJson(const string& test_name, + ConformanceLevel level, const string& input_json); void ExpectSerializeFailureForJson(const string& test_name, + ConformanceLevel level, const string& text_format); void ExpectParseFailureForProto(const std::string& proto, - const std::string& test_name); + const std::string& test_name, + ConformanceLevel level); void ExpectHardParseFailureForProto(const std::string& proto, - const std::string& test_name); + const std::string& test_name, + ConformanceLevel level); void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type); - bool CheckSetEmpty(const set& set_to_check, const char* msg); + void TestIllegalTags(); + void TestValidDataForType( + google::protobuf::FieldDescriptor::Type, + std::vector> values); + bool CheckSetEmpty(const std::set& set_to_check, + const std::string& write_to_file, const std::string& msg); ConformanceTestRunner* runner_; int successes_; int expected_failures_; bool verbose_; + bool enforce_recommended_; std::string output_; + std::string failure_list_filename_; // The set of test names that are expected to fail in this run, but haven't // failed yet. diff --git a/packager/third_party/protobuf/conformance/conformance_test_runner.cc b/packager/third_party/protobuf/conformance/conformance_test_runner.cc index 376a60b9aa..7e91d388b0 100644 --- a/packager/third_party/protobuf/conformance/conformance_test_runner.cc +++ b/packager/third_party/protobuf/conformance/conformance_test_runner.cc @@ -251,6 +251,16 @@ void UsageError() { " should contain one test name per\n"); fprintf(stderr, " line. Use '#' for comments.\n"); + fprintf(stderr, + " --enforce_recommended Enforce that recommended test\n"); + fprintf(stderr, + " cases are also passing. Specify\n"); + fprintf(stderr, + " this flag if you want to be\n"); + fprintf(stderr, + " strictly conforming to protobuf\n"); + fprintf(stderr, + " spec.\n"); exit(1); } @@ -280,14 +290,18 @@ int main(int argc, char *argv[]) { char *program; google::protobuf::ConformanceTestSuite suite; + string failure_list_filename; vector failure_list; for (int arg = 1; arg < argc; ++arg) { if (strcmp(argv[arg], "--failure_list") == 0) { if (++arg == argc) UsageError(); + failure_list_filename = argv[arg]; ParseFailureList(argv[arg], &failure_list); } else if (strcmp(argv[arg], "--verbose") == 0) { suite.SetVerbose(true); + } else if (strcmp(argv[arg], "--enforce_recommended") == 0) { + suite.SetEnforceRecommended(true); } else if (argv[arg][0] == '-') { fprintf(stderr, "Unknown option: %s\n", argv[arg]); UsageError(); @@ -300,7 +314,7 @@ int main(int argc, char *argv[]) { } } - suite.SetFailureList(failure_list); + suite.SetFailureList(failure_list_filename, failure_list); ForkPipeRunner runner(program); std::string output; diff --git a/packager/third_party/protobuf/conformance/failure_list_cpp.txt b/packager/third_party/protobuf/conformance/failure_list_cpp.txt index 2ddf831c03..8a4fa7eb11 100644 --- a/packager/third_party/protobuf/conformance/failure_list_cpp.txt +++ b/packager/third_party/protobuf/conformance/failure_list_cpp.txt @@ -7,100 +7,38 @@ # TODO(haberman): insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.AnyUnorderedTypeTag.JsonOutput -JsonInput.AnyUnorderedTypeTag.ProtobufOutput -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForInteger.ProtobufOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.AnyWithValueForJsonObject.ProtobufOutput -JsonInput.BoolFieldDoubleQuotedFalse -JsonInput.BoolFieldDoubleQuotedTrue -JsonInput.BoolFieldIntegerOne -JsonInput.BoolFieldIntegerZero -JsonInput.BytesFieldInvalidBase64Characters -JsonInput.BytesFieldNoPadding -JsonInput.DoubleFieldTooSmall -JsonInput.DurationHasZeroFractionalDigit.Validator -JsonInput.DurationJsonInputTooLarge -JsonInput.DurationJsonInputTooSmall -JsonInput.DurationMissingS -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameDuplicate -JsonInput.FieldNameDuplicateDifferentCasing1 -JsonInput.FieldNameDuplicateDifferentCasing2 -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FieldNameNotQuoted -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldLeadingSpace -JsonInput.Int32FieldLeadingZero -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.Int32FieldMinValue.JsonOutput -JsonInput.Int32FieldMinValue.ProtobufOutput -JsonInput.Int32FieldNegativeWithLeadingZero -JsonInput.Int32FieldNotInteger -JsonInput.Int32FieldNotNumber -JsonInput.Int32FieldTooLarge -JsonInput.Int32FieldTooSmall -JsonInput.Int32FieldTrailingSpace -JsonInput.Int64FieldNotInteger -JsonInput.Int64FieldNotNumber -JsonInput.Int64FieldTooLarge -JsonInput.Int64FieldTooSmall -JsonInput.MapFieldValueIsNull -JsonInput.OneofFieldDuplicate -JsonInput.RepeatedFieldMessageElementIsNull -JsonInput.RepeatedFieldPrimitiveElementIsNull -JsonInput.RepeatedFieldTrailingComma -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotMessage -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotString -JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotBool -JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotInt -JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotString -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotMessage -JsonInput.StringFieldNotAString -JsonInput.StringFieldSurrogateInWrongOrder -JsonInput.StringFieldSurrogatePair.JsonOutput -JsonInput.StringFieldSurrogatePair.ProtobufOutput -JsonInput.StringFieldUnpairedHighSurrogate -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.StringFieldUppercaseEscapeLetter -JsonInput.TimestampJsonInputLowercaseT -JsonInput.TimestampJsonInputLowercaseZ -JsonInput.TimestampJsonInputMissingT -JsonInput.TimestampJsonInputMissingZ -JsonInput.TimestampJsonInputTooLarge -JsonInput.TimestampJsonInputTooSmall -JsonInput.TrailingCommaInAnObject -JsonInput.Uint32FieldNotInteger -JsonInput.Uint32FieldNotNumber -JsonInput.Uint32FieldTooLarge -JsonInput.Uint64FieldNotInteger -JsonInput.Uint64FieldNotNumber -JsonInput.Uint64FieldTooLarge -JsonInput.WrapperTypesWithNullValue.JsonOutput -JsonInput.WrapperTypesWithNullValue.ProtobufOutput -ProtobufInput.PrematureEofBeforeKnownRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInPackedField.BOOL -ProtobufInput.PrematureEofInPackedField.ENUM -ProtobufInput.PrematureEofInPackedField.INT32 -ProtobufInput.PrematureEofInPackedField.INT64 -ProtobufInput.PrematureEofInPackedField.SINT32 -ProtobufInput.PrematureEofInPackedField.SINT64 -ProtobufInput.PrematureEofInPackedField.UINT32 -ProtobufInput.PrematureEofInPackedField.UINT64 -ProtobufInput.PrematureEofInsideKnownRepeatedValue.MESSAGE -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.BoolFieldDoubleQuotedFalse +Recommended.JsonInput.BoolFieldDoubleQuotedTrue +Recommended.JsonInput.FieldMaskInvalidCharacter +Recommended.JsonInput.FieldNameDuplicate +Recommended.JsonInput.FieldNameDuplicateDifferentCasing1 +Recommended.JsonInput.FieldNameDuplicateDifferentCasing2 +Recommended.JsonInput.FieldNameNotQuoted +Recommended.JsonInput.MapFieldValueIsNull +Recommended.JsonInput.RepeatedFieldMessageElementIsNull +Recommended.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.JsonInput.RepeatedFieldTrailingComma +Recommended.JsonInput.RepeatedFieldTrailingCommaWithNewlines +Recommended.JsonInput.RepeatedFieldTrailingCommaWithSpace +Recommended.JsonInput.RepeatedFieldTrailingCommaWithSpaceCommaSpace +Recommended.JsonInput.StringFieldSingleQuoteBoth +Recommended.JsonInput.StringFieldSingleQuoteKey +Recommended.JsonInput.StringFieldSingleQuoteValue +Recommended.JsonInput.StringFieldUppercaseEscapeLetter +Recommended.JsonInput.TrailingCommaInAnObject +Recommended.JsonInput.TrailingCommaInAnObjectWithNewlines +Recommended.JsonInput.TrailingCommaInAnObjectWithSpace +Recommended.JsonInput.TrailingCommaInAnObjectWithSpaceCommaSpace +Required.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.ProtobufInput.PrematureEofInPackedField.BOOL +Required.ProtobufInput.PrematureEofInPackedField.ENUM +Required.ProtobufInput.PrematureEofInPackedField.INT32 +Required.ProtobufInput.PrematureEofInPackedField.INT64 +Required.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.ProtobufInput.PrematureEofInPackedField.UINT64 diff --git a/packager/third_party/protobuf/conformance/failure_list_csharp.txt b/packager/third_party/protobuf/conformance/failure_list_csharp.txt index a46cee472b..922db94c09 100644 --- a/packager/third_party/protobuf/conformance/failure_list_csharp.txt +++ b/packager/third_party/protobuf/conformance/failure_list_csharp.txt @@ -1,16 +1,4 @@ -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FieldNameWithMixedCases.JsonOutput -JsonInput.FieldNameWithMixedCases.ProtobufOutput -JsonInput.FieldNameWithMixedCases.Validator -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinValue.JsonOutput -JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput -JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.StringFieldSurrogatePair.JsonOutput -JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput -JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput +Required.ProtobufInput.IllegalZeroFieldNum_Case_0 +Required.ProtobufInput.IllegalZeroFieldNum_Case_1 +Required.ProtobufInput.IllegalZeroFieldNum_Case_2 +Required.ProtobufInput.IllegalZeroFieldNum_Case_3 diff --git a/packager/third_party/protobuf/conformance/failure_list_java.txt b/packager/third_party/protobuf/conformance/failure_list_java.txt index 552c0cc9c4..632940efc8 100644 --- a/packager/third_party/protobuf/conformance/failure_list_java.txt +++ b/packager/third_party/protobuf/conformance/failure_list_java.txt @@ -4,46 +4,42 @@ # By listing them here we can keep tabs on which ones are failing and be sure # that we don't introduce regressions in other tests. -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.BoolFieldAllCapitalFalse -JsonInput.BoolFieldAllCapitalTrue -JsonInput.BoolFieldCamelCaseFalse -JsonInput.BoolFieldCamelCaseTrue -JsonInput.BoolFieldDoubleQuotedFalse -JsonInput.BoolFieldDoubleQuotedTrue -JsonInput.BoolMapFieldKeyNotQuoted -JsonInput.DoubleFieldInfinityNotQuoted -JsonInput.DoubleFieldNanNotQuoted -JsonInput.DoubleFieldNegativeInfinityNotQuoted -JsonInput.EnumFieldNotQuoted -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameDuplicate -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameNotQuoted -JsonInput.FloatFieldInfinityNotQuoted -JsonInput.FloatFieldNanNotQuoted -JsonInput.FloatFieldNegativeInfinityNotQuoted -JsonInput.Int32FieldLeadingZero -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinValue.JsonOutput -JsonInput.Int32FieldNegativeWithLeadingZero -JsonInput.Int32FieldPlusSign -JsonInput.Int32MapFieldKeyNotQuoted -JsonInput.Int64MapFieldKeyNotQuoted -JsonInput.JsonWithComments -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt -JsonInput.StringFieldNotAString -JsonInput.StringFieldSurrogateInWrongOrder -JsonInput.StringFieldUnpairedHighSurrogate -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.StringFieldUppercaseEscapeLetter -JsonInput.Uint32MapFieldKeyNotQuoted -JsonInput.Uint64MapFieldKeyNotQuoted +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.BoolFieldAllCapitalFalse +Recommended.JsonInput.BoolFieldAllCapitalTrue +Recommended.JsonInput.BoolFieldCamelCaseFalse +Recommended.JsonInput.BoolFieldCamelCaseTrue +Recommended.JsonInput.BoolFieldDoubleQuotedFalse +Recommended.JsonInput.BoolFieldDoubleQuotedTrue +Recommended.JsonInput.BoolMapFieldKeyNotQuoted +Recommended.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.JsonInput.DoubleFieldNanNotQuoted +Recommended.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.JsonInput.FieldMaskInvalidCharacter +Recommended.JsonInput.FieldNameDuplicate +Recommended.JsonInput.FieldNameNotQuoted +Recommended.JsonInput.FloatFieldInfinityNotQuoted +Recommended.JsonInput.FloatFieldNanNotQuoted +Recommended.JsonInput.FloatFieldNegativeInfinityNotQuoted +Recommended.JsonInput.Int32MapFieldKeyNotQuoted +Recommended.JsonInput.Int64MapFieldKeyNotQuoted +Recommended.JsonInput.JsonWithComments +Recommended.JsonInput.StringFieldSingleQuoteBoth +Recommended.JsonInput.StringFieldSingleQuoteKey +Recommended.JsonInput.StringFieldSingleQuoteValue +Recommended.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.JsonInput.Uint32MapFieldKeyNotQuoted +Recommended.JsonInput.Uint64MapFieldKeyNotQuoted +Required.JsonInput.EnumFieldNotQuoted +Required.JsonInput.Int32FieldLeadingZero +Required.JsonInput.Int32FieldNegativeWithLeadingZero +Required.JsonInput.Int32FieldPlusSign +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.JsonInput.StringFieldNotAString +Required.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE diff --git a/packager/third_party/protobuf/conformance/failure_list_js.txt b/packager/third_party/protobuf/conformance/failure_list_js.txt new file mode 100644 index 0000000000..5414a2f985 --- /dev/null +++ b/packager/third_party/protobuf/conformance/failure_list_js.txt @@ -0,0 +1,15 @@ +Required.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.BOOL.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.DOUBLE.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.FIXED32.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.FIXED64.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.FLOAT.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.INT32.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.INT64.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.SFIXED32.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.SFIXED64.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.SINT32.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.SINT64.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.UINT32.ProtobufOutput +Required.ProtobufInput.ValidDataRepeated.UINT64.ProtobufOutput diff --git a/packager/third_party/protobuf/conformance/failure_list_objc.txt b/packager/third_party/protobuf/conformance/failure_list_objc.txt index 5dac3501f1..e34501ead7 100644 --- a/packager/third_party/protobuf/conformance/failure_list_objc.txt +++ b/packager/third_party/protobuf/conformance/failure_list_objc.txt @@ -1,4 +1,2 @@ -# No tests currently failing. -# -# json input or output tests are skipped (in conformance_objc.m) as mobile -# platforms don't support json wire format to avoid code bloat. +# JSON input or output tests are skipped (in conformance_objc.m) as mobile +# platforms don't support JSON wire format to avoid code bloat. diff --git a/packager/third_party/protobuf/conformance/failure_list_php.txt b/packager/third_party/protobuf/conformance/failure_list_php.txt new file mode 100644 index 0000000000..2bf9bb12e0 --- /dev/null +++ b/packager/third_party/protobuf/conformance/failure_list_php.txt @@ -0,0 +1,118 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.JsonInput.TimestampHas3FractionalDigits.Validator +Recommended.JsonInput.TimestampHas6FractionalDigits.Validator +Recommended.JsonInput.TimestampHas9FractionalDigits.Validator +Recommended.JsonInput.TimestampHasZeroFractionalDigit.Validator +Recommended.JsonInput.TimestampZeroNormalized.Validator +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.JsonInput.Any.JsonOutput +Required.JsonInput.Any.ProtobufOutput +Required.JsonInput.AnyNested.JsonOutput +Required.JsonInput.AnyNested.ProtobufOutput +Required.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.JsonInput.AnyWithDuration.JsonOutput +Required.JsonInput.AnyWithDuration.ProtobufOutput +Required.JsonInput.AnyWithFieldMask.JsonOutput +Required.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.JsonInput.AnyWithStruct.JsonOutput +Required.JsonInput.AnyWithStruct.ProtobufOutput +Required.JsonInput.AnyWithTimestamp.JsonOutput +Required.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.JsonInput.AnyWithValueForInteger.JsonOutput +Required.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.JsonInput.DurationMaxValue.JsonOutput +Required.JsonInput.DurationMaxValue.ProtobufOutput +Required.JsonInput.DurationMinValue.JsonOutput +Required.JsonInput.DurationMinValue.ProtobufOutput +Required.JsonInput.DurationRepeatedValue.JsonOutput +Required.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.JsonInput.FieldMask.JsonOutput +Required.JsonInput.FieldMask.ProtobufOutput +Required.JsonInput.OptionalBoolWrapper.JsonOutput +Required.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.JsonInput.OptionalBytesWrapper.JsonOutput +Required.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.JsonInput.OptionalFloatWrapper.JsonOutput +Required.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.JsonInput.OptionalStringWrapper.JsonOutput +Required.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.JsonInput.RepeatedStringWrapper.JsonOutput +Required.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.JsonInput.Struct.JsonOutput +Required.JsonInput.Struct.ProtobufOutput +Required.JsonInput.TimestampMaxValue.JsonOutput +Required.JsonInput.TimestampMaxValue.ProtobufOutput +Required.JsonInput.TimestampMinValue.JsonOutput +Required.JsonInput.TimestampMinValue.ProtobufOutput +Required.JsonInput.TimestampRepeatedValue.JsonOutput +Required.JsonInput.TimestampRepeatedValue.ProtobufOutput +Required.JsonInput.TimestampWithNegativeOffset.JsonOutput +Required.JsonInput.TimestampWithNegativeOffset.ProtobufOutput +Required.JsonInput.TimestampWithPositiveOffset.JsonOutput +Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput +Required.JsonInput.ValueAcceptBool.JsonOutput +Required.JsonInput.ValueAcceptBool.ProtobufOutput +Required.JsonInput.ValueAcceptFloat.JsonOutput +Required.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.JsonInput.ValueAcceptInteger.JsonOutput +Required.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.JsonInput.ValueAcceptList.JsonOutput +Required.JsonInput.ValueAcceptList.ProtobufOutput +Required.JsonInput.ValueAcceptNull.JsonOutput +Required.JsonInput.ValueAcceptNull.ProtobufOutput +Required.JsonInput.ValueAcceptObject.JsonOutput +Required.JsonInput.ValueAcceptObject.ProtobufOutput +Required.JsonInput.ValueAcceptString.JsonOutput +Required.JsonInput.ValueAcceptString.ProtobufOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.DoubleFieldTooSmall +Required.JsonInput.Int32FieldNotInteger +Required.JsonInput.Int64FieldNotInteger +Required.JsonInput.Uint32FieldNotInteger +Required.JsonInput.Uint64FieldNotInteger +Required.JsonInput.Int32FieldLeadingSpace +Required.JsonInput.OneofFieldDuplicate +Required.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput diff --git a/packager/third_party/protobuf/conformance/failure_list_php_c.txt b/packager/third_party/protobuf/conformance/failure_list_php_c.txt new file mode 100644 index 0000000000..591997ef8c --- /dev/null +++ b/packager/third_party/protobuf/conformance/failure_list_php_c.txt @@ -0,0 +1,197 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.BoolFieldIntegerOne +Recommended.JsonInput.BoolFieldIntegerZero +Recommended.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.JsonInput.Int64FieldBeString.Validator +Recommended.JsonInput.MapFieldValueIsNull +Recommended.JsonInput.OneofZeroBytes.JsonOutput +Recommended.JsonInput.OneofZeroBytes.ProtobufOutput +Recommended.JsonInput.OneofZeroString.JsonOutput +Recommended.JsonInput.OneofZeroString.ProtobufOutput +Recommended.JsonInput.RepeatedFieldMessageElementIsNull +Recommended.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.JsonInput.StringEndsWithEscapeChar +Recommended.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.JsonInput.TimestampHas3FractionalDigits.Validator +Recommended.JsonInput.TimestampHas6FractionalDigits.Validator +Recommended.JsonInput.TimestampHas9FractionalDigits.Validator +Recommended.JsonInput.TimestampHasZeroFractionalDigit.Validator +Recommended.JsonInput.TimestampZeroNormalized.Validator +Recommended.JsonInput.Uint64FieldBeString.Validator +Recommended.ProtobufInput.OneofZeroBytes.JsonOutput +Recommended.ProtobufInput.OneofZeroBytes.ProtobufOutput +Recommended.ProtobufInput.OneofZeroString.JsonOutput +Recommended.ProtobufInput.OneofZeroString.ProtobufOutput +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.JsonInput.Any.JsonOutput +Required.JsonInput.Any.ProtobufOutput +Required.JsonInput.AnyNested.JsonOutput +Required.JsonInput.AnyNested.ProtobufOutput +Required.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.JsonInput.AnyWithDuration.JsonOutput +Required.JsonInput.AnyWithDuration.ProtobufOutput +Required.JsonInput.AnyWithFieldMask.JsonOutput +Required.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.JsonInput.AnyWithStruct.JsonOutput +Required.JsonInput.AnyWithStruct.ProtobufOutput +Required.JsonInput.AnyWithTimestamp.JsonOutput +Required.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.JsonInput.AnyWithValueForInteger.JsonOutput +Required.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.JsonInput.BoolMapField.JsonOutput +Required.JsonInput.DoubleFieldInfinity.JsonOutput +Required.JsonInput.DoubleFieldInfinity.ProtobufOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMaxPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldNan.JsonOutput +Required.JsonInput.DoubleFieldNan.ProtobufOutput +Required.JsonInput.DoubleFieldNegativeInfinity.JsonOutput +Required.JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput +Required.JsonInput.DoubleFieldQuotedValue.JsonOutput +Required.JsonInput.DoubleFieldQuotedValue.ProtobufOutput +Required.JsonInput.DurationMaxValue.JsonOutput +Required.JsonInput.DurationMaxValue.ProtobufOutput +Required.JsonInput.DurationMinValue.JsonOutput +Required.JsonInput.DurationMinValue.ProtobufOutput +Required.JsonInput.DurationRepeatedValue.JsonOutput +Required.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.JsonInput.EnumFieldNumericValueNonZero.JsonOutput +Required.JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput +Required.JsonInput.EnumFieldNumericValueZero.JsonOutput +Required.JsonInput.EnumFieldNumericValueZero.ProtobufOutput +Required.JsonInput.EnumFieldUnknownValue.Validator +Required.JsonInput.FieldMask.JsonOutput +Required.JsonInput.FieldMask.ProtobufOutput +Required.JsonInput.FloatFieldInfinity.JsonOutput +Required.JsonInput.FloatFieldInfinity.ProtobufOutput +Required.JsonInput.FloatFieldNan.JsonOutput +Required.JsonInput.FloatFieldNan.ProtobufOutput +Required.JsonInput.FloatFieldNegativeInfinity.JsonOutput +Required.JsonInput.FloatFieldNegativeInfinity.ProtobufOutput +Required.JsonInput.FloatFieldQuotedValue.JsonOutput +Required.JsonInput.FloatFieldQuotedValue.ProtobufOutput +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.Int32FieldExponentialFormat.JsonOutput +Required.JsonInput.Int32FieldExponentialFormat.ProtobufOutput +Required.JsonInput.Int32FieldFloatTrailingZero.JsonOutput +Required.JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput +Required.JsonInput.Int32FieldMaxFloatValue.JsonOutput +Required.JsonInput.Int32FieldMaxFloatValue.ProtobufOutput +Required.JsonInput.Int32FieldMinFloatValue.JsonOutput +Required.JsonInput.Int32FieldMinFloatValue.ProtobufOutput +Required.JsonInput.Int32FieldStringValue.JsonOutput +Required.JsonInput.Int32FieldStringValue.ProtobufOutput +Required.JsonInput.Int32FieldStringValueEscaped.JsonOutput +Required.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput +Required.JsonInput.Int64FieldMaxValue.JsonOutput +Required.JsonInput.Int64FieldMaxValue.ProtobufOutput +Required.JsonInput.Int64FieldMinValue.JsonOutput +Required.JsonInput.Int64FieldMinValue.ProtobufOutput +Required.JsonInput.MessageField.JsonOutput +Required.JsonInput.MessageField.ProtobufOutput +Required.JsonInput.OptionalBoolWrapper.JsonOutput +Required.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.JsonInput.OptionalBytesWrapper.JsonOutput +Required.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.JsonInput.OptionalFloatWrapper.JsonOutput +Required.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.JsonInput.OptionalStringWrapper.JsonOutput +Required.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotInt +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.JsonInput.RepeatedStringWrapper.JsonOutput +Required.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.JsonInput.StringFieldEscape.JsonOutput +Required.JsonInput.StringFieldEscape.ProtobufOutput +Required.JsonInput.StringFieldNotAString +Required.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput +Required.JsonInput.StringFieldUnicodeEscape.JsonOutput +Required.JsonInput.StringFieldUnicodeEscape.ProtobufOutput +Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput +Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput +Required.JsonInput.Struct.JsonOutput +Required.JsonInput.Struct.ProtobufOutput +Required.JsonInput.TimestampMaxValue.JsonOutput +Required.JsonInput.TimestampMaxValue.ProtobufOutput +Required.JsonInput.TimestampMinValue.JsonOutput +Required.JsonInput.TimestampMinValue.ProtobufOutput +Required.JsonInput.TimestampRepeatedValue.JsonOutput +Required.JsonInput.TimestampRepeatedValue.ProtobufOutput +Required.JsonInput.TimestampWithNegativeOffset.JsonOutput +Required.JsonInput.TimestampWithNegativeOffset.ProtobufOutput +Required.JsonInput.TimestampWithPositiveOffset.JsonOutput +Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput +Required.JsonInput.Uint32FieldMaxFloatValue.JsonOutput +Required.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput +Required.JsonInput.Uint64FieldMaxValue.JsonOutput +Required.JsonInput.Uint64FieldMaxValue.ProtobufOutput +Required.JsonInput.ValueAcceptBool.JsonOutput +Required.JsonInput.ValueAcceptBool.ProtobufOutput +Required.JsonInput.ValueAcceptFloat.JsonOutput +Required.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.JsonInput.ValueAcceptInteger.JsonOutput +Required.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.JsonInput.ValueAcceptList.JsonOutput +Required.JsonInput.ValueAcceptList.ProtobufOutput +Required.JsonInput.ValueAcceptNull.JsonOutput +Required.JsonInput.ValueAcceptNull.ProtobufOutput +Required.JsonInput.ValueAcceptObject.JsonOutput +Required.JsonInput.ValueAcceptObject.ProtobufOutput +Required.JsonInput.ValueAcceptString.JsonOutput +Required.JsonInput.ValueAcceptString.ProtobufOutput +Required.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput diff --git a/packager/third_party/protobuf/conformance/failure_list_php_zts_c.txt b/packager/third_party/protobuf/conformance/failure_list_php_zts_c.txt new file mode 100644 index 0000000000..d9a8fe36d9 --- /dev/null +++ b/packager/third_party/protobuf/conformance/failure_list_php_zts_c.txt @@ -0,0 +1,225 @@ +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.BoolFieldIntegerOne +Recommended.JsonInput.BoolFieldIntegerZero +Recommended.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.JsonInput.Int64FieldBeString.Validator +Recommended.JsonInput.OneofZeroBytes.JsonOutput +Recommended.JsonInput.OneofZeroBytes.ProtobufOutput +Recommended.JsonInput.OneofZeroDouble.JsonOutput +Recommended.JsonInput.OneofZeroDouble.ProtobufOutput +Recommended.JsonInput.OneofZeroFloat.JsonOutput +Recommended.JsonInput.OneofZeroFloat.ProtobufOutput +Recommended.JsonInput.OneofZeroString.JsonOutput +Recommended.JsonInput.OneofZeroString.ProtobufOutput +Recommended.JsonInput.OneofZeroUint32.JsonOutput +Recommended.JsonInput.OneofZeroUint32.ProtobufOutput +Recommended.JsonInput.OneofZeroUint64.JsonOutput +Recommended.JsonInput.OneofZeroUint64.ProtobufOutput +Recommended.JsonInput.StringEndsWithEscapeChar +Recommended.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.JsonInput.TimestampHas3FractionalDigits.Validator +Recommended.JsonInput.TimestampHas6FractionalDigits.Validator +Recommended.JsonInput.TimestampHas9FractionalDigits.Validator +Recommended.JsonInput.TimestampHasZeroFractionalDigit.Validator +Recommended.JsonInput.TimestampZeroNormalized.Validator +Recommended.JsonInput.Uint64FieldBeString.Validator +Recommended.ProtobufInput.OneofZeroBytes.JsonOutput +Recommended.ProtobufInput.OneofZeroBytes.ProtobufOutput +Recommended.ProtobufInput.OneofZeroString.JsonOutput +Recommended.ProtobufInput.OneofZeroString.ProtobufOutput +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.JsonInput.AllFieldAcceptNull.ProtobufOutput +Required.JsonInput.Any.JsonOutput +Required.JsonInput.Any.ProtobufOutput +Required.JsonInput.AnyNested.JsonOutput +Required.JsonInput.AnyNested.ProtobufOutput +Required.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.JsonInput.AnyWithDuration.JsonOutput +Required.JsonInput.AnyWithDuration.ProtobufOutput +Required.JsonInput.AnyWithFieldMask.JsonOutput +Required.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.JsonInput.AnyWithStruct.JsonOutput +Required.JsonInput.AnyWithStruct.ProtobufOutput +Required.JsonInput.AnyWithTimestamp.JsonOutput +Required.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.JsonInput.AnyWithValueForInteger.JsonOutput +Required.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.JsonInput.BoolFieldFalse.ProtobufOutput +Required.JsonInput.BoolMapField.JsonOutput +Required.JsonInput.DoubleFieldInfinity.JsonOutput +Required.JsonInput.DoubleFieldInfinity.ProtobufOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMaxPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldNan.JsonOutput +Required.JsonInput.DoubleFieldNan.ProtobufOutput +Required.JsonInput.DoubleFieldNegativeInfinity.JsonOutput +Required.JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput +Required.JsonInput.DoubleFieldQuotedValue.JsonOutput +Required.JsonInput.DoubleFieldQuotedValue.ProtobufOutput +Required.JsonInput.DurationMaxValue.JsonOutput +Required.JsonInput.DurationMaxValue.ProtobufOutput +Required.JsonInput.DurationMinValue.JsonOutput +Required.JsonInput.DurationMinValue.ProtobufOutput +Required.JsonInput.DurationRepeatedValue.JsonOutput +Required.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.JsonInput.EnumField.ProtobufOutput +Required.JsonInput.EnumFieldNumericValueNonZero.JsonOutput +Required.JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput +Required.JsonInput.EnumFieldNumericValueZero.JsonOutput +Required.JsonInput.EnumFieldNumericValueZero.ProtobufOutput +Required.JsonInput.EnumFieldUnknownValue.Validator +Required.JsonInput.FieldMask.JsonOutput +Required.JsonInput.FieldMask.ProtobufOutput +Required.JsonInput.FloatFieldInfinity.JsonOutput +Required.JsonInput.FloatFieldInfinity.ProtobufOutput +Required.JsonInput.FloatFieldNan.JsonOutput +Required.JsonInput.FloatFieldNan.ProtobufOutput +Required.JsonInput.FloatFieldNegativeInfinity.JsonOutput +Required.JsonInput.FloatFieldNegativeInfinity.ProtobufOutput +Required.JsonInput.FloatFieldQuotedValue.JsonOutput +Required.JsonInput.FloatFieldQuotedValue.ProtobufOutput +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.Int32FieldExponentialFormat.JsonOutput +Required.JsonInput.Int32FieldExponentialFormat.ProtobufOutput +Required.JsonInput.Int32FieldFloatTrailingZero.JsonOutput +Required.JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput +Required.JsonInput.Int32FieldMaxFloatValue.JsonOutput +Required.JsonInput.Int32FieldMaxFloatValue.ProtobufOutput +Required.JsonInput.Int32FieldMinFloatValue.JsonOutput +Required.JsonInput.Int32FieldMinFloatValue.ProtobufOutput +Required.JsonInput.Int32FieldStringValue.JsonOutput +Required.JsonInput.Int32FieldStringValue.ProtobufOutput +Required.JsonInput.Int32FieldStringValueEscaped.JsonOutput +Required.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput +Required.JsonInput.Int32MapEscapedKey.JsonOutput +Required.JsonInput.Int32MapEscapedKey.ProtobufOutput +Required.JsonInput.Int32MapField.JsonOutput +Required.JsonInput.Int32MapField.ProtobufOutput +Required.JsonInput.Int64FieldMaxValue.JsonOutput +Required.JsonInput.Int64FieldMaxValue.ProtobufOutput +Required.JsonInput.Int64FieldMinValue.JsonOutput +Required.JsonInput.Int64FieldMinValue.ProtobufOutput +Required.JsonInput.Int64MapEscapedKey.JsonOutput +Required.JsonInput.Int64MapEscapedKey.ProtobufOutput +Required.JsonInput.Int64MapField.JsonOutput +Required.JsonInput.Int64MapField.ProtobufOutput +Required.JsonInput.MessageField.JsonOutput +Required.JsonInput.MessageField.ProtobufOutput +Required.JsonInput.MessageMapField.JsonOutput +Required.JsonInput.MessageMapField.ProtobufOutput +Required.JsonInput.MessageRepeatedField.JsonOutput +Required.JsonInput.MessageRepeatedField.ProtobufOutput +Required.JsonInput.OptionalBoolWrapper.JsonOutput +Required.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.JsonInput.OptionalBytesWrapper.JsonOutput +Required.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.JsonInput.OptionalFloatWrapper.JsonOutput +Required.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.JsonInput.OptionalStringWrapper.JsonOutput +Required.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.JsonInput.PrimitiveRepeatedField.JsonOutput +Required.JsonInput.PrimitiveRepeatedField.ProtobufOutput +Required.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.JsonInput.RepeatedStringWrapper.JsonOutput +Required.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.JsonInput.StringFieldEscape.JsonOutput +Required.JsonInput.StringFieldEscape.ProtobufOutput +Required.JsonInput.StringFieldNotAString +Required.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput +Required.JsonInput.StringFieldUnicodeEscape.JsonOutput +Required.JsonInput.StringFieldUnicodeEscape.ProtobufOutput +Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput +Required.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput +Required.JsonInput.Struct.JsonOutput +Required.JsonInput.Struct.ProtobufOutput +Required.JsonInput.TimestampMaxValue.JsonOutput +Required.JsonInput.TimestampMaxValue.ProtobufOutput +Required.JsonInput.TimestampMinValue.JsonOutput +Required.JsonInput.TimestampMinValue.ProtobufOutput +Required.JsonInput.TimestampRepeatedValue.JsonOutput +Required.JsonInput.TimestampRepeatedValue.ProtobufOutput +Required.JsonInput.TimestampWithNegativeOffset.JsonOutput +Required.JsonInput.TimestampWithNegativeOffset.ProtobufOutput +Required.JsonInput.TimestampWithPositiveOffset.JsonOutput +Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput +Required.JsonInput.Uint32FieldMaxFloatValue.JsonOutput +Required.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput +Required.JsonInput.Uint32MapField.JsonOutput +Required.JsonInput.Uint32MapField.ProtobufOutput +Required.JsonInput.Uint64FieldMaxValue.JsonOutput +Required.JsonInput.Uint64FieldMaxValue.ProtobufOutput +Required.JsonInput.Uint64MapField.JsonOutput +Required.JsonInput.Uint64MapField.ProtobufOutput +Required.JsonInput.ValueAcceptBool.JsonOutput +Required.JsonInput.ValueAcceptBool.ProtobufOutput +Required.JsonInput.ValueAcceptFloat.JsonOutput +Required.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.JsonInput.ValueAcceptInteger.JsonOutput +Required.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.JsonInput.ValueAcceptList.JsonOutput +Required.JsonInput.ValueAcceptList.ProtobufOutput +Required.JsonInput.ValueAcceptNull.JsonOutput +Required.JsonInput.ValueAcceptNull.ProtobufOutput +Required.JsonInput.ValueAcceptObject.JsonOutput +Required.JsonInput.ValueAcceptObject.ProtobufOutput +Required.JsonInput.ValueAcceptString.JsonOutput +Required.JsonInput.ValueAcceptString.ProtobufOutput +Required.JsonInput.WrapperTypesWithNullValue.ProtobufOutput +Required.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.ProtobufOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput +Required.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput diff --git a/packager/third_party/protobuf/conformance/failure_list_python.txt b/packager/third_party/protobuf/conformance/failure_list_python.txt index d2e52637bd..965b8212a5 100644 --- a/packager/third_party/protobuf/conformance/failure_list_python.txt +++ b/packager/third_party/protobuf/conformance/failure_list_python.txt @@ -1,85 +1,17 @@ -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.Any.JsonOutput -JsonInput.Any.ProtobufOutput -JsonInput.AnyNested.JsonOutput -JsonInput.AnyNested.ProtobufOutput -JsonInput.AnyUnorderedTypeTag.JsonOutput -JsonInput.AnyUnorderedTypeTag.ProtobufOutput -JsonInput.AnyWithDuration.JsonOutput -JsonInput.AnyWithDuration.ProtobufOutput -JsonInput.AnyWithFieldMask.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.AnyWithInt32ValueWrapper.JsonOutput -JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput -JsonInput.AnyWithStruct.JsonOutput -JsonInput.AnyWithStruct.ProtobufOutput -JsonInput.AnyWithTimestamp.JsonOutput -JsonInput.AnyWithTimestamp.ProtobufOutput -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForInteger.ProtobufOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.AnyWithValueForJsonObject.ProtobufOutput -JsonInput.BytesFieldInvalidBase64Characters -JsonInput.DoubleFieldInfinityNotQuoted -JsonInput.DoubleFieldNanNotQuoted -JsonInput.DoubleFieldNegativeInfinityNotQuoted -JsonInput.DoubleFieldTooSmall -JsonInput.DurationJsonInputTooLarge -JsonInput.DurationJsonInputTooSmall -JsonInput.DurationMissingS -JsonInput.EnumFieldNumericValueNonZero.JsonOutput -JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -JsonInput.EnumFieldNumericValueZero.JsonOutput -JsonInput.EnumFieldNumericValueZero.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FloatFieldInfinityNotQuoted -JsonInput.FloatFieldNanNotQuoted -JsonInput.FloatFieldNegativeInfinityNotQuoted -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.Int32FieldMinValue.JsonOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.OriginalProtoFieldName.ProtobufOutput -JsonInput.RepeatedFieldMessageElementIsNull -JsonInput.RepeatedFieldPrimitiveElementIsNull -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool -JsonInput.StringFieldSurrogatePair.JsonOutput -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.Struct.JsonOutput -JsonInput.Struct.ProtobufOutput -JsonInput.TimestampJsonInputLowercaseT -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.ValueAcceptBool.JsonOutput -JsonInput.ValueAcceptBool.ProtobufOutput -JsonInput.ValueAcceptFloat.JsonOutput -JsonInput.ValueAcceptFloat.ProtobufOutput -JsonInput.ValueAcceptInteger.JsonOutput -JsonInput.ValueAcceptInteger.ProtobufOutput -JsonInput.ValueAcceptList.JsonOutput -JsonInput.ValueAcceptList.ProtobufOutput -JsonInput.ValueAcceptNull.JsonOutput -JsonInput.ValueAcceptNull.ProtobufOutput -JsonInput.ValueAcceptObject.JsonOutput -JsonInput.ValueAcceptObject.ProtobufOutput -JsonInput.ValueAcceptString.JsonOutput -JsonInput.ValueAcceptString.ProtobufOutput -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.JsonInput.DoubleFieldNanNotQuoted +Recommended.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.JsonInput.FloatFieldInfinityNotQuoted +Recommended.JsonInput.FloatFieldNanNotQuoted +Recommended.JsonInput.FloatFieldNegativeInfinityNotQuoted +Required.JsonInput.BytesFieldInvalidBase64Characters +Required.JsonInput.DoubleFieldTooSmall +Required.JsonInput.EnumFieldUnknownValue.Validator +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool +Required.JsonInput.TimestampJsonInputLowercaseT +Required.ProtobufInput.IllegalZeroFieldNum_Case_0 +Required.ProtobufInput.IllegalZeroFieldNum_Case_1 +Required.ProtobufInput.IllegalZeroFieldNum_Case_2 +Required.ProtobufInput.IllegalZeroFieldNum_Case_3 diff --git a/packager/third_party/protobuf/conformance/failure_list_python_cpp.txt b/packager/third_party/protobuf/conformance/failure_list_python_cpp.txt index 7b5e45f9ff..92404d2f6a 100644 --- a/packager/third_party/protobuf/conformance/failure_list_python_cpp.txt +++ b/packager/third_party/protobuf/conformance/failure_list_python_cpp.txt @@ -7,104 +7,32 @@ # TODO(haberman): insert links to corresponding bugs tracking the issue. # Should we use GitHub issues or the Google-internal bug tracker? -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.Any.JsonOutput -JsonInput.Any.ProtobufOutput -JsonInput.AnyNested.JsonOutput -JsonInput.AnyNested.ProtobufOutput -JsonInput.AnyUnorderedTypeTag.JsonOutput -JsonInput.AnyUnorderedTypeTag.ProtobufOutput -JsonInput.AnyWithDuration.JsonOutput -JsonInput.AnyWithDuration.ProtobufOutput -JsonInput.AnyWithFieldMask.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.AnyWithInt32ValueWrapper.JsonOutput -JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput -JsonInput.AnyWithStruct.JsonOutput -JsonInput.AnyWithStruct.ProtobufOutput -JsonInput.AnyWithTimestamp.JsonOutput -JsonInput.AnyWithTimestamp.ProtobufOutput -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForInteger.ProtobufOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.AnyWithValueForJsonObject.ProtobufOutput -JsonInput.BytesFieldInvalidBase64Characters -JsonInput.DoubleFieldInfinityNotQuoted -JsonInput.DoubleFieldNanNotQuoted -JsonInput.DoubleFieldNegativeInfinityNotQuoted -JsonInput.DoubleFieldTooSmall -JsonInput.DurationJsonInputTooLarge -JsonInput.DurationJsonInputTooSmall -JsonInput.DurationMissingS -JsonInput.EnumFieldNumericValueNonZero.JsonOutput -JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -JsonInput.EnumFieldNumericValueZero.JsonOutput -JsonInput.EnumFieldNumericValueZero.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldMaskInvalidCharacter -JsonInput.FieldNameInLowerCamelCase.Validator -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameInSnakeCase.ProtobufOutput -JsonInput.FloatFieldInfinityNotQuoted -JsonInput.FloatFieldNanNotQuoted -JsonInput.FloatFieldNegativeInfinityNotQuoted -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.Int32FieldMinValue.JsonOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.OriginalProtoFieldName.ProtobufOutput -JsonInput.RepeatedFieldMessageElementIsNull -JsonInput.RepeatedFieldPrimitiveElementIsNull -JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool -JsonInput.StringFieldSurrogatePair.JsonOutput -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.Struct.JsonOutput -JsonInput.Struct.ProtobufOutput -JsonInput.TimestampJsonInputLowercaseT -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.ValueAcceptBool.JsonOutput -JsonInput.ValueAcceptBool.ProtobufOutput -JsonInput.ValueAcceptFloat.JsonOutput -JsonInput.ValueAcceptFloat.ProtobufOutput -JsonInput.ValueAcceptInteger.JsonOutput -JsonInput.ValueAcceptInteger.ProtobufOutput -JsonInput.ValueAcceptList.JsonOutput -JsonInput.ValueAcceptList.ProtobufOutput -JsonInput.ValueAcceptNull.JsonOutput -JsonInput.ValueAcceptNull.ProtobufOutput -JsonInput.ValueAcceptObject.JsonOutput -JsonInput.ValueAcceptObject.ProtobufOutput -JsonInput.ValueAcceptString.JsonOutput -JsonInput.ValueAcceptString.ProtobufOutput -ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE -ProtobufInput.PrematureEofInPackedField.BOOL -ProtobufInput.PrematureEofInPackedField.DOUBLE -ProtobufInput.PrematureEofInPackedField.ENUM -ProtobufInput.PrematureEofInPackedField.FIXED32 -ProtobufInput.PrematureEofInPackedField.FIXED64 -ProtobufInput.PrematureEofInPackedField.FLOAT -ProtobufInput.PrematureEofInPackedField.INT32 -ProtobufInput.PrematureEofInPackedField.INT64 -ProtobufInput.PrematureEofInPackedField.SFIXED32 -ProtobufInput.PrematureEofInPackedField.SFIXED64 -ProtobufInput.PrematureEofInPackedField.SINT32 -ProtobufInput.PrematureEofInPackedField.SINT64 -ProtobufInput.PrematureEofInPackedField.UINT32 -ProtobufInput.PrematureEofInPackedField.UINT64 -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.JsonInput.DoubleFieldInfinityNotQuoted +Recommended.JsonInput.DoubleFieldNanNotQuoted +Recommended.JsonInput.DoubleFieldNegativeInfinityNotQuoted +Recommended.JsonInput.FloatFieldInfinityNotQuoted +Recommended.JsonInput.FloatFieldNanNotQuoted +Recommended.JsonInput.FloatFieldNegativeInfinityNotQuoted +Required.JsonInput.BytesFieldInvalidBase64Characters +Required.JsonInput.DoubleFieldTooSmall +Required.JsonInput.EnumFieldUnknownValue.Validator +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool +Required.JsonInput.TimestampJsonInputLowercaseT +Required.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.ProtobufInput.PrematureEofInPackedField.BOOL +Required.ProtobufInput.PrematureEofInPackedField.DOUBLE +Required.ProtobufInput.PrematureEofInPackedField.ENUM +Required.ProtobufInput.PrematureEofInPackedField.FIXED32 +Required.ProtobufInput.PrematureEofInPackedField.FIXED64 +Required.ProtobufInput.PrematureEofInPackedField.FLOAT +Required.ProtobufInput.PrematureEofInPackedField.INT32 +Required.ProtobufInput.PrematureEofInPackedField.INT64 +Required.ProtobufInput.PrematureEofInPackedField.SFIXED32 +Required.ProtobufInput.PrematureEofInPackedField.SFIXED64 +Required.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.ProtobufInput.PrematureEofInPackedField.UINT64 diff --git a/packager/third_party/protobuf/conformance/failure_list_ruby.txt b/packager/third_party/protobuf/conformance/failure_list_ruby.txt index 7c12da0611..d899ee40d1 100644 --- a/packager/third_party/protobuf/conformance/failure_list_ruby.txt +++ b/packager/third_party/protobuf/conformance/failure_list_ruby.txt @@ -1,199 +1,135 @@ -DurationProtoInputTooLarge.JsonOutput -DurationProtoInputTooSmall.JsonOutput -FieldMaskNumbersDontRoundTrip.JsonOutput -FieldMaskPathsDontRoundTrip.JsonOutput -FieldMaskTooManyUnderscore.JsonOutput -JsonInput.Any.JsonOutput -JsonInput.Any.ProtobufOutput -JsonInput.AnyNested.JsonOutput -JsonInput.AnyNested.ProtobufOutput -JsonInput.AnyUnorderedTypeTag.JsonOutput -JsonInput.AnyUnorderedTypeTag.ProtobufOutput -JsonInput.AnyWithDuration.JsonOutput -JsonInput.AnyWithDuration.ProtobufOutput -JsonInput.AnyWithFieldMask.JsonOutput -JsonInput.AnyWithFieldMask.ProtobufOutput -JsonInput.AnyWithInt32ValueWrapper.JsonOutput -JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput -JsonInput.AnyWithStruct.JsonOutput -JsonInput.AnyWithStruct.ProtobufOutput -JsonInput.AnyWithTimestamp.JsonOutput -JsonInput.AnyWithTimestamp.ProtobufOutput -JsonInput.AnyWithValueForInteger.JsonOutput -JsonInput.AnyWithValueForInteger.ProtobufOutput -JsonInput.AnyWithValueForJsonObject.JsonOutput -JsonInput.AnyWithValueForJsonObject.ProtobufOutput -JsonInput.BoolFieldIntegerOne -JsonInput.BoolFieldIntegerZero -JsonInput.DoubleFieldInfinity.JsonOutput -JsonInput.DoubleFieldInfinity.ProtobufOutput -JsonInput.DoubleFieldMaxNegativeValue.JsonOutput -JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput -JsonInput.DoubleFieldMaxPositiveValue.JsonOutput -JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput -JsonInput.DoubleFieldMinNegativeValue.JsonOutput -JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput -JsonInput.DoubleFieldMinPositiveValue.JsonOutput -JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput -JsonInput.DoubleFieldNan.JsonOutput -JsonInput.DoubleFieldNan.ProtobufOutput -JsonInput.DoubleFieldNegativeInfinity.JsonOutput -JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput -JsonInput.DoubleFieldQuotedValue.JsonOutput -JsonInput.DoubleFieldQuotedValue.ProtobufOutput -JsonInput.DurationHas3FractionalDigits.Validator -JsonInput.DurationHas6FractionalDigits.Validator -JsonInput.DurationHas9FractionalDigits.Validator -JsonInput.DurationHasZeroFractionalDigit.Validator -JsonInput.DurationMaxValue.JsonOutput -JsonInput.DurationMaxValue.ProtobufOutput -JsonInput.DurationMinValue.JsonOutput -JsonInput.DurationMinValue.ProtobufOutput -JsonInput.DurationRepeatedValue.JsonOutput -JsonInput.DurationRepeatedValue.ProtobufOutput -JsonInput.EnumFieldNumericValueNonZero.JsonOutput -JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -JsonInput.EnumFieldNumericValueZero.JsonOutput -JsonInput.EnumFieldNumericValueZero.ProtobufOutput -JsonInput.EnumFieldUnknownValue.Validator -JsonInput.FieldMask.JsonOutput -JsonInput.FieldMask.ProtobufOutput -JsonInput.FieldNameInSnakeCase.JsonOutput -JsonInput.FieldNameWithMixedCases.JsonOutput -JsonInput.FieldNameWithMixedCases.ProtobufOutput -JsonInput.FieldNameWithMixedCases.Validator -JsonInput.FloatFieldInfinity.JsonOutput -JsonInput.FloatFieldInfinity.ProtobufOutput -JsonInput.FloatFieldNan.JsonOutput -JsonInput.FloatFieldNan.ProtobufOutput -JsonInput.FloatFieldNegativeInfinity.JsonOutput -JsonInput.FloatFieldNegativeInfinity.ProtobufOutput -JsonInput.FloatFieldQuotedValue.JsonOutput -JsonInput.FloatFieldQuotedValue.ProtobufOutput -JsonInput.FloatFieldTooLarge -JsonInput.FloatFieldTooSmall -JsonInput.Int32FieldExponentialFormat.JsonOutput -JsonInput.Int32FieldExponentialFormat.ProtobufOutput -JsonInput.Int32FieldFloatTrailingZero.JsonOutput -JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -JsonInput.Int32FieldMaxFloatValue.JsonOutput -JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -JsonInput.Int32FieldMinFloatValue.JsonOutput -JsonInput.Int32FieldMinFloatValue.ProtobufOutput -JsonInput.Int32FieldStringValue.JsonOutput -JsonInput.Int32FieldStringValue.ProtobufOutput -JsonInput.Int32FieldStringValueEscaped.JsonOutput -JsonInput.Int32FieldStringValueEscaped.ProtobufOutput -JsonInput.Int32MapEscapedKey.JsonOutput -JsonInput.Int32MapEscapedKey.ProtobufOutput -JsonInput.Int32MapField.JsonOutput -JsonInput.Int32MapField.ProtobufOutput -JsonInput.Int64FieldBeString.Validator -JsonInput.Int64FieldMaxValue.JsonOutput -JsonInput.Int64FieldMaxValue.ProtobufOutput -JsonInput.Int64FieldMinValue.JsonOutput -JsonInput.Int64FieldMinValue.ProtobufOutput -JsonInput.Int64MapEscapedKey.JsonOutput -JsonInput.Int64MapEscapedKey.ProtobufOutput -JsonInput.Int64MapField.JsonOutput -JsonInput.Int64MapField.ProtobufOutput -JsonInput.MessageField.JsonOutput -JsonInput.MessageField.ProtobufOutput -JsonInput.MessageMapField.JsonOutput -JsonInput.MessageMapField.ProtobufOutput -JsonInput.MessageRepeatedField.JsonOutput -JsonInput.MessageRepeatedField.ProtobufOutput -JsonInput.OptionalBoolWrapper.JsonOutput -JsonInput.OptionalBoolWrapper.ProtobufOutput -JsonInput.OptionalBytesWrapper.JsonOutput -JsonInput.OptionalBytesWrapper.ProtobufOutput -JsonInput.OptionalDoubleWrapper.JsonOutput -JsonInput.OptionalDoubleWrapper.ProtobufOutput -JsonInput.OptionalFloatWrapper.JsonOutput -JsonInput.OptionalFloatWrapper.ProtobufOutput -JsonInput.OptionalInt32Wrapper.JsonOutput -JsonInput.OptionalInt32Wrapper.ProtobufOutput -JsonInput.OptionalInt64Wrapper.JsonOutput -JsonInput.OptionalInt64Wrapper.ProtobufOutput -JsonInput.OptionalStringWrapper.JsonOutput -JsonInput.OptionalStringWrapper.ProtobufOutput -JsonInput.OptionalUint32Wrapper.JsonOutput -JsonInput.OptionalUint32Wrapper.ProtobufOutput -JsonInput.OptionalUint64Wrapper.JsonOutput -JsonInput.OptionalUint64Wrapper.ProtobufOutput -JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput -JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput -JsonInput.OriginalProtoFieldName.JsonOutput -JsonInput.PrimitiveRepeatedField.JsonOutput -JsonInput.PrimitiveRepeatedField.ProtobufOutput -JsonInput.RepeatedBoolWrapper.JsonOutput -JsonInput.RepeatedBoolWrapper.ProtobufOutput -JsonInput.RepeatedBytesWrapper.JsonOutput -JsonInput.RepeatedBytesWrapper.ProtobufOutput -JsonInput.RepeatedDoubleWrapper.JsonOutput -JsonInput.RepeatedDoubleWrapper.ProtobufOutput -JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt -JsonInput.RepeatedFloatWrapper.JsonOutput -JsonInput.RepeatedFloatWrapper.ProtobufOutput -JsonInput.RepeatedInt32Wrapper.JsonOutput -JsonInput.RepeatedInt32Wrapper.ProtobufOutput -JsonInput.RepeatedInt64Wrapper.JsonOutput -JsonInput.RepeatedInt64Wrapper.ProtobufOutput -JsonInput.RepeatedStringWrapper.JsonOutput -JsonInput.RepeatedStringWrapper.ProtobufOutput -JsonInput.RepeatedUint32Wrapper.JsonOutput -JsonInput.RepeatedUint32Wrapper.ProtobufOutput -JsonInput.RepeatedUint64Wrapper.JsonOutput -JsonInput.RepeatedUint64Wrapper.ProtobufOutput -JsonInput.StringFieldNotAString -JsonInput.StringFieldSurrogateInWrongOrder -JsonInput.StringFieldSurrogatePair.JsonOutput -JsonInput.StringFieldSurrogatePair.ProtobufOutput -JsonInput.StringFieldUnpairedHighSurrogate -JsonInput.StringFieldUnpairedLowSurrogate -JsonInput.Struct.JsonOutput -JsonInput.Struct.ProtobufOutput -JsonInput.TimestampHas3FractionalDigits.Validator -JsonInput.TimestampHas6FractionalDigits.Validator -JsonInput.TimestampHas9FractionalDigits.Validator -JsonInput.TimestampHasZeroFractionalDigit.Validator -JsonInput.TimestampMaxValue.JsonOutput -JsonInput.TimestampMaxValue.ProtobufOutput -JsonInput.TimestampMinValue.JsonOutput -JsonInput.TimestampMinValue.ProtobufOutput -JsonInput.TimestampRepeatedValue.JsonOutput -JsonInput.TimestampRepeatedValue.ProtobufOutput -JsonInput.TimestampWithNegativeOffset.JsonOutput -JsonInput.TimestampWithNegativeOffset.ProtobufOutput -JsonInput.TimestampWithPositiveOffset.JsonOutput -JsonInput.TimestampWithPositiveOffset.ProtobufOutput -JsonInput.TimestampZeroNormalized.Validator -JsonInput.Uint32FieldMaxFloatValue.JsonOutput -JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -JsonInput.Uint32MapField.JsonOutput -JsonInput.Uint32MapField.ProtobufOutput -JsonInput.Uint64FieldBeString.Validator -JsonInput.Uint64FieldMaxValue.JsonOutput -JsonInput.Uint64FieldMaxValue.ProtobufOutput -JsonInput.Uint64MapField.JsonOutput -JsonInput.Uint64MapField.ProtobufOutput -JsonInput.ValueAcceptBool.JsonOutput -JsonInput.ValueAcceptBool.ProtobufOutput -JsonInput.ValueAcceptFloat.JsonOutput -JsonInput.ValueAcceptFloat.ProtobufOutput -JsonInput.ValueAcceptInteger.JsonOutput -JsonInput.ValueAcceptInteger.ProtobufOutput -JsonInput.ValueAcceptList.JsonOutput -JsonInput.ValueAcceptList.ProtobufOutput -JsonInput.ValueAcceptNull.JsonOutput -JsonInput.ValueAcceptNull.ProtobufOutput -JsonInput.ValueAcceptObject.JsonOutput -JsonInput.ValueAcceptObject.ProtobufOutput -JsonInput.ValueAcceptString.JsonOutput -JsonInput.ValueAcceptString.ProtobufOutput -ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput -ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput -ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput -ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput -TimestampProtoInputTooLarge.JsonOutput -TimestampProtoInputTooSmall.JsonOutput +Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput +Recommended.FieldMaskPathsDontRoundTrip.JsonOutput +Recommended.FieldMaskTooManyUnderscore.JsonOutput +Recommended.JsonInput.DurationHas3FractionalDigits.Validator +Recommended.JsonInput.DurationHas6FractionalDigits.Validator +Recommended.JsonInput.DurationHas9FractionalDigits.Validator +Recommended.JsonInput.DurationHasZeroFractionalDigit.Validator +Recommended.JsonInput.Int64FieldBeString.Validator +Recommended.JsonInput.MapFieldValueIsNull +Recommended.JsonInput.RepeatedFieldMessageElementIsNull +Recommended.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.JsonInput.StringEndsWithEscapeChar +Recommended.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.JsonInput.StringFieldUnpairedLowSurrogate +Recommended.JsonInput.TimestampHas3FractionalDigits.Validator +Recommended.JsonInput.TimestampHas6FractionalDigits.Validator +Recommended.JsonInput.TimestampHas9FractionalDigits.Validator +Recommended.JsonInput.TimestampHasZeroFractionalDigit.Validator +Recommended.JsonInput.TimestampZeroNormalized.Validator +Recommended.JsonInput.Uint64FieldBeString.Validator +Required.DurationProtoInputTooLarge.JsonOutput +Required.DurationProtoInputTooSmall.JsonOutput +Required.JsonInput.Any.JsonOutput +Required.JsonInput.Any.ProtobufOutput +Required.JsonInput.AnyNested.JsonOutput +Required.JsonInput.AnyNested.ProtobufOutput +Required.JsonInput.AnyUnorderedTypeTag.JsonOutput +Required.JsonInput.AnyUnorderedTypeTag.ProtobufOutput +Required.JsonInput.AnyWithDuration.JsonOutput +Required.JsonInput.AnyWithDuration.ProtobufOutput +Required.JsonInput.AnyWithFieldMask.JsonOutput +Required.JsonInput.AnyWithFieldMask.ProtobufOutput +Required.JsonInput.AnyWithInt32ValueWrapper.JsonOutput +Required.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput +Required.JsonInput.AnyWithStruct.JsonOutput +Required.JsonInput.AnyWithStruct.ProtobufOutput +Required.JsonInput.AnyWithTimestamp.JsonOutput +Required.JsonInput.AnyWithTimestamp.ProtobufOutput +Required.JsonInput.AnyWithValueForInteger.JsonOutput +Required.JsonInput.AnyWithValueForInteger.ProtobufOutput +Required.JsonInput.AnyWithValueForJsonObject.JsonOutput +Required.JsonInput.AnyWithValueForJsonObject.ProtobufOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput +Required.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput +Required.JsonInput.DoubleFieldMinPositiveValue.JsonOutput +Required.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput +Required.JsonInput.DoubleFieldNan.JsonOutput +Required.JsonInput.DurationMaxValue.JsonOutput +Required.JsonInput.DurationMaxValue.ProtobufOutput +Required.JsonInput.DurationMinValue.JsonOutput +Required.JsonInput.DurationMinValue.ProtobufOutput +Required.JsonInput.DurationRepeatedValue.JsonOutput +Required.JsonInput.DurationRepeatedValue.ProtobufOutput +Required.JsonInput.FieldMask.JsonOutput +Required.JsonInput.FieldMask.ProtobufOutput +Required.JsonInput.FloatFieldInfinity.JsonOutput +Required.JsonInput.FloatFieldNan.JsonOutput +Required.JsonInput.FloatFieldNegativeInfinity.JsonOutput +Required.JsonInput.FloatFieldTooLarge +Required.JsonInput.FloatFieldTooSmall +Required.JsonInput.OneofFieldDuplicate +Required.JsonInput.OptionalBoolWrapper.JsonOutput +Required.JsonInput.OptionalBoolWrapper.ProtobufOutput +Required.JsonInput.OptionalBytesWrapper.JsonOutput +Required.JsonInput.OptionalBytesWrapper.ProtobufOutput +Required.JsonInput.OptionalDoubleWrapper.JsonOutput +Required.JsonInput.OptionalDoubleWrapper.ProtobufOutput +Required.JsonInput.OptionalFloatWrapper.JsonOutput +Required.JsonInput.OptionalFloatWrapper.ProtobufOutput +Required.JsonInput.OptionalInt32Wrapper.JsonOutput +Required.JsonInput.OptionalInt32Wrapper.ProtobufOutput +Required.JsonInput.OptionalInt64Wrapper.JsonOutput +Required.JsonInput.OptionalInt64Wrapper.ProtobufOutput +Required.JsonInput.OptionalStringWrapper.JsonOutput +Required.JsonInput.OptionalStringWrapper.ProtobufOutput +Required.JsonInput.OptionalUint32Wrapper.JsonOutput +Required.JsonInput.OptionalUint32Wrapper.ProtobufOutput +Required.JsonInput.OptionalUint64Wrapper.JsonOutput +Required.JsonInput.OptionalUint64Wrapper.ProtobufOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput +Required.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput +Required.JsonInput.RepeatedBoolWrapper.JsonOutput +Required.JsonInput.RepeatedBoolWrapper.ProtobufOutput +Required.JsonInput.RepeatedBytesWrapper.JsonOutput +Required.JsonInput.RepeatedBytesWrapper.ProtobufOutput +Required.JsonInput.RepeatedDoubleWrapper.JsonOutput +Required.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.JsonInput.RepeatedFloatWrapper.JsonOutput +Required.JsonInput.RepeatedFloatWrapper.ProtobufOutput +Required.JsonInput.RepeatedInt32Wrapper.JsonOutput +Required.JsonInput.RepeatedInt32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedInt64Wrapper.JsonOutput +Required.JsonInput.RepeatedInt64Wrapper.ProtobufOutput +Required.JsonInput.RepeatedStringWrapper.JsonOutput +Required.JsonInput.RepeatedStringWrapper.ProtobufOutput +Required.JsonInput.RepeatedUint32Wrapper.JsonOutput +Required.JsonInput.RepeatedUint32Wrapper.ProtobufOutput +Required.JsonInput.RepeatedUint64Wrapper.JsonOutput +Required.JsonInput.RepeatedUint64Wrapper.ProtobufOutput +Required.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.JsonInput.StringFieldSurrogatePair.ProtobufOutput +Required.JsonInput.Struct.JsonOutput +Required.JsonInput.Struct.ProtobufOutput +Required.JsonInput.TimestampMaxValue.JsonOutput +Required.JsonInput.TimestampMaxValue.ProtobufOutput +Required.JsonInput.TimestampMinValue.JsonOutput +Required.JsonInput.TimestampMinValue.ProtobufOutput +Required.JsonInput.TimestampRepeatedValue.JsonOutput +Required.JsonInput.TimestampRepeatedValue.ProtobufOutput +Required.JsonInput.TimestampWithNegativeOffset.JsonOutput +Required.JsonInput.TimestampWithNegativeOffset.ProtobufOutput +Required.JsonInput.TimestampWithPositiveOffset.JsonOutput +Required.JsonInput.TimestampWithPositiveOffset.ProtobufOutput +Required.JsonInput.ValueAcceptBool.JsonOutput +Required.JsonInput.ValueAcceptBool.ProtobufOutput +Required.JsonInput.ValueAcceptFloat.JsonOutput +Required.JsonInput.ValueAcceptFloat.ProtobufOutput +Required.JsonInput.ValueAcceptInteger.JsonOutput +Required.JsonInput.ValueAcceptInteger.ProtobufOutput +Required.JsonInput.ValueAcceptList.JsonOutput +Required.JsonInput.ValueAcceptList.ProtobufOutput +Required.JsonInput.ValueAcceptNull.JsonOutput +Required.JsonInput.ValueAcceptNull.ProtobufOutput +Required.JsonInput.ValueAcceptObject.JsonOutput +Required.JsonInput.ValueAcceptObject.ProtobufOutput +Required.JsonInput.ValueAcceptString.JsonOutput +Required.JsonInput.ValueAcceptString.ProtobufOutput +Required.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput +Required.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput +Required.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput +Required.TimestampProtoInputTooLarge.JsonOutput +Required.TimestampProtoInputTooSmall.JsonOutput diff --git a/packager/third_party/protobuf/src/google/protobuf/arena_nc_test.py b/packager/third_party/protobuf/conformance/update_failure_list.py old mode 100644 new mode 100755 similarity index 56% rename from packager/third_party/protobuf/src/google/protobuf/arena_nc_test.py rename to packager/third_party/protobuf/conformance/update_failure_list.py index 56a7dd05aa..63f453df1b --- a/packager/third_party/protobuf/src/google/protobuf/arena_nc_test.py +++ b/packager/third_party/protobuf/conformance/update_failure_list.py @@ -1,5 +1,4 @@ -#! /usr/bin/env python -# +#!/usr/bin/env python # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ @@ -30,32 +29,45 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -"""Negative compilation unit tests for arena API.""" +"""Script to update a failure list file to add/remove failures. -import unittest +This is sort of like comm(1), except it recognizes comments and ignores them. +""" -from google3.testing.pybase import fake_target_util -from google3.testing.pybase import unittest +import argparse +import fileinput +parser = argparse.ArgumentParser( + description='Adds/removes failures from the failure list.') +parser.add_argument('filename', type=str, help='failure list file to update') +parser.add_argument('--add', dest='add_list', action='append') +parser.add_argument('--remove', dest='remove_list', action='append') -class ArenaNcTest(unittest.TestCase): +args = parser.parse_args() - def testCompilerErrors(self): - """Runs a list of tests to verify compiler error messages.""" +add_set = set() +remove_set = set() - # Defines a list of test specs, where each element is a tuple - # (test name, list of regexes for matching the compiler errors). - test_specs = [ - ('ARENA_PRIVATE_CONSTRUCTOR', - [r'calling a protected constructor']), - ('SANITY', None)] +for add_file in (args.add_list or []): + with open(add_file) as f: + for line in f: + add_set.add(line) - fake_target_util.AssertCcCompilerErrors( - self, # The current test case. - 'google3/google/protobuf/arena_nc', # The fake target file. - 'arena_nc.o', # The sub-target to build. - test_specs # List of test specifications. - ) +for remove_file in (args.remove_list or []): + with open(remove_file) as f: + for line in f: + if line in add_set: + raise Exception("Asked to both add and remove test: " + line) + remove_set.add(line.strip()) -if __name__ == '__main__': - unittest.main() +add_list = sorted(add_set, reverse=True) + +existing_list = file(args.filename).read() + +with open(args.filename, "w") as f: + for line in existing_list.splitlines(True): + test = line.split("#")[0].strip() + while len(add_list) > 0 and test > add_list[-1]: + f.write(add_list.pop()) + if test not in remove_set: + f.write(line) diff --git a/packager/third_party/protobuf/csharp/.gitignore b/packager/third_party/protobuf/csharp/.gitignore index c88f741e37..8ba8849985 100644 --- a/packager/third_party/protobuf/csharp/.gitignore +++ b/packager/third_party/protobuf/csharp/.gitignore @@ -1,16 +1,10 @@ -# -# Untracked directories -# -src/AddressBook/bin -src/AddressBook/obj -src/Google.Protobuf/bin/ -src/Google.Protobuf/obj/ -src/Google.Protobuf.Conformance/bin/ -src/Google.Protobuf.Conformance/obj/ -src/Google.Protobuf.Test/bin/ -src/Google.Protobuf.Test/obj/ -src/Google.Protobuf.JsonDump/bin/ -src/Google.Protobuf.JsonDump/obj/ +# Output +bin +obj +project.lock.json +TestResult.xml + +# Possibly legacy now? mono/bin mono/tmp mono/protoc @@ -23,6 +17,7 @@ lib/NUnit # # Untracked files # +.vs *.user *.suo *.nupkg diff --git a/packager/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec b/packager/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec index e4240dae87..95e6b04a3e 100644 --- a/packager/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec +++ b/packager/third_party/protobuf/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.0.0-beta3 + 3.3.2 Google Inc. protobuf-packages https://github.com/google/protobuf/blob/master/LICENSE diff --git a/packager/third_party/protobuf/csharp/README.md b/packager/third_party/protobuf/csharp/README.md index 8c3993e014..c1d124194a 100644 --- a/packager/third_party/protobuf/csharp/README.md +++ b/packager/third_party/protobuf/csharp/README.md @@ -1,16 +1,13 @@ This directory contains the C# Protocol Buffers runtime library. -Status: Beta - ready for external testing -========================================= - Usage ===== The easiest way how to use C# protobufs is via the `Google.Protobuf` NuGet package. Just add the NuGet package to your VS project. -Besides C# runtime library, the NuGet package also contains -precompiled version of `protoc.exe` and a copy of well known `.proto` +You will also want to install the `Google.Protobuf.Tools` NuGet package, which +contains precompiled version of `protoc.exe` and a copy of well known `.proto` files under the package's `tools` directory. To generate C# files from your `.proto` files, invoke `protoc` with the @@ -34,16 +31,41 @@ which only uses features from C# 3 and earlier. Building ======== -Open the `src/Google.Protobuf.sln` solution in Visual Studio 2015 or -later. You should be able to run the NUnit test from Test Explorer -(you might need to install NUnit Visual Studio add-in). +Open the `src/Google.Protobuf.sln` solution in Visual Studio 2017 or +later. Although *users* of this project are only expected to have Visual Studio 2012 or later, *developers* of the library are required to -have Visual Studio 2015 or later, as the library uses C# 6 features -in its implementation. These features have no impact when using the -compiled code - they're only relevant when building the -`Google.Protobuf` assembly. +have Visual Studio 2017 or later, as the library uses C# 6 features +in its implementation, as well as the new Visual Studio 2017 csproj +format. These features have no impact when using the compiled code - +they're only relevant when building the `Google.Protobuf` assembly. + +Testing +======= + +The unit tests use [NUnit 3](https://github.com/nunit/nunit). NUnit doesn't yet +support `dotnet test`, so for now the test project is a console application +using NUnitLite. Simply run `Google.Protobuf.Test.exe` to run the unit tests +directly, or else use `dotnet run`. + +.NET 3.5 +======== + +We don't officially support .NET 3.5. However, there has been some effort +to make enabling .NET 3.5 support relatively painless in case you require it. +There's no guarantee that this will continue in the future, so rely on .NET +3.5 support at your peril. + +To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of +[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj) +(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) +if you want to run the unit tests): + +Open the .csproj file in a text editor and simply add `net35` to the list of +target frameworks, noting that the `TargetFrameworks` element appears twice in +the file (once in the first `PropertyGroup` element, and again in the second +`PropertyGroup` element, i.e., the one with the conditional). History of C# protobufs ======================= diff --git a/packager/third_party/protobuf/csharp/build_packages.bat b/packager/third_party/protobuf/csharp/build_packages.bat index 1502f0634b..d7205659f1 100644 --- a/packager/third_party/protobuf/csharp/build_packages.bat +++ b/packager/third_party/protobuf/csharp/build_packages.bat @@ -1,10 +1,7 @@ @rem Builds Google.Protobuf NuGet packages -@rem Adjust the location of nuget.exe -set NUGET=C:\nuget\nuget.exe - -@rem Build src/Google.Protobuf.sln solution in Release configuration first. -%NUGET% pack src\Google.Protobuf\Google.Protobuf.nuspec -Symbols || goto :error +dotnet restore src/Google.Protobuf.sln +dotnet pack -c Release src/Google.Protobuf.sln || goto :error goto :EOF diff --git a/packager/third_party/protobuf/csharp/build_tools.sh b/packager/third_party/protobuf/csharp/build_tools.sh new file mode 100755 index 0000000000..182c5c5c82 --- /dev/null +++ b/packager/third_party/protobuf/csharp/build_tools.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +if [ $# -ne 1 ]; then + cat < + +Example: + $ $0 3.0.0 + +This script will download pre-built protoc binaries from maven repository and +create the Google.Protobuf.Tools package. Well-known type .proto files will also +be included. +EOF + exit 1 +fi + +VERSION_NUMBER=$1 +# pairs. +declare -a FILE_NAMES=( \ + windows_x86 windows-x86_32.exe \ + windows_x64 windows-x86_64.exe \ + macosx_x86 osx-x86_32.exe \ + macosx_x64 osx-x86_64.exe \ + linux_x86 linux-x86_32.exe \ + linux_x64 linux-x86_64.exe \ +) + +set -e + +mkdir -p protoc +# Create a zip file for each binary. +for((i=0;i<${#FILE_NAMES[@]};i+=2));do + DIR_NAME=${FILE_NAMES[$i]} + mkdir -p protoc/$DIR_NAME + + if [ ${DIR_NAME:0:3} = "win" ]; then + TARGET_BINARY="protoc.exe" + else + TARGET_BINARY="protoc" + fi + + BINARY_NAME=${FILE_NAMES[$(($i+1))]} + BINARY_URL=http://repo1.maven.org/maven2/com/google/protobuf/protoc/${VERSION_NUMBER}/protoc-${VERSION_NUMBER}-${BINARY_NAME} + + if ! wget ${BINARY_URL} -O protoc/$DIR_NAME/$TARGET_BINARY &> /dev/null; then + echo "[ERROR] Failed to download ${BINARY_URL}" >&2 + echo "[ERROR] Skipped $protoc-${VERSION_NAME}-${DIR_NAME}" >&2 + continue + fi +done + +nuget pack Google.Protobuf.Tools.nuspec diff --git a/packager/third_party/protobuf/csharp/buildall.sh b/packager/third_party/protobuf/csharp/buildall.sh index 45af705f38..dd4b463ddf 100755 --- a/packager/third_party/protobuf/csharp/buildall.sh +++ b/packager/third_party/protobuf/csharp/buildall.sh @@ -1,17 +1,17 @@ #!/bin/bash -# Use mono to build solution and run all tests. -# Adjust these to reflect the location of nunit-console in your system. -NUNIT_CONSOLE=nunit-console - -# The rest you can leave intact CONFIG=Release SRC=$(dirname $0)/src set -ex -echo Building the solution. -xbuild /p:Configuration=$CONFIG $SRC/Google.Protobuf.sln +echo Building relevant projects. +dotnet restore $SRC/Google.Protobuf.sln +dotnet build -c $CONFIG $SRC/Google.Protobuf.sln echo Running tests. -$NUNIT_CONSOLE $SRC/Google.Protobuf.Test/bin/$CONFIG/Google.Protobuf.Test.dll +# Only test netcoreapp1.0, which uses the .NET Core runtime. +# If we want to test the .NET 4.5 version separately, we could +# run Mono explicitly. However, we don't have any differences between +# the .NET 4.5 and netstandard1.0 assemblies. +dotnet run -c $CONFIG -f netcoreapp1.0 -p $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto new file mode 100644 index 0000000000..6c9f76344a --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto @@ -0,0 +1,126 @@ +syntax = "proto3"; + +// These proto descriptors have at one time been reported as an issue or defect. +// They are kept here to replicate the issue, and continue to verify the fix. + +// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +package unittest_issues; +option optimize_for = SPEED; + +// Issue 307: when generating doubly-nested types, any references +// should be of the form A.Types.B.Types.C. +message Issue307 { + message NestedOnce { + message NestedTwice { + } + } +} + +// Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13 +// New issue 309: https://github.com/google/protobuf/issues/309 + +// message A { +// optional int32 _A = 1; +// } + +// message B { +// optional int32 B_ = 1; +// } + +//message AB { +// optional int32 a_b = 1; +//} + +// Similar issue with numeric names +// Java code failed too, so probably best for this to be a restriction. +// See https://github.com/google/protobuf/issues/308 +// message NumberField { +// optional int32 _01 = 1; +// } + +// issue 19 - negative enum values + +enum NegativeEnum { + NEGATIVE_ENUM_ZERO = 0; + FiveBelow = -5; + MinusOne = -1; +} + +message NegativeEnumMessage { + NegativeEnum value = 1; + repeated NegativeEnum values = 2 [packed = false]; + repeated NegativeEnum packed_values = 3 [packed=true]; +} + +// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21 +// Decorate fields with [deprecated=true] as [System.Obsolete] + +message DeprecatedChild { +} + +enum DeprecatedEnum { + DEPRECATED_ZERO = 0; + one = 1; +} + +message DeprecatedFieldsMessage { + int32 PrimitiveValue = 1 [deprecated = true]; + repeated int32 PrimitiveArray = 2 [deprecated = true]; + + DeprecatedChild MessageValue = 3 [deprecated = true]; + repeated DeprecatedChild MessageArray = 4 [deprecated = true]; + + DeprecatedEnum EnumValue = 5 [deprecated = true]; + repeated DeprecatedEnum EnumArray = 6 [deprecated = true]; +} + +// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 +message ItemField { + int32 item = 1; +} + +message ReservedNames { + // Force a nested type called Types + message SomeNestedType { + } + + int32 types = 1; + int32 descriptor = 2; +} + +message TestJsonFieldOrdering { + // These fields are deliberately not declared in numeric + // order, and the oneof fields aren't contiguous either. + // This allows for reasonably robust tests of JSON output + // ordering. + // TestFieldOrderings in unittest_proto3.proto is similar, + // but doesn't include oneofs. + // TODO: Consider adding oneofs to TestFieldOrderings, although + // that will require fixing other tests in multiple platforms. + // Alternatively, consider just adding this to + // unittest_proto3.proto if multiple platforms want it. + + int32 plain_int32 = 4; + + oneof o1 { + string o1_string = 2; + int32 o1_int32 = 5; + } + + string plain_string = 1; + + oneof o2 { + int32 o2_int32 = 6; + string o2_string = 3; + } + +} + +message TestJsonName { + // Message for testing the effects for of the json_name option + string name = 1; + string description = 2 [json_name = "desc"]; + string guid = 3 [json_name = "exid"]; +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto new file mode 100644 index 0000000000..16be277304 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/map_unittest_proto3.proto @@ -0,0 +1,120 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// This file is mostly equivalent to map_unittest.proto, but imports +// unittest_proto3.proto instead of unittest.proto, so that it only +// uses proto3 messages. This makes it suitable for testing +// implementations which only support proto3. +// The TestRequiredMessageMap message has been removed as there are no +// required fields in proto3. +syntax = "proto3"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "google/protobuf/unittest_proto3.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In map_test_util.h we do "using namespace unittest = protobuf_unittest". +package protobuf_unittest; + +// Tests maps. +message TestMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_string_string = 14; + map map_int32_bytes = 15; + map map_int32_enum = 16; + map map_int32_foreign_message = 17; +} + +message TestMapSubmessage { + TestMap test_map = 1; +} + +message TestMessageMap { + map map_int32_message = 1; +} + +// Two map fields share the same entry default instance. +message TestSameTypeMap { + map map1 = 1; + map map2 = 2; +} + +enum MapEnum { + MAP_ENUM_FOO = 0; + MAP_ENUM_BAR = 1; + MAP_ENUM_BAZ = 2; +} + +message TestArenaMap { + map map_int32_int32 = 1; + map map_int64_int64 = 2; + map map_uint32_uint32 = 3; + map map_uint64_uint64 = 4; + map map_sint32_sint32 = 5; + map map_sint64_sint64 = 6; + map map_fixed32_fixed32 = 7; + map map_fixed64_fixed64 = 8; + map map_sfixed32_sfixed32 = 9; + map map_sfixed64_sfixed64 = 10; + map map_int32_float = 11; + map map_int32_double = 12; + map map_bool_bool = 13; + map map_int32_enum = 14; + map map_int32_foreign_message = 15; +} + +// Previously, message containing enum called Type cannot be used as value of +// map field. +message MessageContainingEnumCalledType { + enum Type { + TYPE_FOO = 0; + } + map type = 1; +} + +// Previously, message cannot contain map field called "entry". +message MessageContainingMapCalledEntry { + map entry = 1; +} diff --git a/packager/third_party/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto similarity index 59% rename from packager/third_party/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java rename to packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto index ecc80096f5..59673eaf9d 100644 --- a/packager/third_party/protobuf/java/src/main/java/com/google/protobuf/BlockingService.java +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_proto3.proto @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -28,37 +28,41 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -package com.google.protobuf; +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which is imported by unittest_proto3.proto to test importing. -/** - * Blocking equivalent to {@link Service}. - * - * @author kenton@google.com Kenton Varda - * @author cpovirk@google.com Chris Povirk - */ -public interface BlockingService { - /** - * Equivalent to {@link Service#getDescriptorForType}. - */ - Descriptors.ServiceDescriptor getDescriptorForType(); +syntax = "proto3"; - /** - * Equivalent to {@link Service#callMethod}, except that - * {@code callBlockingMethod()} returns the result of the RPC or throws a - * {@link ServiceException} if there is a failure, rather than passing the - * information to a callback. - */ - Message callBlockingMethod(Descriptors.MethodDescriptor method, - RpcController controller, - Message request) throws ServiceException; +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In test_util.h we do +// "using namespace unittest_import = protobuf_unittest_import". +package protobuf_unittest_import; - /** - * Equivalent to {@link Service#getRequestPrototype}. - */ - Message getRequestPrototype(Descriptors.MethodDescriptor method); +option optimize_for = SPEED; +option cc_enable_arenas = true; - /** - * Equivalent to {@link Service#getResponsePrototype}. - */ - Message getResponsePrototype(Descriptors.MethodDescriptor method); +// Exercise the java_package option. +option java_package = "com.google.protobuf.test"; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +// Do not set a java_outer_classname here to verify that Proto2 works without +// one. + +// Test public import +import public "google/protobuf/unittest_import_public_proto3.proto"; + +message ImportMessage { + int32 d = 1; } + +enum ImportEnum { + IMPORT_ENUM_UNSPECIFIED = 0; + IMPORT_FOO = 7; + IMPORT_BAR = 8; + IMPORT_BAZ = 9; +} + diff --git a/packager/third_party/protobuf/src/google/protobuf/arena_nc.cc b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto similarity index 83% rename from packager/third_party/protobuf/src/google/protobuf/arena_nc.cc rename to packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto index f2f084274a..d6f11e28bd 100644 --- a/packager/third_party/protobuf/src/google/protobuf/arena_nc.cc +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_import_public_proto3.proto @@ -28,18 +28,15 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Negative compilation test for arena usage. +// Author: liujisi@google.com (Pherl Liu) -#include -#include +syntax = "proto3"; -#ifdef TEST_ARENA_PRIVATE_CONSTRUCTOR +package protobuf_unittest_import; -namespace google { -void ArenaPrivateConstructor() { - google::protobuf::Arena arena; - protobuf_unittest::TestAllTypes message(&arena); +option java_package = "com.google.protobuf.test"; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +message PublicImportMessage { + int32 e = 1; } - -#endif -} // namespace google diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto new file mode 100644 index 0000000000..f59d217864 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_proto3.proto @@ -0,0 +1,388 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. + +syntax = "proto3"; + +// Some generic_services option(s) added automatically. +// See: http://go/proto2-generic-services-default +option cc_generic_services = true; // auto-added +option java_generic_services = true; // auto-added +option py_generic_services = true; // auto-added +option cc_enable_arenas = true; +option csharp_namespace = "Google.Protobuf.TestProtos"; + +import "google/protobuf/unittest_import_proto3.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In test_util.h we do "using namespace unittest = protobuf_unittest". +package protobuf_unittest; + +// Protos optimized for SPEED use a strict superset of the generated code +// of equivalent ones optimized for CODE_SIZE, so we should optimize all our +// tests for speed unless explicitly testing code size optimization. +option optimize_for = SPEED; + +option java_outer_classname = "UnittestProto"; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + enum NestedEnum { + NESTED_ENUM_UNSPECIFIED = 0; + FOO = 1; + BAR = 2; + BAZ = 3; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 single_int32 = 1; + int64 single_int64 = 2; + uint32 single_uint32 = 3; + uint64 single_uint64 = 4; + sint32 single_sint32 = 5; + sint64 single_sint64 = 6; + fixed32 single_fixed32 = 7; + fixed64 single_fixed64 = 8; + sfixed32 single_sfixed32 = 9; + sfixed64 single_sfixed64 = 10; + float single_float = 11; + double single_double = 12; + bool single_bool = 13; + string single_string = 14; + bytes single_bytes = 15; + + NestedMessage single_nested_message = 18; + ForeignMessage single_foreign_message = 19; + protobuf_unittest_import.ImportMessage single_import_message = 20; + + NestedEnum single_nested_enum = 21; + ForeignEnum single_foreign_enum = 22; + protobuf_unittest_import.ImportEnum single_import_enum = 23; + + // Defined in unittest_import_public.proto + protobuf_unittest_import.PublicImportMessage + single_public_import_message = 26; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + // Defined in unittest_import_public.proto + repeated protobuf_unittest_import.PublicImportMessage + repeated_public_import_message = 54; + + // For oneof test + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + } +} + +// This proto includes a recusively nested message. +message NestedTestAllTypes { + NestedTestAllTypes child = 1; + TestAllTypes payload = 2; + repeated NestedTestAllTypes repeated_child = 3; +} + +message TestDeprecatedFields { + int32 deprecated_int32 = 1 [deprecated=true]; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_UNSPECIFIED = 0; + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} + +message TestReservedFields { + reserved 2, 15, 9 to 11; + reserved "bar", "baz"; +} + + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + TestAllTypes.NestedMessage foreign_nested = 1; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + int32 a = 1; + int32 bb = 268435455; +} + +message TestRecursiveMessage { + TestRecursiveMessage a = 1; + int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + TestMutualRecursionB bb = 1; +} + +message TestMutualRecursionB { + TestMutualRecursionA a = 1; + int32 optional_int32 = 2; +} + + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED = 0; + option allow_alias = true; + + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + TEST_SPARSE_ENUM_UNSPECIFIED = 0; + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + // In proto3, value 0 must be the first one specified + // SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + int32 PrimitiveField = 1; + string StringField = 2; + ForeignEnum EnumField = 3; + ForeignMessage MessageField = 4; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; +} + + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + string my_string = 11; + int64 my_int = 1; + float my_float = 101; + message NestedMessage { + int64 oo = 2; + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + int32 bb = 1; + } + + NestedMessage single_nested_message = 200; +} + +message SparseEnumMessage { + TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + string data = 1; +} + +message MoreString { + repeated string data = 1; +} + +message OneBytes { + bytes data = 1; +} + +message MoreBytes { + bytes data = 1; +} + +// Test int32, uint32, int64, uint64, and bool are all compatible +message Int32Message { + int32 data = 1; +} + +message Uint32Message { + uint32 data = 1; +} + +message Int64Message { + int64 data = 1; +} + +message Uint64Message { + uint64 data = 1; +} + +message BoolMessage { + bool data = 1; +} + +// Test oneofs. +message TestOneof { + oneof foo { + int32 foo_int = 1; + string foo_string = 2; + TestAllTypes foo_message = 3; + } +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90 [packed = false]; + repeated int64 unpacked_int64 = 91 [packed = false]; + repeated uint32 unpacked_uint32 = 92 [packed = false]; + repeated uint64 unpacked_uint64 = 93 [packed = false]; + repeated sint32 unpacked_sint32 = 94 [packed = false]; + repeated sint64 unpacked_sint64 = 95 [packed = false]; + repeated fixed32 unpacked_fixed32 = 96 [packed = false]; + repeated fixed64 unpacked_fixed64 = 97 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; + repeated float unpacked_float = 100 [packed = false]; + repeated double unpacked_double = 101 [packed = false]; + repeated bool unpacked_bool = 102 [packed = false]; + repeated ForeignEnum unpacked_enum = 103 [packed = false]; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + +message TestCommentInjectionMessage { + // */ <- This should not close the generated doc comment + string a = 1; +} + + +// Test that RPC services work. +message FooRequest {} +message FooResponse {} + +message FooClientMessage {} +message FooServerMessage{} + +service TestService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + + +message BarRequest {} +message BarResponse {} + diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto new file mode 100644 index 0000000000..c90752440b --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/protos/src/google/protobuf/unittest_well_known_types.proto @@ -0,0 +1,114 @@ +syntax = "proto3"; + +package protobuf_unittest; + +option csharp_namespace = "Google.Protobuf.TestProtos"; +option java_multiple_files = true; +option java_package = "com.google.protobuf.test"; + +import "google/protobuf/any.proto"; +import "google/protobuf/api.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/source_context.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/type.proto"; +import "google/protobuf/wrappers.proto"; + +// Test that we can include all well-known types. +// Each wrapper type is included separately, as languages +// map handle different wrappers in different ways. +message TestWellKnownTypes { + google.protobuf.Any any_field = 1; + google.protobuf.Api api_field = 2; + google.protobuf.Duration duration_field = 3; + google.protobuf.Empty empty_field = 4; + google.protobuf.FieldMask field_mask_field = 5; + google.protobuf.SourceContext source_context_field = 6; + google.protobuf.Struct struct_field = 7; + google.protobuf.Timestamp timestamp_field = 8; + google.protobuf.Type type_field = 9; + google.protobuf.DoubleValue double_field = 10; + google.protobuf.FloatValue float_field = 11; + google.protobuf.Int64Value int64_field = 12; + google.protobuf.UInt64Value uint64_field = 13; + google.protobuf.Int32Value int32_field = 14; + google.protobuf.UInt32Value uint32_field = 15; + google.protobuf.BoolValue bool_field = 16; + google.protobuf.StringValue string_field = 17; + google.protobuf.BytesValue bytes_field = 18; + // Part of struct, but useful to be able to test separately + google.protobuf.Value value_field = 19; +} + +// A repeated field for each well-known type. +message RepeatedWellKnownTypes { + repeated google.protobuf.Any any_field = 1; + repeated google.protobuf.Api api_field = 2; + repeated google.protobuf.Duration duration_field = 3; + repeated google.protobuf.Empty empty_field = 4; + repeated google.protobuf.FieldMask field_mask_field = 5; + repeated google.protobuf.SourceContext source_context_field = 6; + repeated google.protobuf.Struct struct_field = 7; + repeated google.protobuf.Timestamp timestamp_field = 8; + repeated google.protobuf.Type type_field = 9; + // These don't actually make a lot of sense, but they're not prohibited... + repeated google.protobuf.DoubleValue double_field = 10; + repeated google.protobuf.FloatValue float_field = 11; + repeated google.protobuf.Int64Value int64_field = 12; + repeated google.protobuf.UInt64Value uint64_field = 13; + repeated google.protobuf.Int32Value int32_field = 14; + repeated google.protobuf.UInt32Value uint32_field = 15; + repeated google.protobuf.BoolValue bool_field = 16; + repeated google.protobuf.StringValue string_field = 17; + repeated google.protobuf.BytesValue bytes_field = 18; +} + +message OneofWellKnownTypes { + oneof oneof_field { + google.protobuf.Any any_field = 1; + google.protobuf.Api api_field = 2; + google.protobuf.Duration duration_field = 3; + google.protobuf.Empty empty_field = 4; + google.protobuf.FieldMask field_mask_field = 5; + google.protobuf.SourceContext source_context_field = 6; + google.protobuf.Struct struct_field = 7; + google.protobuf.Timestamp timestamp_field = 8; + google.protobuf.Type type_field = 9; + google.protobuf.DoubleValue double_field = 10; + google.protobuf.FloatValue float_field = 11; + google.protobuf.Int64Value int64_field = 12; + google.protobuf.UInt64Value uint64_field = 13; + google.protobuf.Int32Value int32_field = 14; + google.protobuf.UInt32Value uint32_field = 15; + google.protobuf.BoolValue bool_field = 16; + google.protobuf.StringValue string_field = 17; + google.protobuf.BytesValue bytes_field = 18; + } +} + +// A map field for each well-known type. We only +// need to worry about the value part of the map being the +// well-known types, as messages can't be map keys. +message MapWellKnownTypes { + map any_field = 1; + map api_field = 2; + map duration_field = 3; + map empty_field = 4; + map field_mask_field = 5; + map source_context_field = 6; + map struct_field = 7; + map timestamp_field = 8; + map type_field = 9; + map double_field = 10; + map float_field = 11; + map int64_field = 12; + map uint64_field = 13; + map int32_field = 14; + map uint32_field = 15; + map bool_field = 16; + map string_field = 17; + map bytes_field = 18; +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs new file mode 100644 index 0000000000..685e130a74 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/ByteStringTest.cs @@ -0,0 +1,171 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Text; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class ByteStringTest + { + [Test] + public void Equality() + { + ByteString b1 = ByteString.CopyFrom(1, 2, 3); + ByteString b2 = ByteString.CopyFrom(1, 2, 3); + ByteString b3 = ByteString.CopyFrom(1, 2, 4); + ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4); + EqualityTester.AssertEquality(b1, b1); + EqualityTester.AssertEquality(b1, b2); + EqualityTester.AssertInequality(b1, b3); + EqualityTester.AssertInequality(b1, b4); + EqualityTester.AssertInequality(b1, null); +#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1) + Assert.IsTrue(b1 == b1); + Assert.IsTrue(b1 == b2); + Assert.IsFalse(b1 == b3); + Assert.IsFalse(b1 == b4); + Assert.IsFalse(b1 == null); + Assert.IsTrue((ByteString) null == null); + Assert.IsFalse(b1 != b1); + Assert.IsFalse(b1 != b2); +#pragma warning disable 1718 + Assert.IsTrue(b1 != b3); + Assert.IsTrue(b1 != b4); + Assert.IsTrue(b1 != null); + Assert.IsFalse((ByteString) null != null); + } + + [Test] + public void EmptyByteStringHasZeroSize() + { + Assert.AreEqual(0, ByteString.Empty.Length); + } + + [Test] + public void CopyFromStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); + Assert.AreEqual(4, bs.Length); + Assert.AreEqual(65, bs[0]); + Assert.AreEqual(0, bs[1]); + Assert.AreEqual(66, bs[2]); + Assert.AreEqual(0, bs[3]); + } + + [Test] + public void IsEmptyWhenEmpty() + { + Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); + } + + [Test] + public void IsEmptyWhenNotEmpty() + { + Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); + } + + [Test] + public void CopyFromByteArrayCopiesContents() + { + byte[] data = new byte[1]; + data[0] = 10; + ByteString bs = ByteString.CopyFrom(data); + Assert.AreEqual(10, bs[0]); + data[0] = 5; + Assert.AreEqual(10, bs[0]); + } + + [Test] + public void ToByteArrayCopiesContents() + { + ByteString bs = ByteString.CopyFromUtf8("Hello"); + byte[] data = bs.ToByteArray(); + Assert.AreEqual((byte)'H', data[0]); + Assert.AreEqual((byte)'H', bs[0]); + data[0] = 0; + Assert.AreEqual(0, data[0]); + Assert.AreEqual((byte)'H', bs[0]); + } + + [Test] + public void CopyFromUtf8UsesUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(0xe2, bs[0]); + Assert.AreEqual(0x82, bs[1]); + Assert.AreEqual(0xac, bs[2]); + } + + [Test] + public void CopyFromPortion() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + ByteString bs = ByteString.CopyFrom(data, 2, 3); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(2, bs[0]); + Assert.AreEqual(3, bs[1]); + } + + [Test] + public void ToStringUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual("\u20ac", bs.ToStringUtf8()); + } + + [Test] + public void ToStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode); + Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode)); + } + + [Test] + public void FromBase64_WithText() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + string base64 = Convert.ToBase64String(data); + ByteString bs = ByteString.FromBase64(base64); + Assert.AreEqual(data, bs.ToByteArray()); + } + + [Test] + public void FromBase64_Empty() + { + // Optimization which also fixes issue 61. + Assert.AreSame(ByteString.Empty, ByteString.FromBase64("")); + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs new file mode 100644 index 0000000000..23af28870a --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamExtensions.cs @@ -0,0 +1,53 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; + +namespace Google.Protobuf +{ + internal static class CodedInputStreamExtensions + { + public static void AssertNextTag(this CodedInputStream input, uint expectedTag) + { + uint tag = input.ReadTag(); + Assert.AreEqual(expectedTag, tag); + } + + public static T ReadMessage(this CodedInputStream stream, MessageParser parser) + where T : IMessage + { + var message = parser.CreateTemplate(); + stream.ReadMessage(message); + return message; + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs new file mode 100644 index 0000000000..ff44895c06 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs @@ -0,0 +1,598 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class CodedInputStreamTest + { + /// + /// Helper to construct a byte array from a bunch of bytes. The inputs are + /// actually ints so that I can use hex notation and not get stupid errors + /// about precision. + /// + private static byte[] Bytes(params int[] bytesAsInts) + { + byte[] bytes = new byte[bytesAsInts.Length]; + for (int i = 0; i < bytesAsInts.Length; i++) + { + bytes[i] = (byte) bytesAsInts[i]; + } + return bytes; + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() + /// + private static void AssertReadVarint(byte[] data, ulong value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + } + + // Try reading directly from a MemoryStream. We want to verify that it + // doesn't read past the end of the input, so write an extra byte - this + // lets us test the position at the end. + MemoryStream memoryStream = new MemoryStream(); + memoryStream.Write(data, 0, data.Length); + memoryStream.WriteByte(0); + memoryStream.Position = 0; + Assert.AreEqual((uint) value, CodedInputStream.ReadRawVarint32(memoryStream)); + Assert.AreEqual(data.Length, memoryStream.Position); + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and + /// expects them to fail with an InvalidProtocolBufferException whose + /// description matches the given one. + /// + private static void AssertReadVarintFailure(InvalidProtocolBufferException expected, byte[] data) + { + CodedInputStream input = new CodedInputStream(data); + var exception = Assert.Throws(() => input.ReadRawVarint32()); + Assert.AreEqual(expected.Message, exception.Message); + + input = new CodedInputStream(data); + exception = Assert.Throws(() => input.ReadRawVarint64()); + Assert.AreEqual(expected.Message, exception.Message); + + // Make sure we get the same error when reading directly from a Stream. + exception = Assert.Throws(() => CodedInputStream.ReadRawVarint32(new MemoryStream(data))); + Assert.AreEqual(expected.Message, exception.Message); + } + + [Test] + public void ReadVarint() + { + AssertReadVarint(Bytes(0x00), 0); + AssertReadVarint(Bytes(0x01), 1); + AssertReadVarint(Bytes(0x7f), 127); + // 14882 + AssertReadVarint(Bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertReadVarint(Bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49), + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43L << 28) | (0x49L << 35) | (0x24L << 42) | (0x49L << 49)); + // 11964378330978735131 + AssertReadVarint(Bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01), + (0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bUL << 28) | (0x56UL << 35) | (0x00UL << 42) | + (0x05UL << 49) | (0x26UL << 56) | (0x01UL << 63)); + + // Failures + AssertReadVarintFailure( + InvalidProtocolBufferException.MalformedVarint(), + Bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x00)); + AssertReadVarintFailure( + InvalidProtocolBufferException.TruncatedMessage(), + Bytes(0x80)); + } + + /// + /// Parses the given bytes using ReadRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian32(byte[] data, uint value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = new CodedInputStream( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + } + } + + /// + /// Parses the given bytes using ReadRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian64(byte[] data, ulong value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = new CodedInputStream( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + } + } + + [Test] + public void ReadLittleEndian() + { + AssertReadLittleEndian32(Bytes(0x78, 0x56, 0x34, 0x12), 0x12345678); + AssertReadLittleEndian32(Bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0); + + AssertReadLittleEndian64(Bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12), + 0x123456789abcdef0L); + AssertReadLittleEndian64( + Bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678UL); + } + + [Test] + public void DecodeZigZag32() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag32(3)); + Assert.AreEqual(0x3FFFFFFF, CodedInputStream.DecodeZigZag32(0x7FFFFFFE)); + Assert.AreEqual(unchecked((int) 0xC0000000), CodedInputStream.DecodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0x7FFFFFFF, CodedInputStream.DecodeZigZag32(0xFFFFFFFE)); + Assert.AreEqual(unchecked((int) 0x80000000), CodedInputStream.DecodeZigZag32(0xFFFFFFFF)); + } + + [Test] + public void DecodeZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3)); + Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL)); + Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL)); + Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL)); + } + + [Test] + public void ReadWholeMessage_VaryingBlockSizes() + { + TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); + + byte[] rawBytes = message.ToByteArray(); + Assert.AreEqual(rawBytes.Length, message.CalculateSize()); + TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(rawBytes); + Assert.AreEqual(message, message2); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + message2 = TestAllTypes.Parser.ParseFrom(new SmallBlockInputStream(rawBytes, blockSize)); + Assert.AreEqual(message, message2); + } + } + + [Test] + public void ReadHugeBlob() + { + // Allocate and initialize a 1MB blob. + byte[] blob = new byte[1 << 20]; + for (int i = 0; i < blob.Length; i++) + { + blob[i] = (byte) i; + } + + // Make a message containing it. + var message = new TestAllTypes { SingleBytes = ByteString.CopyFrom(blob) }; + + // Serialize and parse it. Make sure to parse from an InputStream, not + // directly from a ByteString, so that CodedInputStream uses buffered + // reading. + TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(message.ToByteString()); + + Assert.AreEqual(message, message2); + } + + [Test] + public void ReadMaliciouslyLargeBlob() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(0x7FFFFFFF); + output.WriteRawBytes(new byte[32]); // Pad with a few random bytes. + output.Flush(); + ms.Position = 0; + + CodedInputStream input = new CodedInputStream(ms); + Assert.AreEqual(tag, input.ReadTag()); + + Assert.Throws(() => input.ReadBytes()); + } + + internal static TestRecursiveMessage MakeRecursiveMessage(int depth) + { + if (depth == 0) + { + return new TestRecursiveMessage { I = 5 }; + } + else + { + return new TestRecursiveMessage { A = MakeRecursiveMessage(depth - 1) }; + } + } + + internal static void AssertMessageDepth(TestRecursiveMessage message, int depth) + { + if (depth == 0) + { + Assert.IsNull(message.A); + Assert.AreEqual(5, message.I); + } + else + { + Assert.IsNotNull(message.A); + AssertMessageDepth(message.A, depth - 1); + } + } + + [Test] + public void MaliciousRecursion() + { + ByteString data64 = MakeRecursiveMessage(64).ToByteString(); + ByteString data65 = MakeRecursiveMessage(65).ToByteString(); + + AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64); + + Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(data65)); + + CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63); + Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(input)); + } + + [Test] + public void SizeLimit() + { + // Have to use a Stream rather than ByteString.CreateCodedInput as SizeLimit doesn't + // apply to the latter case. + MemoryStream ms = new MemoryStream(SampleMessages.CreateFullTestAllTypes().ToByteArray()); + CodedInputStream input = CodedInputStream.CreateWithLimits(ms, 16, 100); + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(input)); + } + + /// + /// Tests that if we read an string that contains invalid UTF-8, no exception + /// is thrown. Instead, the invalid bytes are replaced with the Unicode + /// "replacement character" U+FFFD. + /// + [Test] + public void ReadInvalidUtf8() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(1); + output.WriteRawBytes(new byte[] {0x80}); + output.Flush(); + ms.Position = 0; + + CodedInputStream input = new CodedInputStream(ms); + + Assert.AreEqual(tag, input.ReadTag()); + string text = input.ReadString(); + Assert.AreEqual('\ufffd', text[0]); + } + + /// + /// A stream which limits the number of bytes it reads at a time. + /// We use this to make sure that CodedInputStream doesn't screw up when + /// reading in small blocks. + /// + private sealed class SmallBlockInputStream : MemoryStream + { + private readonly int blockSize; + + public SmallBlockInputStream(byte[] data, int blockSize) + : base(data) + { + this.blockSize = blockSize; + } + + public override int Read(byte[] buffer, int offset, int count) + { + return base.Read(buffer, offset, Math.Min(count, blockSize)); + } + } + + [Test] + public void TestNegativeEnum() + { + byte[] bytes = { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 }; + CodedInputStream input = new CodedInputStream(bytes); + Assert.AreEqual((int)SampleEnum.NegativeValue, input.ReadEnum()); + Assert.IsTrue(input.IsAtEnd); + } + + //Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily + [Test] + public void TestSlowPathAvoidance() + { + using (var ms = new MemoryStream()) + { + CodedOutputStream output = new CodedOutputStream(ms); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteBytes(ByteString.CopyFrom(new byte[100])); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteBytes(ByteString.CopyFrom(new byte[100])); + output.Flush(); + + ms.Position = 0; + CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0, false); + + uint tag = input.ReadTag(); + Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag)); + Assert.AreEqual(100, input.ReadBytes().Length); + + tag = input.ReadTag(); + Assert.AreEqual(2, WireFormat.GetTagFieldNumber(tag)); + Assert.AreEqual(100, input.ReadBytes().Length); + } + } + + [Test] + public void Tag0Throws() + { + var input = new CodedInputStream(new byte[] { 0 }); + Assert.Throws(() => input.ReadTag()); + } + + [Test] + public void SkipGroup() + { + // Create an output stream with a group in: + // Field 1: string "field 1" + // Field 2: group containing: + // Field 1: fixed int32 value 100 + // Field 2: string "ignore me" + // Field 3: nested group containing + // Field 1: fixed int64 value 1000 + // Field 3: string "field 3" + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString("field 1"); + + // The outer group... + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(1, WireFormat.WireType.Fixed32); + output.WriteFixed32(100); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteString("ignore me"); + // The nested group... + output.WriteTag(3, WireFormat.WireType.StartGroup); + output.WriteTag(1, WireFormat.WireType.Fixed64); + output.WriteFixed64(1000); + // Note: Not sure the field number is relevant for end group... + output.WriteTag(3, WireFormat.WireType.EndGroup); + + // End the outer group + output.WriteTag(2, WireFormat.WireType.EndGroup); + + output.WriteTag(3, WireFormat.WireType.LengthDelimited); + output.WriteString("field 3"); + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 1", input.ReadString()); + Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); + input.SkipLastField(); // Should consume the whole group, including the nested one. + Assert.AreEqual(WireFormat.MakeTag(3, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 3", input.ReadString()); + } + + [Test] + public void SkipGroup_WrongEndGroupTag() + { + // Create an output stream with: + // Field 1: string "field 1" + // Start group 2 + // Field 3: fixed int32 + // End group 4 (should give an error) + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString("field 1"); + + // The outer group... + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(3, WireFormat.WireType.Fixed32); + output.WriteFixed32(100); + output.WriteTag(4, WireFormat.WireType.EndGroup); + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 1", input.ReadString()); + Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void RogueEndGroupTag() + { + // If we have an end-group tag without a leading start-group tag, generated + // code will just call SkipLastField... so that should fail. + + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.EndGroup); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.EndGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void EndOfStreamReachedWhileSkippingGroup() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.StartGroup); + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(2, WireFormat.WireType.EndGroup); + + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + input.ReadTag(); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void RecursionLimitAppliedWhileSkippingGroup() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) + { + output.WriteTag(1, WireFormat.WireType.StartGroup); + } + for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) + { + output.WriteTag(1, WireFormat.WireType.EndGroup); + } + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.StartGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void Construction_Invalid() + { + Assert.Throws(() => new CodedInputStream((byte[]) null)); + Assert.Throws(() => new CodedInputStream(null, 0, 0)); + Assert.Throws(() => new CodedInputStream((Stream) null)); + Assert.Throws(() => new CodedInputStream(new byte[10], 100, 0)); + Assert.Throws(() => new CodedInputStream(new byte[10], 5, 10)); + } + + [Test] + public void CreateWithLimits_InvalidLimits() + { + var stream = new MemoryStream(); + Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 0, 1)); + Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 1, 0)); + } + + [Test] + public void Dispose_DisposesUnderlyingStream() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanRead); + using (var cis = new CodedInputStream(memoryStream)) + { + } + Assert.IsFalse(memoryStream.CanRead); // Disposed + } + + [Test] + public void Dispose_WithLeaveOpen() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanRead); + using (var cis = new CodedInputStream(memoryStream, true)) + { + } + Assert.IsTrue(memoryStream.CanRead); // We left the stream open + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs new file mode 100644 index 0000000000..01bd3218f3 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedOutputStreamTest.cs @@ -0,0 +1,419 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class CodedOutputStreamTest + { + /// + /// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and + /// checks that the result matches the given bytes + /// + private static void AssertWriteVarint(byte[] data, ulong value) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawVarint32((uint) value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value)); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawVarint64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value)); + } + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = + new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawVarint32((uint) value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawVarint64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + } + + /// + /// Tests WriteRawVarint32() and WriteRawVarint64() + /// + [Test] + public void WriteVarint() + { + AssertWriteVarint(new byte[] {0x00}, 0); + AssertWriteVarint(new byte[] {0x01}, 1); + AssertWriteVarint(new byte[] {0x7f}, 127); + // 14882 + AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertWriteVarint( + new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49}, + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49)); + // 11964378330978735131 + AssertWriteVarint( + new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01}, + unchecked((ulong) + ((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) | + (0x05L << 49) | (0x26L << 56) | (0x01L << 63)))); + } + + /// + /// Parses the given bytes using WriteRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian32(byte[] data, uint value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawLittleEndian32(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + rawOutput = new MemoryStream(); + output = new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawLittleEndian32(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Parses the given bytes using WriteRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian64(byte[] data, ulong value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawLittleEndian64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + rawOutput = new MemoryStream(); + output = new CodedOutputStream(rawOutput, blockSize); + output.WriteRawLittleEndian64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Tests writeRawLittleEndian32() and writeRawLittleEndian64(). + /// + [Test] + public void WriteLittleEndian() + { + AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678); + AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0); + + AssertWriteLittleEndian64( + new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12}, + 0x123456789abcdef0L); + AssertWriteLittleEndian64( + new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a}, + 0x9abcdef012345678UL); + } + + [Test] + public void WriteWholeMessage_VaryingBlockSizes() + { + TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); + + byte[] rawBytes = message.ToByteArray(); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize); + message.WriteTo(output); + output.Flush(); + Assert.AreEqual(rawBytes, rawOutput.ToArray()); + } + } + + [Test] + public void EncodeZigZag32() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag32(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag32(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag32(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag32(-2)); + Assert.AreEqual(0x7FFFFFFEu, CodedOutputStream.EncodeZigZag32(0x3FFFFFFF)); + Assert.AreEqual(0x7FFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0xC0000000))); + Assert.AreEqual(0xFFFFFFFEu, CodedOutputStream.EncodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0xFFFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0x80000000))); + } + + [Test] + public void EncodeZigZag64() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag64(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag64(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag64(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag64(-2)); + Assert.AreEqual(0x000000007FFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL))); + Assert.AreEqual(0x000000007FFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL))); + Assert.AreEqual(0x00000000FFFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL))); + Assert.AreEqual(0x00000000FFFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFEL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFFL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x8000000000000000UL))); + } + + [Test] + public void RoundTripZigZag32() + { + // Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1) + // were chosen semi-randomly via keyboard bashing. + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-3612))); + } + + [Test] + public void RoundTripZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612))); + + Assert.AreEqual(856912304801416L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L))); + Assert.AreEqual(-75123905439571256L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L))); + } + + [Test] + public void TestNegativeEnumNoTag() + { + Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2)); + Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue)); + + byte[] bytes = new byte[10]; + CodedOutputStream output = new CodedOutputStream(bytes); + output.WriteEnum((int) SampleEnum.NegativeValue); + + Assert.AreEqual(0, output.SpaceLeft); + Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [Test] + public void TestCodedInputOutputPosition() + { + byte[] content = new byte[110]; + for (int i = 0; i < content.Length; i++) + content[i] = (byte)i; + + byte[] child = new byte[120]; + { + MemoryStream ms = new MemoryStream(child); + CodedOutputStream cout = new CodedOutputStream(ms, 20); + // Field 11: numeric value: 500 + cout.WriteTag(11, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32(500); + Assert.AreEqual(3, cout.Position); + //Field 12: length delimited 120 bytes + cout.WriteTag(12, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytes(ByteString.CopyFrom(content)); + Assert.AreEqual(115, cout.Position); + // Field 13: fixed numeric value: 501 + cout.WriteTag(13, WireFormat.WireType.Fixed32); + Assert.AreEqual(116, cout.Position); + cout.WriteSFixed32(501); + Assert.AreEqual(120, cout.Position); + cout.Flush(); + } + + byte[] bytes = new byte[130]; + { + CodedOutputStream cout = new CodedOutputStream(bytes); + // Field 1: numeric value: 500 + cout.WriteTag(1, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32(500); + Assert.AreEqual(3, cout.Position); + //Field 2: length delimited 120 bytes + cout.WriteTag(2, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytes(ByteString.CopyFrom(child)); + Assert.AreEqual(125, cout.Position); + // Field 3: fixed numeric value: 500 + cout.WriteTag(3, WireFormat.WireType.Fixed32); + Assert.AreEqual(126, cout.Position); + cout.WriteSFixed32(501); + Assert.AreEqual(130, cout.Position); + cout.Flush(); + } + // Now test Input stream: + { + CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false); + Assert.AreEqual(0, cin.Position); + // Field 1: + uint tag = cin.ReadTag(); + Assert.AreEqual(1, tag >> 3); + Assert.AreEqual(1, cin.Position); + Assert.AreEqual(500, cin.ReadInt32()); + Assert.AreEqual(3, cin.Position); + //Field 2: + tag = cin.ReadTag(); + Assert.AreEqual(2, tag >> 3); + Assert.AreEqual(4, cin.Position); + int childlen = cin.ReadLength(); + Assert.AreEqual(120, childlen); + Assert.AreEqual(5, cin.Position); + int oldlimit = cin.PushLimit((int)childlen); + Assert.AreEqual(5, cin.Position); + // Now we are reading child message + { + // Field 11: numeric value: 500 + tag = cin.ReadTag(); + Assert.AreEqual(11, tag >> 3); + Assert.AreEqual(6, cin.Position); + Assert.AreEqual(500, cin.ReadInt32()); + Assert.AreEqual(8, cin.Position); + //Field 12: length delimited 120 bytes + tag = cin.ReadTag(); + Assert.AreEqual(12, tag >> 3); + Assert.AreEqual(9, cin.Position); + ByteString bstr = cin.ReadBytes(); + Assert.AreEqual(110, bstr.Length); + Assert.AreEqual((byte) 109, bstr[109]); + Assert.AreEqual(120, cin.Position); + // Field 13: fixed numeric value: 501 + tag = cin.ReadTag(); + Assert.AreEqual(13, tag >> 3); + // ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit + Assert.AreEqual(121, cin.Position); + Assert.AreEqual(501, cin.ReadSFixed32()); + Assert.AreEqual(125, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + cin.PopLimit(oldlimit); + Assert.AreEqual(125, cin.Position); + // Field 3: fixed numeric value: 501 + tag = cin.ReadTag(); + Assert.AreEqual(3, tag >> 3); + Assert.AreEqual(126, cin.Position); + Assert.AreEqual(501, cin.ReadSFixed32()); + Assert.AreEqual(130, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + } + + [Test] + public void Dispose_DisposesUnderlyingStream() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanWrite); + using (var cos = new CodedOutputStream(memoryStream)) + { + cos.WriteRawByte(0); + Assert.AreEqual(0, memoryStream.Position); // Not flushed yet + } + Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream + Assert.IsFalse(memoryStream.CanWrite); // Disposed + } + + [Test] + public void Dispose_WithLeaveOpen() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanWrite); + using (var cos = new CodedOutputStream(memoryStream, true)) + { + cos.WriteRawByte(0); + Assert.AreEqual(0, memoryStream.Position); // Not flushed yet + } + Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream + Assert.IsTrue(memoryStream.CanWrite); // We left the stream open + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs new file mode 100644 index 0000000000..9c8459073c --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs @@ -0,0 +1,532 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.Linq; + +namespace Google.Protobuf.Collections +{ + /// + /// Tests for MapField which aren't reliant on the encoded format - + /// tests for serialization/deserialization are part of GeneratedMessageTest. + /// + public class MapFieldTest + { + [Test] + public void Clone_ClonesMessages() + { + var message = new ForeignMessage { C = 20 }; + var map = new MapField { { "x", message } }; + var clone = map.Clone(); + map["x"].C = 30; + Assert.AreEqual(20, clone["x"].C); + } + + [Test] + public void NullValuesProhibited() + { + TestNullValues(0); + TestNullValues(""); + TestNullValues(new TestAllTypes()); + } + + private void TestNullValues(T nonNullValue) + { + var map = new MapField(); + var nullValue = (T) (object) null; + Assert.Throws(() => map.Add(0, nullValue)); + Assert.Throws(() => map[0] = nullValue); + map.Add(1, nonNullValue); + map[1] = nonNullValue; + } + + [Test] + public void Add_ForbidsNullKeys() + { + var map = new MapField(); + Assert.Throws(() => map.Add(null, new ForeignMessage())); + } + + [Test] + public void Indexer_ForbidsNullKeys() + { + var map = new MapField(); + Assert.Throws(() => map[null] = new ForeignMessage()); + } + + [Test] + public void AddPreservesInsertionOrder() + { + var map = new MapField(); + map.Add("a", "v1"); + map.Add("b", "v2"); + map.Add("c", "v3"); + map.Remove("b"); + map.Add("d", "v4"); + CollectionAssert.AreEqual(new[] { "a", "c", "d" }, map.Keys); + CollectionAssert.AreEqual(new[] { "v1", "v3", "v4" }, map.Values); + } + + [Test] + public void EqualityIsOrderInsensitive() + { + var map1 = new MapField(); + map1.Add("a", "v1"); + map1.Add("b", "v2"); + + var map2 = new MapField(); + map2.Add("b", "v2"); + map2.Add("a", "v1"); + + EqualityTester.AssertEquality(map1, map2); + } + + [Test] + public void EqualityIsKeySensitive() + { + var map1 = new MapField(); + map1.Add("first key", "v1"); + map1.Add("second key", "v2"); + + var map2 = new MapField(); + map2.Add("third key", "v1"); + map2.Add("fourth key", "v2"); + + EqualityTester.AssertInequality(map1, map2); + } + + [Test] + public void Equality_Simple() + { + var map = new MapField(); + EqualityTester.AssertEquality(map, map); + EqualityTester.AssertInequality(map, null); + Assert.IsFalse(map.Equals(new object())); + } + + [Test] + public void EqualityIsValueSensitive() + { + // Note: Without some care, it's a little easier than one might + // hope to see hash collisions, but only in some environments... + var map1 = new MapField(); + map1.Add("a", "first value"); + map1.Add("b", "second value"); + + var map2 = new MapField(); + map2.Add("a", "third value"); + map2.Add("b", "fourth value"); + + EqualityTester.AssertInequality(map1, map2); + } + + [Test] + public void Add_Dictionary() + { + var map1 = new MapField + { + { "x", "y" }, + { "a", "b" } + }; + var map2 = new MapField + { + { "before", "" }, + map1, + { "after", "" } + }; + var expected = new MapField + { + { "before", "" }, + { "x", "y" }, + { "a", "b" }, + { "after", "" } + }; + Assert.AreEqual(expected, map2); + CollectionAssert.AreEqual(new[] { "before", "x", "a", "after" }, map2.Keys); + } + + // General IDictionary behavior tests + [Test] + public void Add_KeyAlreadyExists() + { + var map = new MapField(); + map.Add("foo", "bar"); + Assert.Throws(() => map.Add("foo", "baz")); + } + + [Test] + public void Add_Pair() + { + var map = new MapField(); + ICollection> collection = map; + collection.Add(NewKeyValuePair("x", "y")); + Assert.AreEqual("y", map["x"]); + Assert.Throws(() => collection.Add(NewKeyValuePair("x", "z"))); + } + + [Test] + public void Contains_Pair() + { + var map = new MapField { { "x", "y" } }; + ICollection> collection = map; + Assert.IsTrue(collection.Contains(NewKeyValuePair("x", "y"))); + Assert.IsFalse(collection.Contains(NewKeyValuePair("x", "z"))); + Assert.IsFalse(collection.Contains(NewKeyValuePair("z", "y"))); + } + + [Test] + public void Remove_Key() + { + var map = new MapField(); + map.Add("foo", "bar"); + Assert.AreEqual(1, map.Count); + Assert.IsFalse(map.Remove("missing")); + Assert.AreEqual(1, map.Count); + Assert.IsTrue(map.Remove("foo")); + Assert.AreEqual(0, map.Count); + Assert.Throws(() => map.Remove(null)); + } + + [Test] + public void Remove_Pair() + { + var map = new MapField(); + map.Add("foo", "bar"); + ICollection> collection = map; + Assert.AreEqual(1, map.Count); + Assert.IsFalse(collection.Remove(NewKeyValuePair("wrong key", "bar"))); + Assert.AreEqual(1, map.Count); + Assert.IsFalse(collection.Remove(NewKeyValuePair("foo", "wrong value"))); + Assert.AreEqual(1, map.Count); + Assert.IsTrue(collection.Remove(NewKeyValuePair("foo", "bar"))); + Assert.AreEqual(0, map.Count); + Assert.Throws(() => collection.Remove(new KeyValuePair(null, ""))); + } + + [Test] + public void CopyTo_Pair() + { + var map = new MapField(); + map.Add("foo", "bar"); + ICollection> collection = map; + KeyValuePair[] array = new KeyValuePair[3]; + collection.CopyTo(array, 1); + Assert.AreEqual(NewKeyValuePair("foo", "bar"), array[1]); + } + + [Test] + public void Clear() + { + var map = new MapField { { "x", "y" } }; + Assert.AreEqual(1, map.Count); + map.Clear(); + Assert.AreEqual(0, map.Count); + map.Add("x", "y"); + Assert.AreEqual(1, map.Count); + } + + [Test] + public void Indexer_Get() + { + var map = new MapField { { "x", "y" } }; + Assert.AreEqual("y", map["x"]); + Assert.Throws(() => { var ignored = map["z"]; }); + } + + [Test] + public void Indexer_Set() + { + var map = new MapField(); + map["x"] = "y"; + Assert.AreEqual("y", map["x"]); + map["x"] = "z"; // This won't throw, unlike Add. + Assert.AreEqual("z", map["x"]); + } + + [Test] + public void GetEnumerator_NonGeneric() + { + IEnumerable map = new MapField { { "x", "y" } }; + CollectionAssert.AreEqual(new[] { new KeyValuePair("x", "y") }, + map.Cast().ToList()); + } + + // Test for the explicitly-implemented non-generic IDictionary interface + [Test] + public void IDictionary_GetEnumerator() + { + IDictionary map = new MapField { { "x", "y" } }; + var enumerator = map.GetEnumerator(); + + // Commented assertions show an ideal situation - it looks like + // the LinkedList enumerator doesn't throw when you ask for the current entry + // at an inappropriate time; fixing this would be more work than it's worth. + // Assert.Throws(() => enumerator.Current.GetHashCode()); + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("x", enumerator.Key); + Assert.AreEqual("y", enumerator.Value); + Assert.AreEqual(new DictionaryEntry("x", "y"), enumerator.Current); + Assert.AreEqual(new DictionaryEntry("x", "y"), enumerator.Entry); + Assert.IsFalse(enumerator.MoveNext()); + // Assert.Throws(() => enumerator.Current.GetHashCode()); + enumerator.Reset(); + // Assert.Throws(() => enumerator.Current.GetHashCode()); + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("x", enumerator.Key); // Assume the rest are okay + } + + [Test] + public void IDictionary_Add() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + dictionary.Add("a", "b"); + Assert.AreEqual("b", map["a"]); + Assert.Throws(() => dictionary.Add("a", "duplicate")); + Assert.Throws(() => dictionary.Add(new object(), "key is bad")); + Assert.Throws(() => dictionary.Add("value is bad", new object())); + } + + [Test] + public void IDictionary_Contains() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + + Assert.IsFalse(dictionary.Contains("a")); + Assert.IsFalse(dictionary.Contains(5)); + // Surprising, but IDictionary.Contains is only about keys. + Assert.IsFalse(dictionary.Contains(new DictionaryEntry("x", "y"))); + Assert.IsTrue(dictionary.Contains("x")); + } + + [Test] + public void IDictionary_Remove() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + dictionary.Remove("a"); + Assert.AreEqual(1, dictionary.Count); + dictionary.Remove(5); + Assert.AreEqual(1, dictionary.Count); + dictionary.Remove(new DictionaryEntry("x", "y")); + Assert.AreEqual(1, dictionary.Count); + dictionary.Remove("x"); + Assert.AreEqual(0, dictionary.Count); + Assert.Throws(() => dictionary.Remove(null)); + } + + [Test] + public void IDictionary_CopyTo() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + var array = new DictionaryEntry[3]; + dictionary.CopyTo(array, 1); + CollectionAssert.AreEqual(new[] { default(DictionaryEntry), new DictionaryEntry("x", "y"), default(DictionaryEntry) }, + array); + var objectArray = new object[3]; + dictionary.CopyTo(objectArray, 1); + CollectionAssert.AreEqual(new object[] { null, new DictionaryEntry("x", "y"), null }, + objectArray); + } + + [Test] + public void IDictionary_IsFixedSize() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + Assert.IsFalse(dictionary.IsFixedSize); + } + + [Test] + public void IDictionary_Keys() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + CollectionAssert.AreEqual(new[] { "x" }, dictionary.Keys); + } + + [Test] + public void IDictionary_Values() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + CollectionAssert.AreEqual(new[] { "y" }, dictionary.Values); + } + + [Test] + public void IDictionary_IsSynchronized() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + Assert.IsFalse(dictionary.IsSynchronized); + } + + [Test] + public void IDictionary_SyncRoot() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + Assert.AreSame(dictionary, dictionary.SyncRoot); + } + + [Test] + public void IDictionary_Indexer_Get() + { + IDictionary dictionary = new MapField { { "x", "y" } }; + Assert.AreEqual("y", dictionary["x"]); + Assert.IsNull(dictionary["a"]); + Assert.IsNull(dictionary[5]); + Assert.Throws(() => dictionary[null].GetHashCode()); + } + + [Test] + public void IDictionary_Indexer_Set() + { + var map = new MapField { { "x", "y" } }; + IDictionary dictionary = map; + map["a"] = "b"; + Assert.AreEqual("b", map["a"]); + map["a"] = "c"; + Assert.AreEqual("c", map["a"]); + Assert.Throws(() => dictionary[5] = "x"); + Assert.Throws(() => dictionary["x"] = 5); + Assert.Throws(() => dictionary[null] = "z"); + Assert.Throws(() => dictionary["x"] = null); + } + + [Test] + public void KeysReturnsLiveView() + { + var map = new MapField(); + var keys = map.Keys; + CollectionAssert.AreEqual(new string[0], keys); + map["foo"] = "bar"; + map["x"] = "y"; + CollectionAssert.AreEqual(new[] { "foo", "x" }, keys); + } + + [Test] + public void ValuesReturnsLiveView() + { + var map = new MapField(); + var values = map.Values; + CollectionAssert.AreEqual(new string[0], values); + map["foo"] = "bar"; + map["x"] = "y"; + CollectionAssert.AreEqual(new[] { "bar", "y" }, values); + } + + // Just test keys - we know the implementation is the same for values + [Test] + public void ViewsAreReadOnly() + { + var map = new MapField(); + var keys = map.Keys; + Assert.IsTrue(keys.IsReadOnly); + Assert.Throws(() => keys.Clear()); + Assert.Throws(() => keys.Remove("a")); + Assert.Throws(() => keys.Add("a")); + } + + // Just test keys - we know the implementation is the same for values + [Test] + public void ViewCopyTo() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var keys = map.Keys; + var array = new string[4]; + Assert.Throws(() => keys.CopyTo(array, 3)); + Assert.Throws(() => keys.CopyTo(array, -1)); + keys.CopyTo(array, 1); + CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array); + } + + // Just test keys - we know the implementation is the same for values + [Test] + public void NonGenericViewCopyTo() + { + IDictionary map = new MapField { { "foo", "bar" }, { "x", "y" } }; + ICollection keys = map.Keys; + // Note the use of the Array type here rather than string[] + Array array = new string[4]; + Assert.Throws(() => keys.CopyTo(array, 3)); + Assert.Throws(() => keys.CopyTo(array, -1)); + keys.CopyTo(array, 1); + CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array); + } + + [Test] + public void KeysContains() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var keys = map.Keys; + Assert.IsTrue(keys.Contains("foo")); + Assert.IsFalse(keys.Contains("bar")); // It's a value! + Assert.IsFalse(keys.Contains("1")); + // Keys can't be null, so we should prevent contains check + Assert.Throws(() => keys.Contains(null)); + } + + [Test] + public void ValuesContains() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var values = map.Values; + Assert.IsTrue(values.Contains("bar")); + Assert.IsFalse(values.Contains("foo")); // It's a key! + Assert.IsFalse(values.Contains("1")); + // Values can be null, so this makes sense + Assert.IsFalse(values.Contains(null)); + } + + [Test] + public void ToString_StringToString() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + Assert.AreEqual("{ \"foo\": \"bar\", \"x\": \"y\" }", map.ToString()); + } + + [Test] + public void ToString_UnsupportedKeyType() + { + var map = new MapField { { 10, "foo" } }; + Assert.Throws(() => map.ToString()); + } + + private static KeyValuePair NewKeyValuePair(TKey key, TValue value) + { + return new KeyValuePair(key, value); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs new file mode 100644 index 0000000000..6852f75f8e --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs @@ -0,0 +1,746 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; + +namespace Google.Protobuf.Collections +{ + public class RepeatedFieldTest + { + [Test] + public void NullValuesRejected() + { + var list = new RepeatedField(); + Assert.Throws(() => list.Add((string)null)); + Assert.Throws(() => list.Add((IEnumerable)null)); + Assert.Throws(() => list.Add((RepeatedField)null)); + Assert.Throws(() => list.Contains(null)); + Assert.Throws(() => list.IndexOf(null)); + } + + [Test] + public void Add_SingleItem() + { + var list = new RepeatedField(); + list.Add("foo"); + Assert.AreEqual(1, list.Count); + Assert.AreEqual("foo", list[0]); + } + + [Test] + public void Add_Sequence() + { + var list = new RepeatedField(); + list.Add(new[] { "foo", "bar" }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_SlowPath() + { + var list = new RepeatedField(); + list.AddRange(new[] { "foo", "bar" }.Select(x => x)); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_SlowPath_NullsProhibited_ReferenceType() + { + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new[] { "foo", null }.Select(x => x))); + } + + [Test] + public void AddRange_SlowPath_NullsProhibited_NullableValueType() + { + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new[] { 20, (int?)null }.Select(x => x))); + } + + [Test] + public void AddRange_Optimized_NonNullableValueType() + { + var list = new RepeatedField(); + list.AddRange(new List { 20, 30 }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual(20, list[0]); + Assert.AreEqual(30, list[1]); + } + + [Test] + public void AddRange_Optimized_ReferenceType() + { + var list = new RepeatedField(); + list.AddRange(new List { "foo", "bar" }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_Optimized_NullableValueType() + { + var list = new RepeatedField(); + list.AddRange(new List { 20, 30 }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual((int?) 20, list[0]); + Assert.AreEqual((int?) 30, list[1]); + } + + [Test] + public void AddRange_Optimized_NullsProhibited_ReferenceType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new List { "foo", null })); + } + + [Test] + public void AddRange_Optimized_NullsProhibited_NullableValueType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new List { 20, null })); + } + + [Test] + public void AddRange_AlreadyNotEmpty() + { + var list = new RepeatedField { 1, 2, 3 }; + list.AddRange(new List { 4, 5, 6 }); + CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list); + } + + [Test] + public void AddRange_RepeatedField() + { + var list = new RepeatedField { "original" }; + list.AddRange(new RepeatedField { "foo", "bar" }); + Assert.AreEqual(3, list.Count); + Assert.AreEqual("original", list[0]); + Assert.AreEqual("foo", list[1]); + Assert.AreEqual("bar", list[2]); + } + + [Test] + public void RemoveAt_Valid() + { + var list = new RepeatedField { "first", "second", "third" }; + list.RemoveAt(1); + CollectionAssert.AreEqual(new[] { "first", "third" }, list); + // Just check that these don't throw... + list.RemoveAt(list.Count - 1); // Now the count will be 1... + list.RemoveAt(0); + Assert.AreEqual(0, list.Count); + } + + [Test] + public void RemoveAt_Invalid() + { + var list = new RepeatedField { "first", "second", "third" }; + Assert.Throws(() => list.RemoveAt(-1)); + Assert.Throws(() => list.RemoveAt(3)); + } + + [Test] + public void Insert_Valid() + { + var list = new RepeatedField { "first", "second" }; + list.Insert(1, "middle"); + CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list); + list.Insert(3, "end"); + CollectionAssert.AreEqual(new[] { "first", "middle", "second", "end" }, list); + list.Insert(0, "start"); + CollectionAssert.AreEqual(new[] { "start", "first", "middle", "second", "end" }, list); + } + + [Test] + public void Insert_Invalid() + { + var list = new RepeatedField { "first", "second" }; + Assert.Throws(() => list.Insert(-1, "foo")); + Assert.Throws(() => list.Insert(3, "foo")); + Assert.Throws(() => list.Insert(0, null)); + } + + [Test] + public void Equals_RepeatedField() + { + var list = new RepeatedField { "first", "second" }; + Assert.IsFalse(list.Equals((RepeatedField) null)); + Assert.IsTrue(list.Equals(list)); + Assert.IsFalse(list.Equals(new RepeatedField { "first", "third" })); + Assert.IsFalse(list.Equals(new RepeatedField { "first" })); + Assert.IsTrue(list.Equals(new RepeatedField { "first", "second" })); + } + + [Test] + public void Equals_Object() + { + var list = new RepeatedField { "first", "second" }; + Assert.IsFalse(list.Equals((object) null)); + Assert.IsTrue(list.Equals((object) list)); + Assert.IsFalse(list.Equals((object) new RepeatedField { "first", "third" })); + Assert.IsFalse(list.Equals((object) new RepeatedField { "first" })); + Assert.IsTrue(list.Equals((object) new RepeatedField { "first", "second" })); + Assert.IsFalse(list.Equals(new object())); + } + + [Test] + public void GetEnumerator_GenericInterface() + { + IEnumerable list = new RepeatedField { "first", "second" }; + // Select gets rid of the optimizations in ToList... + CollectionAssert.AreEqual(new[] { "first", "second" }, list.Select(x => x).ToList()); + } + + [Test] + public void GetEnumerator_NonGenericInterface() + { + IEnumerable list = new RepeatedField { "first", "second" }; + CollectionAssert.AreEqual(new[] { "first", "second" }, list.Cast().ToList()); + } + + [Test] + public void CopyTo() + { + var list = new RepeatedField { "first", "second" }; + string[] stringArray = new string[4]; + list.CopyTo(stringArray, 1); + CollectionAssert.AreEqual(new[] { null, "first", "second", null }, stringArray); + } + + [Test] + public void Indexer_Get() + { + var list = new RepeatedField { "first", "second" }; + Assert.AreEqual("first", list[0]); + Assert.AreEqual("second", list[1]); + Assert.Throws(() => list[-1].GetHashCode()); + Assert.Throws(() => list[2].GetHashCode()); + } + + [Test] + public void Indexer_Set() + { + var list = new RepeatedField { "first", "second" }; + list[0] = "changed"; + Assert.AreEqual("changed", list[0]); + Assert.Throws(() => list[0] = null); + Assert.Throws(() => list[-1] = "bad"); + Assert.Throws(() => list[2] = "bad"); + } + + [Test] + public void Clone_ReturnsMutable() + { + var list = new RepeatedField { 0 }; + var clone = list.Clone(); + clone[0] = 1; + } + + [Test] + public void Enumerator() + { + var list = new RepeatedField { "first", "second" }; + using (var enumerator = list.GetEnumerator()) + { + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("first", enumerator.Current); + Assert.IsTrue(enumerator.MoveNext()); + Assert.AreEqual("second", enumerator.Current); + Assert.IsFalse(enumerator.MoveNext()); + Assert.IsFalse(enumerator.MoveNext()); + } + } + + [Test] + public void AddEntriesFrom_PackedInt32() + { + uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var length = CodedOutputStream.ComputeInt32Size(10) + + CodedOutputStream.ComputeInt32Size(999) + + CodedOutputStream.ComputeInt32Size(-1000); + output.WriteTag(packedTag); + output.WriteRawVarint32((uint) length); + output.WriteInt32(10); + output.WriteInt32(999); + output.WriteInt32(-1000); + output.Flush(); + stream.Position = 0; + + // Deliberately "expecting" a non-packed tag, but we detect that the data is + // actually packed. + uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(packedTag); + field.AddEntriesFrom(input, FieldCodec.ForInt32(nonPackedTag)); + CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void AddEntriesFrom_NonPackedInt32() + { + uint nonPackedTag = WireFormat.MakeTag(10, WireFormat.WireType.Varint); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(nonPackedTag); + output.WriteInt32(10); + output.WriteTag(nonPackedTag); + output.WriteInt32(999); + output.WriteTag(nonPackedTag); + output.WriteInt32(-1000); // Just for variety... + output.Flush(); + stream.Position = 0; + + // Deliberately "expecting" a packed tag, but we detect that the data is + // actually not packed. + uint packedTag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(nonPackedTag); + field.AddEntriesFrom(input, FieldCodec.ForInt32(packedTag)); + CollectionAssert.AreEqual(new[] { 10, 999, -1000 }, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void AddEntriesFrom_String() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(tag); + output.WriteString("Foo"); + output.WriteTag(tag); + output.WriteString(""); + output.WriteTag(tag); + output.WriteString("Bar"); + output.Flush(); + stream.Position = 0; + + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + field.AddEntriesFrom(input, FieldCodec.ForString(tag)); + CollectionAssert.AreEqual(new[] { "Foo", "", "Bar" }, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void AddEntriesFrom_Message() + { + var message1 = new ForeignMessage { C = 2000 }; + var message2 = new ForeignMessage { C = -250 }; + + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(tag); + output.WriteMessage(message1); + output.WriteTag(tag); + output.WriteMessage(message2); + output.Flush(); + stream.Position = 0; + + var field = new RepeatedField(); + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + field.AddEntriesFrom(input, FieldCodec.ForMessage(tag, ForeignMessage.Parser)); + CollectionAssert.AreEqual(new[] { message1, message2}, field); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void WriteTo_PackedInt32() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField { 10, 1000, 1000000 }; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForInt32(tag)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + var length = input.ReadLength(); + Assert.AreEqual(10, input.ReadInt32()); + Assert.AreEqual(1000, input.ReadInt32()); + Assert.AreEqual(1000000, input.ReadInt32()); + Assert.IsTrue(input.IsAtEnd); + Assert.AreEqual(1 + CodedOutputStream.ComputeLengthSize(length) + length, stream.Length); + } + + [Test] + public void WriteTo_NonPackedInt32() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.Varint); + var field = new RepeatedField { 10, 1000, 1000000}; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForInt32(tag)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + Assert.AreEqual(10, input.ReadInt32()); + input.AssertNextTag(tag); + Assert.AreEqual(1000, input.ReadInt32()); + input.AssertNextTag(tag); + Assert.AreEqual(1000000, input.ReadInt32()); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void WriteTo_String() + { + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField { "Foo", "", "Bar" }; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForString(tag)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + Assert.AreEqual("Foo", input.ReadString()); + input.AssertNextTag(tag); + Assert.AreEqual("", input.ReadString()); + input.AssertNextTag(tag); + Assert.AreEqual("Bar", input.ReadString()); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void WriteTo_Message() + { + var message1 = new ForeignMessage { C = 20 }; + var message2 = new ForeignMessage { C = 25 }; + uint tag = WireFormat.MakeTag(10, WireFormat.WireType.LengthDelimited); + var field = new RepeatedField { message1, message2 }; + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + field.WriteTo(output, FieldCodec.ForMessage(tag, ForeignMessage.Parser)); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + input.AssertNextTag(tag); + Assert.AreEqual(message1, input.ReadMessage(ForeignMessage.Parser)); + input.AssertNextTag(tag); + Assert.AreEqual(message2, input.ReadMessage(ForeignMessage.Parser)); + Assert.IsTrue(input.IsAtEnd); + } + + [Test] + public void CalculateSize_VariableSizeNonPacked() + { + var list = new RepeatedField { 1, 500, 1 }; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.Varint); + // 2 bytes for the first entry, 3 bytes for the second, 2 bytes for the third + Assert.AreEqual(7, list.CalculateSize(FieldCodec.ForInt32(tag))); + } + + [Test] + public void CalculateSize_FixedSizeNonPacked() + { + var list = new RepeatedField { 1, 500, 1 }; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.Fixed32); + // 5 bytes for the each entry + Assert.AreEqual(15, list.CalculateSize(FieldCodec.ForSFixed32(tag))); + } + + [Test] + public void CalculateSize_VariableSizePacked() + { + var list = new RepeatedField { 1, 500, 1}; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + // 1 byte for the tag, 1 byte for the length, + // 1 byte for the first entry, 2 bytes for the second, 1 byte for the third + Assert.AreEqual(6, list.CalculateSize(FieldCodec.ForInt32(tag))); + } + + [Test] + public void CalculateSize_FixedSizePacked() + { + var list = new RepeatedField { 1, 500, 1 }; + var tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + // 1 byte for the tag, 1 byte for the length, 4 bytes per entry + Assert.AreEqual(14, list.CalculateSize(FieldCodec.ForSFixed32(tag))); + } + + [Test] + public void TestNegativeEnumArray() + { + int arraySize = 1 + 1 + (11 * 5); + int msgSize = arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = new CodedOutputStream(bytes); + uint tag = WireFormat.MakeTag(8, WireFormat.WireType.Varint); + for (int i = 0; i >= -5; i--) + { + output.WriteTag(tag); + output.WriteEnum(i); + } + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = new CodedInputStream(bytes); + tag = input.ReadTag(); + + RepeatedField values = new RepeatedField(); + values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x)); + + Assert.AreEqual(6, values.Count); + Assert.AreEqual(SampleEnum.None, values[0]); + Assert.AreEqual(((SampleEnum)(-1)), values[1]); + Assert.AreEqual(SampleEnum.NegativeValue, values[2]); + Assert.AreEqual(((SampleEnum)(-3)), values[3]); + Assert.AreEqual(((SampleEnum)(-4)), values[4]); + Assert.AreEqual(((SampleEnum)(-5)), values[5]); + } + + + [Test] + public void TestNegativeEnumPackedArray() + { + int arraySize = 1 + (10 * 5); + int msgSize = 1 + 1 + arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = new CodedOutputStream(bytes); + // Length-delimited to show we want the packed representation + uint tag = WireFormat.MakeTag(8, WireFormat.WireType.LengthDelimited); + output.WriteTag(tag); + int size = 0; + for (int i = 0; i >= -5; i--) + { + size += CodedOutputStream.ComputeEnumSize(i); + } + output.WriteRawVarint32((uint)size); + for (int i = 0; i >= -5; i--) + { + output.WriteEnum(i); + } + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = new CodedInputStream(bytes); + tag = input.ReadTag(); + + RepeatedField values = new RepeatedField(); + values.AddEntriesFrom(input, FieldCodec.ForEnum(tag, x => (int)x, x => (SampleEnum)x)); + + Assert.AreEqual(6, values.Count); + Assert.AreEqual(SampleEnum.None, values[0]); + Assert.AreEqual(((SampleEnum)(-1)), values[1]); + Assert.AreEqual(SampleEnum.NegativeValue, values[2]); + Assert.AreEqual(((SampleEnum)(-3)), values[3]); + Assert.AreEqual(((SampleEnum)(-4)), values[4]); + Assert.AreEqual(((SampleEnum)(-5)), values[5]); + } + + // Fairly perfunctory tests for the non-generic IList implementation + [Test] + public void IList_Indexer() + { + var field = new RepeatedField { "first", "second" }; + IList list = field; + Assert.AreEqual("first", list[0]); + list[1] = "changed"; + Assert.AreEqual("changed", field[1]); + } + + [Test] + public void IList_Contains() + { + IList list = new RepeatedField { "first", "second" }; + Assert.IsTrue(list.Contains("second")); + Assert.IsFalse(list.Contains("third")); + Assert.IsFalse(list.Contains(new object())); + } + + [Test] + public void IList_Add() + { + IList list = new RepeatedField { "first", "second" }; + list.Add("third"); + CollectionAssert.AreEqual(new[] { "first", "second", "third" }, list); + } + + [Test] + public void IList_Remove() + { + IList list = new RepeatedField { "first", "second" }; + list.Remove("third"); // No-op, no exception + list.Remove(new object()); // No-op, no exception + list.Remove("first"); + CollectionAssert.AreEqual(new[] { "second" }, list); + } + + [Test] + public void IList_IsFixedSize() + { + var field = new RepeatedField { "first", "second" }; + IList list = field; + Assert.IsFalse(list.IsFixedSize); + } + + [Test] + public void IList_IndexOf() + { + IList list = new RepeatedField { "first", "second" }; + Assert.AreEqual(1, list.IndexOf("second")); + Assert.AreEqual(-1, list.IndexOf("third")); + Assert.AreEqual(-1, list.IndexOf(new object())); + } + + [Test] + public void IList_SyncRoot() + { + IList list = new RepeatedField { "first", "second" }; + Assert.AreSame(list, list.SyncRoot); + } + + [Test] + public void IList_CopyTo() + { + IList list = new RepeatedField { "first", "second" }; + string[] stringArray = new string[4]; + list.CopyTo(stringArray, 1); + CollectionAssert.AreEqual(new[] { null, "first", "second", null }, stringArray); + + object[] objectArray = new object[4]; + list.CopyTo(objectArray, 1); + CollectionAssert.AreEqual(new[] { null, "first", "second", null }, objectArray); + + Assert.Throws(() => list.CopyTo(new StringBuilder[4], 1)); + Assert.Throws(() => list.CopyTo(new int[4], 1)); + } + + [Test] + public void IList_IsSynchronized() + { + IList list = new RepeatedField { "first", "second" }; + Assert.IsFalse(list.IsSynchronized); + } + + [Test] + public void IList_Insert() + { + IList list = new RepeatedField { "first", "second" }; + list.Insert(1, "middle"); + CollectionAssert.AreEqual(new[] { "first", "middle", "second" }, list); + } + + [Test] + public void ToString_Integers() + { + var list = new RepeatedField { 5, 10, 20 }; + var text = list.ToString(); + Assert.AreEqual("[ 5, 10, 20 ]", text); + } + + [Test] + public void ToString_Strings() + { + var list = new RepeatedField { "x", "y", "z" }; + var text = list.ToString(); + Assert.AreEqual("[ \"x\", \"y\", \"z\" ]", text); + } + + [Test] + public void ToString_Messages() + { + var list = new RepeatedField { new TestAllTypes { SingleDouble = 1.5 }, new TestAllTypes { SingleInt32 = 10 } }; + var text = list.ToString(); + Assert.AreEqual("[ { \"singleDouble\": 1.5 }, { \"singleInt32\": 10 } ]", text); + } + + [Test] + public void ToString_Empty() + { + var list = new RepeatedField { }; + var text = list.ToString(); + Assert.AreEqual("[ ]", text); + } + + [Test] + public void ToString_InvalidElementType() + { + var list = new RepeatedField { 15m }; + Assert.Throws(() => list.ToString()); + } + + [Test] + public void ToString_Timestamp() + { + var list = new RepeatedField { Timestamp.FromDateTime(new DateTime(2015, 10, 1, 12, 34, 56, DateTimeKind.Utc)) }; + var text = list.ToString(); + Assert.AreEqual("[ \"2015-10-01T12:34:56Z\" ]", text); + } + + [Test] + public void ToString_Struct() + { + var message = new Struct { Fields = { { "foo", new Value { NumberValue = 20 } } } }; + var list = new RepeatedField { message }; + var text = list.ToString(); + Assert.AreEqual(text, "[ { \"foo\": 20 } ]", message.ToString()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs new file mode 100644 index 0000000000..df23a09cd4 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/PropertyInfoExtensionsTest.cs @@ -0,0 +1,98 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; +using System.Reflection; + +namespace Google.Protobuf.Compatibility +{ + public class PropertyInfoExtensionsTest + { + public string PublicReadWrite { get; set; } + private string PrivateReadWrite { get; set; } + public string PublicReadPrivateWrite { get; private set; } + public string PrivateReadPublicWrite { private get; set; } + public string PublicReadOnly { get { return null; } } + private string PrivateReadOnly { get { return null; } } + public string PublicWriteOnly { set { } } + private string PrivateWriteOnly { set { } } + + [Test] + [TestCase("PublicReadWrite")] + [TestCase("PublicReadPrivateWrite")] + [TestCase("PublicReadOnly")] + public void GetGetMethod_Success(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNotNull(PropertyInfoExtensions.GetGetMethod(propertyInfo)); + } + + [Test] + [TestCase("PrivateReadWrite")] + [TestCase("PrivateReadPublicWrite")] + [TestCase("PrivateReadOnly")] + [TestCase("PublicWriteOnly")] + [TestCase("PrivateWriteOnly")] + public void GetGetMethod_NoAccessibleGetter(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNull(PropertyInfoExtensions.GetGetMethod(propertyInfo)); + } + + [Test] + [TestCase("PublicReadWrite")] + [TestCase("PrivateReadPublicWrite")] + [TestCase("PublicWriteOnly")] + public void GetSetMethod_Success(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNotNull(PropertyInfoExtensions.GetSetMethod(propertyInfo)); + } + + [Test] + [TestCase("PublicReadPrivateWrite")] + [TestCase("PrivateReadWrite")] + [TestCase("PrivateReadOnly")] + [TestCase("PublicReadOnly")] + [TestCase("PrivateWriteOnly")] + public void GetSetMethod_NoAccessibleGetter(string name) + { + var propertyInfo = typeof(PropertyInfoExtensionsTest) + .GetProperty(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + Assert.IsNull(PropertyInfoExtensions.GetSetMethod(propertyInfo)); + } + } + +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs new file mode 100644 index 0000000000..f430b06bed --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs @@ -0,0 +1,117 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Reflection; + +#if !DOTNET35 +namespace Google.Protobuf.Compatibility +{ + public class TypeExtensionsTest + { + public class DerivedList : List { } + public string PublicProperty { get; set; } + private string PrivateProperty { get; set; } + + public void PublicMethod() + { + } + + private void PrivateMethod() + { + } + + [Test] + [TestCase(typeof(object), typeof(string), true)] + [TestCase(typeof(object), typeof(int), true)] + [TestCase(typeof(string), typeof(string), true)] + [TestCase(typeof(string), typeof(object), false)] + [TestCase(typeof(string), typeof(int), false)] + [TestCase(typeof(int), typeof(int), true)] + [TestCase(typeof(ValueType), typeof(int), true)] + [TestCase(typeof(long), typeof(int), false)] // + public void IsAssignableFrom(Type target, Type argument, bool expected) + { + Assert.AreEqual(expected, TypeExtensions.IsAssignableFrom(target, argument)); + } + + [Test] + [TestCase(typeof(DerivedList), "Count")] // Go up the type hierarchy + [TestCase(typeof(List), "Count")] + [TestCase(typeof(List<>), "Count")] + [TestCase(typeof(TypeExtensionsTest), "PublicProperty")] + public void GetProperty_Success(Type type, string name) + { + var property = TypeExtensions.GetProperty(type, name); + Assert.IsNotNull(property); + Assert.AreEqual(name, property.Name); + } + + [Test] + [TestCase(typeof(TypeExtensionsTest), "PrivateProperty")] + [TestCase(typeof(TypeExtensionsTest), "Garbage")] + public void GetProperty_NoSuchProperty(Type type, string name) + { + var property = TypeExtensions.GetProperty(type, name); + Assert.IsNull(property); + } + + [Test] + [TestCase(typeof(DerivedList), "RemoveAt")] // Go up the type hierarchy + [TestCase(typeof(List<>), "RemoveAt")] + [TestCase(typeof(TypeExtensionsTest), "PublicMethod")] + public void GetMethod_Success(Type type, string name) + { + var method = TypeExtensions.GetMethod(type, name); + Assert.IsNotNull(method); + Assert.AreEqual(name, method.Name); + } + + [Test] + [TestCase(typeof(TypeExtensionsTest), "PrivateMethod")] + [TestCase(typeof(TypeExtensionsTest), "GarbageMethod")] + public void GetMethod_NoSuchMethod(Type type, string name) + { + var method = TypeExtensions.GetMethod(type, name); + Assert.IsNull(method); + } + + [Test] + [TestCase(typeof(List), "IndexOf")] + public void GetMethod_Ambiguous(Type type, string name) + { + Assert.Throws(() => TypeExtensions.GetMethod(type, name)); + } + } +} +#endif diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs similarity index 73% rename from packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs rename to packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs index d22e90fd8f..34d5b9f98c 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Properties/AssemblyInfo.cs +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/DeprecatedMemberTest.cs @@ -1,48 +1,55 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System.Reflection; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Google.Protobuf.Conformance")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Google.Protobuf.Conformance")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Reflection; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class DeprecatedMemberTest + { + private static void AssertIsDeprecated(MemberInfo member) + { + Assert.NotNull(member); + Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); + } + + [Test] + public void TestDepreatedPrimitiveValue() + { + AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32")); + } + + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs new file mode 100644 index 0000000000..a669baba17 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/EqualityTester.cs @@ -0,0 +1,64 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using NUnit.Framework; + +namespace Google.Protobuf +{ + /// + /// Helper methods when testing equality. NUnit's Assert.AreEqual and + /// Assert.AreNotEqual methods try to be clever with collections, which can + /// be annoying... + /// + internal static class EqualityTester + { + public static void AssertEquality(T first, T second) where T : IEquatable + { + Assert.IsTrue(first.Equals(second)); + Assert.IsTrue(first.Equals((object) second)); + Assert.AreEqual(first.GetHashCode(), second.GetHashCode()); + } + + public static void AssertInequality(T first, T second) where T : IEquatable + { + Assert.IsFalse(first.Equals(second)); + Assert.IsFalse(first.Equals((object) second)); + // While this isn't a requirement, the chances of this test failing due to + // coincidence rather than a bug are very small. + if (first != null && second != null) + { + Assert.AreNotEqual(first.GetHashCode(), second.GetHashCode()); + } + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs new file mode 100644 index 0000000000..0e2bad59e5 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs @@ -0,0 +1,196 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class FieldCodecTest + { +#pragma warning disable 0414 // Used by tests via reflection - do not remove! + private static readonly List Codecs = new List + { + new FieldCodecTestData(FieldCodec.ForBool(100), true, "Bool"), + new FieldCodecTestData(FieldCodec.ForString(100), "sample", "String"), + new FieldCodecTestData(FieldCodec.ForBytes(100), ByteString.CopyFrom(1, 2, 3), "Bytes"), + new FieldCodecTestData(FieldCodec.ForInt32(100), -1000, "Int32"), + new FieldCodecTestData(FieldCodec.ForSInt32(100), -1000, "SInt32"), + new FieldCodecTestData(FieldCodec.ForSFixed32(100), -1000, "SFixed32"), + new FieldCodecTestData(FieldCodec.ForUInt32(100), 1234, "UInt32"), + new FieldCodecTestData(FieldCodec.ForFixed32(100), 1234, "Fixed32"), + new FieldCodecTestData(FieldCodec.ForInt64(100), -1000, "Int64"), + new FieldCodecTestData(FieldCodec.ForSInt64(100), -1000, "SInt64"), + new FieldCodecTestData(FieldCodec.ForSFixed64(100), -1000, "SFixed64"), + new FieldCodecTestData(FieldCodec.ForUInt64(100), 1234, "UInt64"), + new FieldCodecTestData(FieldCodec.ForFixed64(100), 1234, "Fixed64"), + new FieldCodecTestData(FieldCodec.ForFloat(100), 1234.5f, "Float"), + new FieldCodecTestData(FieldCodec.ForDouble(100), 1234567890.5d, "Double"), + new FieldCodecTestData( + FieldCodec.ForEnum(100, t => (int) t, t => (ForeignEnum) t), ForeignEnum.ForeignBaz, "Enum"), + new FieldCodecTestData( + FieldCodec.ForMessage(100, ForeignMessage.Parser), new ForeignMessage { C = 10 }, "Message"), + }; +#pragma warning restore 0414 + + [Test, TestCaseSource("Codecs")] + public void RoundTripWithTag(ICodecTestData codec) + { + codec.TestRoundTripWithTag(); + } + + [Test, TestCaseSource("Codecs")] + public void RoundTripRaw(ICodecTestData codec) + { + codec.TestRoundTripRaw(); + } + + [Test, TestCaseSource("Codecs")] + public void CalculateSize(ICodecTestData codec) + { + codec.TestCalculateSizeWithTag(); + } + + [Test, TestCaseSource("Codecs")] + public void DefaultValue(ICodecTestData codec) + { + codec.TestDefaultValue(); + } + + [Test, TestCaseSource("Codecs")] + public void FixedSize(ICodecTestData codec) + { + codec.TestFixedSize(); + } + + // This is ugly, but it means we can have a non-generic interface. + // It feels like NUnit should support this better, but I don't know + // of any better ways right now. + public interface ICodecTestData + { + void TestRoundTripRaw(); + void TestRoundTripWithTag(); + void TestCalculateSizeWithTag(); + void TestDefaultValue(); + void TestFixedSize(); + } + + public class FieldCodecTestData : ICodecTestData + { + private readonly FieldCodec codec; + private readonly T sampleValue; + private readonly string name; + + public FieldCodecTestData(FieldCodec codec, T sampleValue, string name) + { + this.codec = codec; + this.sampleValue = sampleValue; + this.name = name; + } + + public void TestRoundTripRaw() + { + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.ValueWriter(codedOutput, sampleValue); + codedOutput.Flush(); + stream.Position = 0; + var codedInput = new CodedInputStream(stream); + Assert.AreEqual(sampleValue, codec.ValueReader(codedInput)); + Assert.IsTrue(codedInput.IsAtEnd); + } + + public void TestRoundTripWithTag() + { + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.WriteTagAndValue(codedOutput, sampleValue); + codedOutput.Flush(); + stream.Position = 0; + var codedInput = new CodedInputStream(stream); + codedInput.AssertNextTag(codec.Tag); + Assert.AreEqual(sampleValue, codec.Read(codedInput)); + Assert.IsTrue(codedInput.IsAtEnd); + } + + public void TestCalculateSizeWithTag() + { + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.WriteTagAndValue(codedOutput, sampleValue); + codedOutput.Flush(); + Assert.AreEqual(stream.Position, codec.CalculateSizeWithTag(sampleValue)); + } + + public void TestDefaultValue() + { + // WriteTagAndValue ignores default values + var stream = new MemoryStream(); + var codedOutput = new CodedOutputStream(stream); + codec.WriteTagAndValue(codedOutput, codec.DefaultValue); + codedOutput.Flush(); + Assert.AreEqual(0, stream.Position); + Assert.AreEqual(0, codec.CalculateSizeWithTag(codec.DefaultValue)); + if (typeof(T).GetTypeInfo().IsValueType) + { + Assert.AreEqual(default(T), codec.DefaultValue); + } + + // The plain ValueWriter/ValueReader delegates don't. + if (codec.DefaultValue != null) // This part isn't appropriate for message types. + { + codedOutput = new CodedOutputStream(stream); + codec.ValueWriter(codedOutput, codec.DefaultValue); + codedOutput.Flush(); + Assert.AreNotEqual(0, stream.Position); + Assert.AreEqual(stream.Position, codec.ValueSizeCalculator(codec.DefaultValue)); + stream.Position = 0; + var codedInput = new CodedInputStream(stream); + Assert.AreEqual(codec.DefaultValue, codec.ValueReader(codedInput)); + } + } + + public void TestFixedSize() + { + Assert.AreEqual(name.Contains("Fixed"), codec.FixedSize != 0); + } + + public override string ToString() + { + return name; + } + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs new file mode 100644 index 0000000000..8b153d691f --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -0,0 +1,723 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Google.Protobuf.WellKnownTypes; + +namespace Google.Protobuf +{ + /// + /// Tests around the generated TestAllTypes message. + /// + public class GeneratedMessageTest + { + [Test] + public void EmptyMessageFieldDistinctFromMissingMessageField() + { + // This demonstrates what we're really interested in... + var message1 = new TestAllTypes { SingleForeignMessage = new ForeignMessage() }; + var message2 = new TestAllTypes(); // SingleForeignMessage is null + EqualityTester.AssertInequality(message1, message2); + } + + [Test] + public void DefaultValues() + { + // Single fields + var message = new TestAllTypes(); + Assert.AreEqual(false, message.SingleBool); + Assert.AreEqual(ByteString.Empty, message.SingleBytes); + Assert.AreEqual(0.0, message.SingleDouble); + Assert.AreEqual(0, message.SingleFixed32); + Assert.AreEqual(0L, message.SingleFixed64); + Assert.AreEqual(0.0f, message.SingleFloat); + Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum); + Assert.IsNull(message.SingleForeignMessage); + Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum); + Assert.IsNull(message.SingleImportMessage); + Assert.AreEqual(0, message.SingleInt32); + Assert.AreEqual(0L, message.SingleInt64); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum); + Assert.IsNull(message.SingleNestedMessage); + Assert.IsNull(message.SinglePublicImportMessage); + Assert.AreEqual(0, message.SingleSfixed32); + Assert.AreEqual(0L, message.SingleSfixed64); + Assert.AreEqual(0, message.SingleSint32); + Assert.AreEqual(0L, message.SingleSint64); + Assert.AreEqual("", message.SingleString); + Assert.AreEqual(0U, message.SingleUint32); + Assert.AreEqual(0UL, message.SingleUint64); + + // Repeated fields + Assert.AreEqual(0, message.RepeatedBool.Count); + Assert.AreEqual(0, message.RepeatedBytes.Count); + Assert.AreEqual(0, message.RepeatedDouble.Count); + Assert.AreEqual(0, message.RepeatedFixed32.Count); + Assert.AreEqual(0, message.RepeatedFixed64.Count); + Assert.AreEqual(0, message.RepeatedFloat.Count); + Assert.AreEqual(0, message.RepeatedForeignEnum.Count); + Assert.AreEqual(0, message.RepeatedForeignMessage.Count); + Assert.AreEqual(0, message.RepeatedImportEnum.Count); + Assert.AreEqual(0, message.RepeatedImportMessage.Count); + Assert.AreEqual(0, message.RepeatedNestedEnum.Count); + Assert.AreEqual(0, message.RepeatedNestedMessage.Count); + Assert.AreEqual(0, message.RepeatedPublicImportMessage.Count); + Assert.AreEqual(0, message.RepeatedSfixed32.Count); + Assert.AreEqual(0, message.RepeatedSfixed64.Count); + Assert.AreEqual(0, message.RepeatedSint32.Count); + Assert.AreEqual(0, message.RepeatedSint64.Count); + Assert.AreEqual(0, message.RepeatedString.Count); + Assert.AreEqual(0, message.RepeatedUint32.Count); + Assert.AreEqual(0, message.RepeatedUint64.Count); + + // Oneof fields + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + } + + [Test] + public void NullStringAndBytesRejected() + { + var message = new TestAllTypes(); + Assert.Throws(() => message.SingleString = null); + Assert.Throws(() => message.OneofString = null); + Assert.Throws(() => message.SingleBytes = null); + Assert.Throws(() => message.OneofBytes = null); + } + + [Test] + public void RoundTrip_Empty() + { + var message = new TestAllTypes(); + // Without setting any values, there's nothing to write. + byte[] bytes = message.ToByteArray(); + Assert.AreEqual(0, bytes.Length); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void RoundTrip_SingleValues() + { + var message = new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleForeignEnum = ForeignEnum.ForeignBar, + SingleForeignMessage = new ForeignMessage { C = 10 }, + SingleImportEnum = ImportEnum.ImportBaz, + SingleImportMessage = new ImportMessage { D = 20 }, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 }, + SinglePublicImportMessage = new PublicImportMessage { E = 54 }, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = uint.MaxValue, + SingleUint64 = ulong.MaxValue + }; + + byte[] bytes = message.ToByteArray(); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void RoundTrip_RepeatedValues() + { + var message = new TestAllTypes + { + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { uint.MaxValue, 23 }, + RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar }, + RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } }, + RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified }, + RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, long.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } }, + RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { uint.MaxValue, uint.MinValue }, + RepeatedUint64 = { ulong.MaxValue, uint.MinValue } + }; + + byte[] bytes = message.ToByteArray(); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + // Note that not every map within map_unittest_proto3 is used. They all go through very + // similar code paths. The fact that all maps are present is validation that we have codecs + // for every type. + [Test] + public void RoundTrip_Maps() + { + var message = new TestMap + { + MapBoolBool = { + { false, true }, + { true, false } + }, + MapInt32Bytes = { + { 5, ByteString.CopyFrom(6, 7, 8) }, + { 25, ByteString.CopyFrom(1, 2, 3, 4, 5) }, + { 10, ByteString.Empty } + }, + MapInt32ForeignMessage = { + { 0, new ForeignMessage { C = 10 } }, + { 5, new ForeignMessage() }, + }, + MapInt32Enum = { + { 1, MapEnum.Bar }, + { 2000, MapEnum.Foo } + } + }; + + byte[] bytes = message.ToByteArray(); + TestMap parsed = TestMap.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void MapWithEmptyEntry() + { + var message = new TestMap + { + MapInt32Bytes = { { 0, ByteString.Empty } } + }; + + byte[] bytes = message.ToByteArray(); + Assert.AreEqual(2, bytes.Length); // Tag for field entry (1 byte), length of entry (0; 1 byte) + + var parsed = TestMap.Parser.ParseFrom(bytes); + Assert.AreEqual(1, parsed.MapInt32Bytes.Count); + Assert.AreEqual(ByteString.Empty, parsed.MapInt32Bytes[0]); + } + + [Test] + public void MapWithOnlyValue() + { + // Hand-craft the stream to contain a single entry with just a value. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); + var nestedMessage = new ForeignMessage { C = 20 }; + // Size of the entry (tag, size written by WriteMessage, data written by WriteMessage) + output.WriteLength(2 + nestedMessage.CalculateSize()); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteMessage(nestedMessage); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(nestedMessage, parsed.MapInt32ForeignMessage[0]); + } + + [Test] + public void MapWithOnlyKey_PrimitiveValue() + { + // Hand-craft the stream to contain a single entry with just a key. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32DoubleFieldNumber, WireFormat.WireType.LengthDelimited); + int key = 10; + output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(0.0, parsed.MapInt32Double[key]); + } + + [Test] + public void MapWithOnlyKey_MessageValue() + { + // Hand-craft the stream to contain a single entry with just a key. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); + int key = 10; + output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(new ForeignMessage(), parsed.MapInt32ForeignMessage[key]); + } + + [Test] + public void MapIgnoresExtraFieldsWithinEntryMessages() + { + // Hand-craft the stream to contain a single entry with three fields + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + + var key = 10; // Field 1 + var value = 20; // Field 2 + var extra = 30; // Field 3 + + // Each field can be represented in a single byte, with a single byte tag. + // Total message size: 6 bytes. + output.WriteLength(6); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value); + output.WriteTag(3, WireFormat.WireType.Varint); + output.WriteInt32(extra); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value, parsed.MapInt32Int32[key]); + } + + [Test] + public void MapFieldOrderIsIrrelevant() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + + var key = 10; + var value = 20; + + // Each field can be represented in a single byte, with a single byte tag. + // Total message size: 4 bytes. + output.WriteLength(4); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value, parsed.MapInt32Int32[key]); + } + + [Test] + public void MapNonContiguousEntries() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + // Message structure: + // Entry for MapInt32Int32 + // Entry for MapStringString + // Entry for MapInt32Int32 + + // First entry + var key1 = 10; + var value1 = 20; + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key1); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value1); + + // Second entry + var key2 = "a"; + var value2 = "b"; + output.WriteTag(TestMap.MapStringStringFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(6); // 3 bytes per entry: tag, size, character + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString(key2); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteString(value2); + + // Third entry + var key3 = 15; + var value3 = 25; + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key3); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value3); + + output.Flush(); + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + var expected = new TestMap + { + MapInt32Int32 = { { key1, value1 }, { key3, value3 } }, + MapStringString = { { key2, value2 } } + }; + Assert.AreEqual(expected, parsed); + } + + [Test] + public void DuplicateKeys_LastEntryWins() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + var key = 10; + var value1 = 20; + var value2 = 30; + + // First entry + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value1); + + // Second entry - same key, different value + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value2); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value2, parsed.MapInt32Int32[key]); + } + + [Test] + public void CloneSingleNonMessageValues() + { + var original = new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = uint.MaxValue, + SingleUint64 = ulong.MaxValue + }; + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + // Just as a single example + clone.SingleInt32 = 150; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneRepeatedNonMessageValues() + { + var original = new TestAllTypes + { + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { uint.MaxValue, 23 }, + RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, long.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { uint.MaxValue, uint.MinValue }, + RepeatedUint64 = { ulong.MaxValue, uint.MinValue } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + // Just as a single example + clone.RepeatedDouble.Add(25.5); + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneSingleMessageField() + { + var original = new TestAllTypes + { + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreNotSame(original.SingleNestedMessage, clone.SingleNestedMessage); + Assert.AreEqual(original, clone); + + clone.SingleNestedMessage.Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneRepeatedMessageField() + { + var original = new TestAllTypes + { + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 20 } } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreNotSame(original.RepeatedNestedMessage, clone.RepeatedNestedMessage); + Assert.AreNotSame(original.RepeatedNestedMessage[0], clone.RepeatedNestedMessage[0]); + Assert.AreEqual(original, clone); + + clone.RepeatedNestedMessage[0].Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneOneofField() + { + var original = new TestAllTypes + { + OneofNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + + // We should have cloned the message + original.OneofNestedMessage.Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void OneofProperties() + { + // Switch the oneof case between each of the different options, and check everything behaves + // as expected in each case. + var message = new TestAllTypes(); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + + message.OneofString = "sample"; + Assert.AreEqual("sample", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); + + var bytes = ByteString.CopyFrom(1, 2, 3); + message.OneofBytes = bytes; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(bytes, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase); + + message.OneofUint32 = 20; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(20, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase); + + var nestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 25 }; + message.OneofNestedMessage = nestedMessage; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.AreEqual(nestedMessage, message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase); + + message.ClearOneofField(); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + } + + [Test] + public void Oneof_DefaultValuesNotEqual() + { + var message1 = new TestAllTypes { OneofString = "" }; + var message2 = new TestAllTypes { OneofUint32 = 0 }; + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message1.OneofFieldCase); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + Assert.AreNotEqual(message1, message2); + } + + [Test] + public void OneofSerialization_NonDefaultValue() + { + var message = new TestAllTypes(); + message.OneofString = "this would take a bit of space"; + message.OneofUint32 = 10; + var bytes = message.ToByteArray(); + Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - no string! + + var message2 = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, message2); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + } + + [Test] + public void OneofSerialization_DefaultValue() + { + var message = new TestAllTypes(); + message.OneofString = "this would take a bit of space"; + message.OneofUint32 = 0; // This is the default value for UInt32; normally wouldn't be serialized + var bytes = message.ToByteArray(); + Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - it's still serialized + + var message2 = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, message2); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + } + + [Test] + public void IgnoreUnknownFields_RealDataStillRead() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var unusedFieldNumber = 23456; + Assert.IsFalse(TestAllTypes.Descriptor.Fields.InDeclarationOrder().Select(x => x.FieldNumber).Contains(unusedFieldNumber)); + output.WriteTag(unusedFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteString("ignore me"); + message.WriteTo(output); + output.Flush(); + + stream.Position = 0; + var parsed = TestAllTypes.Parser.ParseFrom(stream); + Assert.AreEqual(message, parsed); + } + + [Test] + public void IgnoreUnknownFields_AllTypes() + { + // Simple way of ensuring we can skip all kinds of fields. + var data = SampleMessages.CreateFullTestAllTypes().ToByteArray(); + var empty = Empty.Parser.ParseFrom(data); + Assert.AreEqual(new Empty(), empty); + } + + // This was originally seen as a conformance test failure. + [Test] + public void TruncatedMessageFieldThrows() + { + // 130, 3 is the message tag + // 1 is the data length - but there's no data. + var data = new byte[] { 130, 3, 1 }; + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(data)); + } + + /// + /// Demonstrates current behaviour with an extraneous end group tag - see issue 688 + /// for details; we may want to change this. + /// + [Test] + public void ExtraEndGroupThrows() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + + output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32); + output.WriteFixed32(123); + output.WriteTag(100, WireFormat.WireType.EndGroup); + + output.Flush(); + + stream.Position = 0; + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(stream)); + } + + [Test] + public void CustomDiagnosticMessage_DirectToStringCall() + { + var message = new ForeignMessage { C = 31 }; + Assert.AreEqual("{ \"c\": 31, \"@cInHex\": \"1f\" }", message.ToString()); + Assert.AreEqual("{ \"c\": 31 }", JsonFormatter.Default.Format(message)); + } + + [Test] + public void CustomDiagnosticMessage_Nested() + { + var message = new TestAllTypes { SingleForeignMessage = new ForeignMessage { C = 16 } }; + Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16, \"@cInHex\": \"10\" } }", message.ToString()); + Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16 } }", JsonFormatter.Default.Format(message)); + } + + [Test] + public void CustomDiagnosticMessage_DirectToTextWriterCall() + { + var message = new ForeignMessage { C = 31 }; + var writer = new StringWriter(); + JsonFormatter.Default.Format(message, writer); + Assert.AreEqual("{ \"c\": 31 }", writer.ToString()); + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj new file mode 100644 index 0000000000..06d07b9f4a --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -0,0 +1,30 @@ + + + + Exe + net451;netcoreapp1.0 + ../../keys/Google.Protobuf.snk + true + true + False + + + + + + + + + + + + + + netcoreapp1.0 + + + diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs new file mode 100644 index 0000000000..a38d6b08b5 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/IssuesTest.cs @@ -0,0 +1,82 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; +using UnitTest.Issues.TestProtos; +using NUnit.Framework; + + +namespace Google.Protobuf +{ + /// + /// Tests for issues which aren't easily compartmentalized into other unit tests. + /// + public class IssuesTest + { + // Issue 45 + [Test] + public void FieldCalledItem() + { + ItemField message = new ItemField { Item = 3 }; + FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); + Assert.NotNull(field); + Assert.AreEqual(3, (int)field.Accessor.GetValue(message)); + } + + [Test] + public void ReservedNames() + { + var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 }; + // Underscores aren't reflected in the JSON. + Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString()); + } + + [Test] + public void JsonNameParseTest() + { + var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor)); + var parser = new JsonParser(settings); + + // It is safe to use either original field name or explicitly specified json_name + Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }, + parser.Parse("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }")); + } + + [Test] + public void JsonNameFormatTest() + { + var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }; + Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }", + JsonFormatter.Default.Format(message)); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs new file mode 100644 index 0000000000..f595455aa1 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonParserTest.cs @@ -0,0 +1,939 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; +using System; + +namespace Google.Protobuf +{ + /// + /// Unit tests for JSON parsing. + /// + public class JsonParserTest + { + // Sanity smoke test + [Test] + public void AllTypesRoundtrip() + { + AssertRoundtrip(SampleMessages.CreateFullTestAllTypes()); + } + + [Test] + public void Maps() + { + AssertRoundtrip(new TestMap { MapStringString = { { "with spaces", "bar" }, { "a", "b" } } }); + AssertRoundtrip(new TestMap { MapInt32Int32 = { { 0, 1 }, { 2, 3 } } }); + AssertRoundtrip(new TestMap { MapBoolBool = { { false, true }, { true, false } } }); + } + + [Test] + [TestCase(" 1 ")] + [TestCase("+1")] + [TestCase("1,000")] + [TestCase("1.5")] + public void IntegerMapKeysAreStrict(string keyText) + { + // Test that integer parsing is strict. We assume that if this is correct for int32, + // it's correct for other numeric key types. + var json = "{ \"mapInt32Int32\": { \"" + keyText + "\" : \"1\" } }"; + Assert.Throws(() => JsonParser.Default.Parse(json)); + } + + [Test] + public void OriginalFieldNameAccepted() + { + var json = "{ \"single_int32\": 10 }"; + var expected = new TestAllTypes { SingleInt32 = 10 }; + Assert.AreEqual(expected, TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + public void SourceContextRoundtrip() + { + AssertRoundtrip(new SourceContext { FileName = "foo.proto" }); + } + + [Test] + public void SingularWrappers_DefaultNonNullValues() + { + var message = new TestWellKnownTypes + { + StringField = "", + BytesField = ByteString.Empty, + BoolField = false, + FloatField = 0f, + DoubleField = 0d, + Int32Field = 0, + Int64Field = 0, + Uint32Field = 0, + Uint64Field = 0 + }; + AssertRoundtrip(message); + } + + [Test] + public void SingularWrappers_NonDefaultValues() + { + var message = new TestWellKnownTypes + { + StringField = "x", + BytesField = ByteString.CopyFrom(1, 2, 3), + BoolField = true, + FloatField = 12.5f, + DoubleField = 12.25d, + Int32Field = 1, + Int64Field = 2, + Uint32Field = 3, + Uint64Field = 4 + }; + AssertRoundtrip(message); + } + + [Test] + public void SingularWrappers_ExplicitNulls() + { + // When we parse the "valueField": null part, we remember it... basically, it's one case + // where explicit default values don't fully roundtrip. + var message = new TestWellKnownTypes { ValueField = Value.ForNull() }; + var json = new JsonFormatter(new JsonFormatter.Settings(true)).Format(message); + var parsed = JsonParser.Default.Parse(json); + Assert.AreEqual(message, parsed); + } + + [Test] + [TestCase(typeof(BoolValue), "true", true)] + [TestCase(typeof(Int32Value), "32", 32)] + [TestCase(typeof(Int64Value), "32", 32L)] + [TestCase(typeof(Int64Value), "\"32\"", 32L)] + [TestCase(typeof(UInt32Value), "32", 32U)] + [TestCase(typeof(UInt64Value), "\"32\"", 32UL)] + [TestCase(typeof(UInt64Value), "32", 32UL)] + [TestCase(typeof(StringValue), "\"foo\"", "foo")] + [TestCase(typeof(FloatValue), "1.5", 1.5f)] + [TestCase(typeof(DoubleValue), "1.5", 1.5d)] + public void Wrappers_Standalone(System.Type wrapperType, string json, object expectedValue) + { + IMessage parsed = (IMessage)Activator.CreateInstance(wrapperType); + IMessage expected = (IMessage)Activator.CreateInstance(wrapperType); + JsonParser.Default.Merge(parsed, "null"); + Assert.AreEqual(expected, parsed); + + JsonParser.Default.Merge(parsed, json); + expected.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber].Accessor.SetValue(expected, expectedValue); + Assert.AreEqual(expected, parsed); + } + + [Test] + public void ExplicitNullValue() + { + string json = "{\"valueField\": null}"; + var message = JsonParser.Default.Parse(json); + Assert.AreEqual(new TestWellKnownTypes { ValueField = Value.ForNull() }, message); + } + + [Test] + public void BytesWrapper_Standalone() + { + ByteString data = ByteString.CopyFrom(1, 2, 3); + // Can't do this with attributes... + var parsed = JsonParser.Default.Parse(WrapInQuotes(data.ToBase64())); + var expected = new BytesValue { Value = data }; + Assert.AreEqual(expected, parsed); + } + + [Test] + public void RepeatedWrappers() + { + var message = new RepeatedWellKnownTypes + { + BoolField = { true, false }, + BytesField = { ByteString.CopyFrom(1, 2, 3), ByteString.CopyFrom(4, 5, 6), ByteString.Empty }, + DoubleField = { 12.5, -1.5, 0d }, + FloatField = { 123.25f, -20f, 0f }, + Int32Field = { int.MaxValue, int.MinValue, 0 }, + Int64Field = { long.MaxValue, long.MinValue, 0L }, + StringField = { "First", "Second", "" }, + Uint32Field = { uint.MaxValue, uint.MinValue, 0U }, + Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL }, + }; + AssertRoundtrip(message); + } + + [Test] + public void RepeatedField_NullElementProhibited() + { + string json = "{ \"repeated_foreign_message\": [null] }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + public void RepeatedField_NullOverallValueAllowed() + { + string json = "{ \"repeated_foreign_message\": null }"; + Assert.AreEqual(new TestAllTypes(), TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("{ \"mapInt32Int32\": { \"10\": null }")] + [TestCase("{ \"mapStringString\": { \"abc\": null }")] + [TestCase("{ \"mapInt32ForeignMessage\": { \"10\": null }")] + public void MapField_NullValueProhibited(string json) + { + Assert.Throws(() => TestMap.Parser.ParseJson(json)); + } + + [Test] + public void MapField_NullOverallValueAllowed() + { + string json = "{ \"mapInt32Int32\": null }"; + Assert.AreEqual(new TestMap(), TestMap.Parser.ParseJson(json)); + } + + [Test] + public void IndividualWrapperTypes() + { + Assert.AreEqual(new StringValue { Value = "foo" }, StringValue.Parser.ParseJson("\"foo\"")); + Assert.AreEqual(new Int32Value { Value = 1 }, Int32Value.Parser.ParseJson("1")); + // Can parse strings directly too + Assert.AreEqual(new Int32Value { Value = 1 }, Int32Value.Parser.ParseJson("\"1\"")); + } + + private static void AssertRoundtrip(T message) where T : IMessage, new() + { + var clone = message.Clone(); + var json = JsonFormatter.Default.Format(message); + var parsed = JsonParser.Default.Parse(json); + Assert.AreEqual(clone, parsed); + } + + [Test] + [TestCase("0", 0)] + [TestCase("-0", 0)] // Not entirely clear whether we intend to allow this... + [TestCase("1", 1)] + [TestCase("-1", -1)] + [TestCase("2147483647", 2147483647)] + [TestCase("-2147483648", -2147483648)] + public void StringToInt32_Valid(string jsonValue, int expectedParsedValue) + { + string json = "{ \"singleInt32\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt32); + } + + [Test] + [TestCase("+0")] + [TestCase(" 1")] + [TestCase("1 ")] + [TestCase("00")] + [TestCase("-00")] + [TestCase("--1")] + [TestCase("+1")] + [TestCase("1.5")] + [TestCase("1e10")] + [TestCase("2147483648")] + [TestCase("-2147483649")] + public void StringToInt32_Invalid(string jsonValue) + { + string json = "{ \"singleInt32\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0U)] + [TestCase("1", 1U)] + [TestCase("4294967295", 4294967295U)] + public void StringToUInt32_Valid(string jsonValue, uint expectedParsedValue) + { + string json = "{ \"singleUint32\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint32); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("4294967296")] + public void StringToUInt32_Invalid(string jsonValue) + { + string json = "{ \"singleUint32\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0L)] + [TestCase("1", 1L)] + [TestCase("-1", -1L)] + [TestCase("9223372036854775807", 9223372036854775807)] + [TestCase("-9223372036854775808", -9223372036854775808)] + public void StringToInt64_Valid(string jsonValue, long expectedParsedValue) + { + string json = "{ \"singleInt64\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-9223372036854775809")] + [TestCase("9223372036854775808")] + public void StringToInt64_Invalid(string jsonValue) + { + string json = "{ \"singleInt64\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0UL)] + [TestCase("1", 1UL)] + [TestCase("18446744073709551615", 18446744073709551615)] + public void StringToUInt64_Valid(string jsonValue, ulong expectedParsedValue) + { + string json = "{ \"singleUint64\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("18446744073709551616")] + public void StringToUInt64_Invalid(string jsonValue) + { + string json = "{ \"singleUint64\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0d)] + [TestCase("1", 1d)] + [TestCase("1.000000", 1d)] + [TestCase("1.0000000000000000000000001", 1d)] // We don't notice that we haven't preserved the exact value + [TestCase("-1", -1d)] + [TestCase("1e1", 10d)] + [TestCase("1e01", 10d)] // Leading decimals are allowed in exponents + [TestCase("1E1", 10d)] // Either case is fine + [TestCase("-1e1", -10d)] + [TestCase("1.5e1", 15d)] + [TestCase("-1.5e1", -15d)] + [TestCase("15e-1", 1.5d)] + [TestCase("-15e-1", -1.5d)] + [TestCase("1.79769e308", 1.79769e308)] + [TestCase("-1.79769e308", -1.79769e308)] + [TestCase("Infinity", double.PositiveInfinity)] + [TestCase("-Infinity", double.NegativeInfinity)] + [TestCase("NaN", double.NaN)] + public void StringToDouble_Valid(string jsonValue, double expectedParsedValue) + { + string json = "{ \"singleDouble\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleDouble); + } + + [Test] + [TestCase("1.7977e308")] + [TestCase("-1.7977e308")] + [TestCase("1e309")] + [TestCase("1,0")] + [TestCase("1.0.0")] + [TestCase("+1")] + [TestCase("00")] + [TestCase("01")] + [TestCase("-00")] + [TestCase("-01")] + [TestCase("--1")] + [TestCase(" Infinity")] + [TestCase(" -Infinity")] + [TestCase("NaN ")] + [TestCase("Infinity ")] + [TestCase("-Infinity ")] + [TestCase(" NaN")] + [TestCase("INFINITY")] + [TestCase("nan")] + [TestCase("\u00BD")] // 1/2 as a single Unicode character. Just sanity checking... + public void StringToDouble_Invalid(string jsonValue) + { + string json = "{ \"singleDouble\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0f)] + [TestCase("1", 1f)] + [TestCase("1.000000", 1f)] + [TestCase("-1", -1f)] + [TestCase("3.402823e38", 3.402823e38f)] + [TestCase("-3.402823e38", -3.402823e38f)] + [TestCase("1.5e1", 15f)] + [TestCase("15e-1", 1.5f)] + public void StringToFloat_Valid(string jsonValue, float expectedParsedValue) + { + string json = "{ \"singleFloat\": \"" + jsonValue + "\"}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleFloat); + } + + [Test] + [TestCase("3.402824e38")] + [TestCase("-3.402824e38")] + [TestCase("1,0")] + [TestCase("1.0.0")] + [TestCase("+1")] + [TestCase("00")] + [TestCase("--1")] + public void StringToFloat_Invalid(string jsonValue) + { + string json = "{ \"singleFloat\": \"" + jsonValue + "\"}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0)] + [TestCase("-0", 0)] // Not entirely clear whether we intend to allow this... + [TestCase("1", 1)] + [TestCase("-1", -1)] + [TestCase("2147483647", 2147483647)] + [TestCase("-2147483648", -2147483648)] + [TestCase("1e1", 10)] + [TestCase("-1e1", -10)] + [TestCase("10.00", 10)] + [TestCase("-10.00", -10)] + public void NumberToInt32_Valid(string jsonValue, int expectedParsedValue) + { + string json = "{ \"singleInt32\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt32); + } + + [Test] + [TestCase("+0", typeof(InvalidJsonException))] + [TestCase("00", typeof(InvalidJsonException))] + [TestCase("-00", typeof(InvalidJsonException))] + [TestCase("--1", typeof(InvalidJsonException))] + [TestCase("+1", typeof(InvalidJsonException))] + [TestCase("1.5", typeof(InvalidProtocolBufferException))] + // Value is out of range + [TestCase("1e10", typeof(InvalidProtocolBufferException))] + [TestCase("2147483648", typeof(InvalidProtocolBufferException))] + [TestCase("-2147483649", typeof(InvalidProtocolBufferException))] + public void NumberToInt32_Invalid(string jsonValue, System.Type expectedExceptionType) + { + string json = "{ \"singleInt32\": " + jsonValue + "}"; + Assert.Throws(expectedExceptionType, () => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0U)] + [TestCase("1", 1U)] + [TestCase("4294967295", 4294967295U)] + public void NumberToUInt32_Valid(string jsonValue, uint expectedParsedValue) + { + string json = "{ \"singleUint32\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint32); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("4294967296")] + public void NumberToUInt32_Invalid(string jsonValue) + { + string json = "{ \"singleUint32\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0L)] + [TestCase("1", 1L)] + [TestCase("-1", -1L)] + // long.MaxValue isn't actually representable as a double. This string value is the highest + // representable value which isn't greater than long.MaxValue. + [TestCase("9223372036854774784", 9223372036854774784)] + [TestCase("-9223372036854775808", -9223372036854775808)] + public void NumberToInt64_Valid(string jsonValue, long expectedParsedValue) + { + string json = "{ \"singleInt64\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleInt64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("9223372036854775808")] + // Theoretical bound would be -9223372036854775809, but when that is parsed to a double + // we end up with the exact value of long.MinValue due to lack of precision. The value here + // is the "next double down". + [TestCase("-9223372036854780000")] + public void NumberToInt64_Invalid(string jsonValue) + { + string json = "{ \"singleInt64\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0UL)] + [TestCase("1", 1UL)] + // ulong.MaxValue isn't representable as a double. This value is the largest double within + // the range of ulong. + [TestCase("18446744073709549568", 18446744073709549568UL)] + public void NumberToUInt64_Valid(string jsonValue, ulong expectedParsedValue) + { + string json = "{ \"singleUint64\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleUint64); + } + + // Assume that anything non-bounds-related is covered in the Int32 case + [Test] + [TestCase("-1")] + [TestCase("18446744073709551616")] + public void NumberToUInt64_Invalid(string jsonValue) + { + string json = "{ \"singleUint64\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0d)] + [TestCase("1", 1d)] + [TestCase("1.000000", 1d)] + [TestCase("1.0000000000000000000000001", 1d)] // We don't notice that we haven't preserved the exact value + [TestCase("-1", -1d)] + [TestCase("1e1", 10d)] + [TestCase("1e01", 10d)] // Leading decimals are allowed in exponents + [TestCase("1E1", 10d)] // Either case is fine + [TestCase("-1e1", -10d)] + [TestCase("1.5e1", 15d)] + [TestCase("-1.5e1", -15d)] + [TestCase("15e-1", 1.5d)] + [TestCase("-15e-1", -1.5d)] + [TestCase("1.79769e308", 1.79769e308)] + [TestCase("-1.79769e308", -1.79769e308)] + public void NumberToDouble_Valid(string jsonValue, double expectedParsedValue) + { + string json = "{ \"singleDouble\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleDouble); + } + + [Test] + [TestCase("1.7977e308")] + [TestCase("-1.7977e308")] + [TestCase("1e309")] + [TestCase("1,0")] + [TestCase("1.0.0")] + [TestCase("+1")] + [TestCase("00")] + [TestCase("--1")] + [TestCase("\u00BD")] // 1/2 as a single Unicode character. Just sanity checking... + public void NumberToDouble_Invalid(string jsonValue) + { + string json = "{ \"singleDouble\": " + jsonValue + "}"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("0", 0f)] + [TestCase("1", 1f)] + [TestCase("1.000000", 1f)] + [TestCase("-1", -1f)] + [TestCase("3.402823e38", 3.402823e38f)] + [TestCase("-3.402823e38", -3.402823e38f)] + [TestCase("1.5e1", 15f)] + [TestCase("15e-1", 1.5f)] + public void NumberToFloat_Valid(string jsonValue, float expectedParsedValue) + { + string json = "{ \"singleFloat\": " + jsonValue + "}"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(expectedParsedValue, parsed.SingleFloat); + } + + [Test] + [TestCase("3.402824e38", typeof(InvalidProtocolBufferException))] + [TestCase("-3.402824e38", typeof(InvalidProtocolBufferException))] + [TestCase("1,0", typeof(InvalidJsonException))] + [TestCase("1.0.0", typeof(InvalidJsonException))] + [TestCase("+1", typeof(InvalidJsonException))] + [TestCase("00", typeof(InvalidJsonException))] + [TestCase("--1", typeof(InvalidJsonException))] + public void NumberToFloat_Invalid(string jsonValue, System.Type expectedExceptionType) + { + string json = "{ \"singleFloat\": " + jsonValue + "}"; + Assert.Throws(expectedExceptionType, () => TestAllTypes.Parser.ParseJson(json)); + } + + // The simplest way of testing that the value has parsed correctly is to reformat it, + // as we trust the formatting. In many cases that will give the same result as the input, + // so in those cases we accept an expectedFormatted value of null. Sometimes the results + // will be different though, due to a different number of digits being provided. + [Test] + // Z offset + [TestCase("2015-10-09T14:46:23.123456789Z", null)] + [TestCase("2015-10-09T14:46:23.123456Z", null)] + [TestCase("2015-10-09T14:46:23.123Z", null)] + [TestCase("2015-10-09T14:46:23Z", null)] + [TestCase("2015-10-09T14:46:23.123456000Z", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.1234560Z", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.123000000Z", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.1230Z", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.00Z", "2015-10-09T14:46:23Z")] + + // +00:00 offset + [TestCase("2015-10-09T14:46:23.123456789+00:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T14:46:23.123456+00:00", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.123+00:00", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23+00:00", "2015-10-09T14:46:23Z")] + [TestCase("2015-10-09T14:46:23.123456000+00:00", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.1234560+00:00", "2015-10-09T14:46:23.123456Z")] + [TestCase("2015-10-09T14:46:23.123000000+00:00", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.1230+00:00", "2015-10-09T14:46:23.123Z")] + [TestCase("2015-10-09T14:46:23.00+00:00", "2015-10-09T14:46:23Z")] + + // Other offsets (assume by now that the subsecond handling is okay) + [TestCase("2015-10-09T15:46:23.123456789+01:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T13:46:23.123456789-01:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T15:16:23.123456789+00:30", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T14:16:23.123456789-00:30", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T16:31:23.123456789+01:45", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-09T13:01:23.123456789-01:45", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-10T08:46:23.123456789+18:00", "2015-10-09T14:46:23.123456789Z")] + [TestCase("2015-10-08T20:46:23.123456789-18:00", "2015-10-09T14:46:23.123456789Z")] + + // Leap years and min/max + [TestCase("2016-02-29T14:46:23.123456789Z", null)] + [TestCase("2000-02-29T14:46:23.123456789Z", null)] + [TestCase("0001-01-01T00:00:00Z", null)] + [TestCase("9999-12-31T23:59:59.999999999Z", null)] + public void Timestamp_Valid(string jsonValue, string expectedFormatted) + { + expectedFormatted = expectedFormatted ?? jsonValue; + string json = WrapInQuotes(jsonValue); + var parsed = Timestamp.Parser.ParseJson(json); + Assert.AreEqual(WrapInQuotes(expectedFormatted), parsed.ToString()); + } + + [Test] + [TestCase("2015-10-09 14:46:23.123456789Z", Description = "No T between date and time")] + [TestCase("2015/10/09T14:46:23.123456789Z", Description = "Wrong date separators")] + [TestCase("2015-10-09T14.46.23.123456789Z", Description = "Wrong time separators")] + [TestCase("2015-10-09T14:46:23,123456789Z", Description = "Wrong fractional second separators (valid ISO-8601 though)")] + [TestCase(" 2015-10-09T14:46:23.123456789Z", Description = "Whitespace at start")] + [TestCase("2015-10-09T14:46:23.123456789Z ", Description = "Whitespace at end")] + [TestCase("2015-10-09T14:46:23.1234567890", Description = "Too many digits")] + [TestCase("2015-10-09T14:46:23.123456789", Description = "No offset")] + [TestCase("2015-13-09T14:46:23.123456789Z", Description = "Invalid month")] + [TestCase("2015-10-32T14:46:23.123456789Z", Description = "Invalid day")] + [TestCase("2015-10-09T24:00:00.000000000Z", Description = "Invalid hour (valid ISO-8601 though)")] + [TestCase("2015-10-09T14:60:23.123456789Z", Description = "Invalid minutes")] + [TestCase("2015-10-09T14:46:60.123456789Z", Description = "Invalid seconds")] + [TestCase("2015-10-09T14:46:23.123456789+18:01", Description = "Offset too large (positive)")] + [TestCase("2015-10-09T14:46:23.123456789-18:01", Description = "Offset too large (negative)")] + [TestCase("2015-10-09T14:46:23.123456789-00:00", Description = "Local offset (-00:00) makes no sense here")] + [TestCase("0001-01-01T00:00:00+00:01", Description = "Value before earliest when offset applied")] + [TestCase("9999-12-31T23:59:59.999999999-00:01", Description = "Value after latest when offset applied")] + [TestCase("2100-02-29T14:46:23.123456789Z", Description = "Feb 29th on a non-leap-year")] + public void Timestamp_Invalid(string jsonValue) + { + string json = WrapInQuotes(jsonValue); + Assert.Throws(() => Timestamp.Parser.ParseJson(json)); + } + + [Test] + public void StructValue_Null() + { + Assert.AreEqual(new Value { NullValue = 0 }, Value.Parser.ParseJson("null")); + } + + [Test] + public void StructValue_String() + { + Assert.AreEqual(new Value { StringValue = "hi" }, Value.Parser.ParseJson("\"hi\"")); + } + + [Test] + public void StructValue_Bool() + { + Assert.AreEqual(new Value { BoolValue = true }, Value.Parser.ParseJson("true")); + Assert.AreEqual(new Value { BoolValue = false }, Value.Parser.ParseJson("false")); + } + + [Test] + public void StructValue_List() + { + Assert.AreEqual(Value.ForList(Value.ForNumber(1), Value.ForString("x")), Value.Parser.ParseJson("[1, \"x\"]")); + } + + [Test] + public void ParseListValue() + { + Assert.AreEqual(new ListValue { Values = { Value.ForNumber(1), Value.ForString("x") } }, ListValue.Parser.ParseJson("[1, \"x\"]")); + } + + [Test] + public void StructValue_Struct() + { + Assert.AreEqual( + Value.ForStruct(new Struct { Fields = { { "x", Value.ForNumber(1) }, { "y", Value.ForString("z") } } }), + Value.Parser.ParseJson("{ \"x\": 1, \"y\": \"z\" }")); + } + + [Test] + public void ParseStruct() + { + Assert.AreEqual(new Struct { Fields = { { "x", Value.ForNumber(1) }, { "y", Value.ForString("z") } } }, + Struct.Parser.ParseJson("{ \"x\": 1, \"y\": \"z\" }")); + } + + // TODO for duration parsing: upper and lower bounds. + // +/- 315576000000 seconds + + [Test] + [TestCase("1.123456789s", null)] + [TestCase("1.123456s", null)] + [TestCase("1.123s", null)] + [TestCase("1.12300s", "1.123s")] + [TestCase("1.12345s", "1.123450s")] + [TestCase("1s", null)] + [TestCase("-1.123456789s", null)] + [TestCase("-1.123456s", null)] + [TestCase("-1.123s", null)] + [TestCase("-1s", null)] + [TestCase("0.123s", null)] + [TestCase("-0.123s", null)] + [TestCase("123456.123s", null)] + [TestCase("-123456.123s", null)] + // Upper and lower bounds + [TestCase("315576000000s", null)] + [TestCase("-315576000000s", null)] + public void Duration_Valid(string jsonValue, string expectedFormatted) + { + expectedFormatted = expectedFormatted ?? jsonValue; + string json = WrapInQuotes(jsonValue); + var parsed = Duration.Parser.ParseJson(json); + Assert.AreEqual(WrapInQuotes(expectedFormatted), parsed.ToString()); + } + + // The simplest way of testing that the value has parsed correctly is to reformat it, + // as we trust the formatting. In many cases that will give the same result as the input, + // so in those cases we accept an expectedFormatted value of null. Sometimes the results + // will be different though, due to a different number of digits being provided. + [Test] + [TestCase("1.1234567890s", Description = "Too many digits")] + [TestCase("1.123456789", Description = "No suffix")] + [TestCase("1.123456789ss", Description = "Too much suffix")] + [TestCase("1.123456789S", Description = "Upper case suffix")] + [TestCase("+1.123456789s", Description = "Leading +")] + [TestCase(".123456789s", Description = "No integer before the fraction")] + [TestCase("1,123456789s", Description = "Comma as decimal separator")] + [TestCase("1x1.123456789s", Description = "Non-digit in integer part")] + [TestCase("1.1x3456789s", Description = "Non-digit in fractional part")] + [TestCase(" 1.123456789s", Description = "Whitespace before fraction")] + [TestCase("1.123456789s ", Description = "Whitespace after value")] + [TestCase("01.123456789s", Description = "Leading zero (positive)")] + [TestCase("-01.123456789s", Description = "Leading zero (negative)")] + [TestCase("--0.123456789s", Description = "Double minus sign")] + // Violate upper/lower bounds in various ways + [TestCase("315576000001s", Description = "Integer part too large")] + [TestCase("3155760000000s", Description = "Integer part too long (positive)")] + [TestCase("-3155760000000s", Description = "Integer part too long (negative)")] + public void Duration_Invalid(string jsonValue) + { + string json = WrapInQuotes(jsonValue); + Assert.Throws(() => Duration.Parser.ParseJson(json)); + } + + // Not as many tests for field masks as I'd like; more to be added when we have more + // detailed specifications. + + [Test] + [TestCase("")] + [TestCase("foo", "foo")] + [TestCase("foo,bar", "foo", "bar")] + [TestCase("foo.bar", "foo.bar")] + [TestCase("fooBar", "foo_bar")] + [TestCase("fooBar.bazQux", "foo_bar.baz_qux")] + public void FieldMask_Valid(string jsonValue, params string[] expectedPaths) + { + string json = WrapInQuotes(jsonValue); + var parsed = FieldMask.Parser.ParseJson(json); + CollectionAssert.AreEqual(expectedPaths, parsed.Paths); + } + + [Test] + [TestCase("foo_bar")] + public void FieldMask_Invalid(string jsonValue) + { + string json = WrapInQuotes(jsonValue); + Assert.Throws(() => FieldMask.Parser.ParseJson(json)); + } + + [Test] + public void Any_RegularMessage() + { + var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor))); + var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } }; + var original = Any.Pack(message); + var json = formatter.Format(original); // This is tested in JsonFormatterTest + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + Assert.AreEqual(original, parser.Parse(json)); + string valueFirstJson = "{ \"singleInt32\": 10, \"singleNestedMessage\": { \"bb\": 20 }, \"@type\": \"type.googleapis.com/protobuf_unittest.TestAllTypes\" }"; + Assert.AreEqual(original, parser.Parse(valueFirstJson)); + } + + [Test] + public void Any_CustomPrefix() + { + var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + var message = new TestAllTypes { SingleInt32 = 10 }; + var original = Any.Pack(message, "custom.prefix/middle-part"); + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + string json = "{ \"@type\": \"custom.prefix/middle-part/protobuf_unittest.TestAllTypes\", \"singleInt32\": 10 }"; + Assert.AreEqual(original, parser.Parse(json)); + } + + [Test] + public void Any_UnknownType() + { + string json = "{ \"@type\": \"type.googleapis.com/bogus\" }"; + Assert.Throws(() => Any.Parser.ParseJson(json)); + } + + [Test] + public void Any_NoTypeUrl() + { + string json = "{ \"foo\": \"bar\" }"; + Assert.Throws(() => Any.Parser.ParseJson(json)); + } + + [Test] + public void Any_WellKnownType() + { + var registry = TypeRegistry.FromMessages(Timestamp.Descriptor); + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry)); + var timestamp = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp(); + var original = Any.Pack(timestamp); + var json = formatter.Format(original); // This is tested in JsonFormatterTest + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + Assert.AreEqual(original, parser.Parse(json)); + string valueFirstJson = "{ \"value\": \"1673-06-19T12:34:56Z\", \"@type\": \"type.googleapis.com/google.protobuf.Timestamp\" }"; + Assert.AreEqual(original, parser.Parse(valueFirstJson)); + } + + [Test] + public void Any_Nested() + { + var registry = TypeRegistry.FromMessages(TestWellKnownTypes.Descriptor, TestAllTypes.Descriptor); + var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry)); + var parser = new JsonParser(new JsonParser.Settings(10, registry)); + var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 }; + var nestedMessage = Any.Pack(doubleNestedMessage); + var message = new TestWellKnownTypes { AnyField = Any.Pack(nestedMessage) }; + var json = formatter.Format(message); + // Use the descriptor-based parser just for a change. + Assert.AreEqual(message, parser.Parse(json, TestWellKnownTypes.Descriptor)); + } + + [Test] + public void DataAfterObject() + { + string json = "{} 10"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + /// + /// JSON equivalent to + /// + [Test] + public void MaliciousRecursion() + { + string data64 = CodedInputStreamTest.MakeRecursiveMessage(64).ToString(); + string data65 = CodedInputStreamTest.MakeRecursiveMessage(65).ToString(); + + var parser64 = new JsonParser(new JsonParser.Settings(64)); + CodedInputStreamTest.AssertMessageDepth(parser64.Parse(data64), 64); + Assert.Throws(() => parser64.Parse(data65)); + + var parser63 = new JsonParser(new JsonParser.Settings(63)); + Assert.Throws(() => parser63.Parse(data64)); + } + + [Test] + [TestCase("AQI")] + [TestCase("_-==")] + public void Bytes_InvalidBase64(string badBase64) + { + string json = "{ \"singleBytes\": \"" + badBase64 + "\" }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + [TestCase("\"FOREIGN_BAR\"", ForeignEnum.ForeignBar)] + [TestCase("5", ForeignEnum.ForeignBar)] + [TestCase("100", (ForeignEnum)100)] + public void EnumValid(string value, ForeignEnum expectedValue) + { + string json = "{ \"singleForeignEnum\": " + value + " }"; + var parsed = TestAllTypes.Parser.ParseJson(json); + Assert.AreEqual(new TestAllTypes { SingleForeignEnum = expectedValue }, parsed); + } + + [Test] + [TestCase("\"NOT_A_VALID_VALUE\"")] + [TestCase("5.5")] + public void Enum_Invalid(string value) + { + string json = "{ \"singleForeignEnum\": " + value + " }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + [Test] + public void OneofDuplicate_Invalid() + { + string json = "{ \"oneofString\": \"x\", \"oneofUint32\": 10 }"; + Assert.Throws(() => TestAllTypes.Parser.ParseJson(json)); + } + + /// + /// Various tests use strings which have quotes round them for parsing or as the result + /// of formatting, but without those quotes being specified in the tests (for the sake of readability). + /// This method simply returns the input, wrapped in double quotes. + /// + internal static string WrapInQuotes(string text) + { + return '"' + text + '"'; + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs new file mode 100644 index 0000000000..527ab3361e --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs @@ -0,0 +1,408 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnit.Framework; +using System; +using System.IO; + +namespace Google.Protobuf +{ + public class JsonTokenizerTest + { + [Test] + public void EmptyObjectValue() + { + AssertTokens("{}", JsonToken.StartObject, JsonToken.EndObject); + } + + [Test] + public void EmptyArrayValue() + { + AssertTokens("[]", JsonToken.StartArray, JsonToken.EndArray); + } + + [Test] + [TestCase("foo", "foo")] + [TestCase("tab\\t", "tab\t")] + [TestCase("line\\nfeed", "line\nfeed")] + [TestCase("carriage\\rreturn", "carriage\rreturn")] + [TestCase("back\\bspace", "back\bspace")] + [TestCase("form\\ffeed", "form\ffeed")] + [TestCase("escaped\\/slash", "escaped/slash")] + [TestCase("escaped\\\\backslash", "escaped\\backslash")] + [TestCase("escaped\\\"quote", "escaped\"quote")] + [TestCase("foo {}[] bar", "foo {}[] bar")] + [TestCase("foo\\u09aFbar", "foo\u09afbar")] // Digits, upper hex, lower hex + [TestCase("ab\ud800\udc00cd", "ab\ud800\udc00cd")] + [TestCase("ab\\ud800\\udc00cd", "ab\ud800\udc00cd")] + public void StringValue(string json, string expectedValue) + { + AssertTokensNoReplacement("\"" + json + "\"", JsonToken.Value(expectedValue)); + } + + // Valid surrogate pairs, with mixed escaping. These test cases can't be expressed + // using TestCase as they have no valid UTF-8 representation. + // It's unclear exactly how we should handle a mixture of escaped or not: that can't + // come from UTF-8 text, but could come from a .NET string. For the moment, + // treat it as valid in the obvious way. + [Test] + public void MixedSurrogatePairs() + { + string expected = "\ud800\udc00"; + AssertTokens("'\\ud800\udc00'", JsonToken.Value(expected)); + AssertTokens("'\ud800\\udc00'", JsonToken.Value(expected)); + } + + [Test] + public void ObjectDepth() + { + string json = "{ \"foo\": { \"x\": 1, \"y\": [ 0 ] } }"; + var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json)); + // If we had more tests like this, I'd introduce a helper method... but for one test, it's not worth it. + Assert.AreEqual(0, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.StartObject, tokenizer.Next()); + Assert.AreEqual(1, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Name("foo"), tokenizer.Next()); + Assert.AreEqual(1, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.StartObject, tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Name("x"), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Value(1), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.Name("y"), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.StartArray, tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); // Depth hasn't changed in array + Assert.AreEqual(JsonToken.Value(0), tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndArray, tokenizer.Next()); + Assert.AreEqual(2, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndObject, tokenizer.Next()); + Assert.AreEqual(1, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndObject, tokenizer.Next()); + Assert.AreEqual(0, tokenizer.ObjectDepth); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + Assert.AreEqual(0, tokenizer.ObjectDepth); + } + + [Test] + public void ObjectDepth_WithPushBack() + { + string json = "{}"; + var tokenizer = JsonTokenizer.FromTextReader(new StringReader(json)); + Assert.AreEqual(0, tokenizer.ObjectDepth); + var token = tokenizer.Next(); + Assert.AreEqual(1, tokenizer.ObjectDepth); + // When we push back a "start object", we should effectively be back to the previous depth. + tokenizer.PushBack(token); + Assert.AreEqual(0, tokenizer.ObjectDepth); + // Read the same token again, and get back to depth 1 + token = tokenizer.Next(); + Assert.AreEqual(1, tokenizer.ObjectDepth); + + // Now the same in reverse, with EndObject + token = tokenizer.Next(); + Assert.AreEqual(0, tokenizer.ObjectDepth); + tokenizer.PushBack(token); + Assert.AreEqual(1, tokenizer.ObjectDepth); + tokenizer.Next(); + Assert.AreEqual(0, tokenizer.ObjectDepth); + } + + [Test] + [TestCase("embedded tab\t")] + [TestCase("embedded CR\r")] + [TestCase("embedded LF\n")] + [TestCase("embedded bell\u0007")] + [TestCase("bad escape\\a")] + [TestCase("incomplete escape\\")] + [TestCase("incomplete Unicode escape\\u000")] + [TestCase("invalid Unicode escape\\u000H")] + // Surrogate pair handling, both in raw .NET strings and escaped. We only need + // to detect this in strings, as non-ASCII characters anywhere other than in strings + // will already lead to parsing errors. + [TestCase("\\ud800")] + [TestCase("\\udc00")] + [TestCase("\\ud800x")] + [TestCase("\\udc00x")] + [TestCase("\\udc00\\ud800y")] + public void InvalidStringValue(string json) + { + AssertThrowsAfter("\"" + json + "\""); + } + + // Tests for invalid strings that can't be expressed in attributes, + // as the constants can't be expressed as UTF-8 strings. + [Test] + public void InvalidSurrogatePairs() + { + AssertThrowsAfter("\"\ud800x\""); + AssertThrowsAfter("\"\udc00y\""); + AssertThrowsAfter("\"\udc00\ud800y\""); + } + + [Test] + [TestCase("0", 0)] + [TestCase("-0", 0)] // We don't distinguish between positive and negative 0 + [TestCase("1", 1)] + [TestCase("-1", -1)] + // From here on, assume leading sign is okay... + [TestCase("1.125", 1.125)] + [TestCase("1.0", 1)] + [TestCase("1e5", 100000)] + [TestCase("1e000000", 1)] // Weird, but not prohibited by the spec + [TestCase("1E5", 100000)] + [TestCase("1e+5", 100000)] + [TestCase("1E-5", 0.00001)] + [TestCase("123E-2", 1.23)] + [TestCase("123.45E3", 123450)] + [TestCase(" 1 ", 1)] + public void NumberValue(string json, double expectedValue) + { + AssertTokens(json, JsonToken.Value(expectedValue)); + } + + [Test] + [TestCase("00")] + [TestCase(".5")] + [TestCase("1.")] + [TestCase("1e")] + [TestCase("1e-")] + [TestCase("--")] + [TestCase("--1")] + [TestCase("-1.7977e308")] + [TestCase("1.7977e308")] + public void InvalidNumberValue(string json) + { + AssertThrowsAfter(json); + } + + [Test] + [TestCase("nul")] + [TestCase("nothing")] + [TestCase("truth")] + [TestCase("fALSEhood")] + public void InvalidLiterals(string json) + { + AssertThrowsAfter(json); + } + + [Test] + public void NullValue() + { + AssertTokens("null", JsonToken.Null); + } + + [Test] + public void TrueValue() + { + AssertTokens("true", JsonToken.True); + } + + [Test] + public void FalseValue() + { + AssertTokens("false", JsonToken.False); + } + + [Test] + public void SimpleObject() + { + AssertTokens("{'x': 'y'}", + JsonToken.StartObject, JsonToken.Name("x"), JsonToken.Value("y"), JsonToken.EndObject); + } + + [Test] + [TestCase("[10, 20", 3)] + [TestCase("[10,", 2)] + [TestCase("[10:20]", 2)] + [TestCase("[", 1)] + [TestCase("[,", 1)] + [TestCase("{", 1)] + [TestCase("{,", 1)] + [TestCase("{[", 1)] + [TestCase("{{", 1)] + [TestCase("{0", 1)] + [TestCase("{null", 1)] + [TestCase("{false", 1)] + [TestCase("{true", 1)] + [TestCase("}", 0)] + [TestCase("]", 0)] + [TestCase(",", 0)] + [TestCase("'foo' 'bar'", 1)] + [TestCase(":", 0)] + [TestCase("'foo", 0)] // Incomplete string + [TestCase("{ 'foo' }", 2)] + [TestCase("{ x:1", 1)] // Property names must be quoted + [TestCase("{]", 1)] + [TestCase("[}", 1)] + [TestCase("[1,", 2)] + [TestCase("{'x':0]", 3)] + [TestCase("{ 'foo': }", 2)] + [TestCase("{ 'foo':'bar', }", 3)] + public void InvalidStructure(string json, int expectedValidTokens) + { + // Note: we don't test that the earlier tokens are exactly as expected, + // partly because that's hard to parameterize. + var reader = new StringReader(json.Replace('\'', '"')); + var tokenizer = JsonTokenizer.FromTextReader(reader); + for (int i = 0; i < expectedValidTokens; i++) + { + Assert.IsNotNull(tokenizer.Next()); + } + Assert.Throws(() => tokenizer.Next()); + } + + [Test] + public void ArrayMixedType() + { + AssertTokens("[1, 'foo', null, false, true, [2], {'x':'y' }]", + JsonToken.StartArray, + JsonToken.Value(1), + JsonToken.Value("foo"), + JsonToken.Null, + JsonToken.False, + JsonToken.True, + JsonToken.StartArray, + JsonToken.Value(2), + JsonToken.EndArray, + JsonToken.StartObject, + JsonToken.Name("x"), + JsonToken.Value("y"), + JsonToken.EndObject, + JsonToken.EndArray); + } + + [Test] + public void ObjectMixedType() + { + AssertTokens(@"{'a': 1, 'b': 'bar', 'c': null, 'd': false, 'e': true, + 'f': [2], 'g': {'x':'y' }}", + JsonToken.StartObject, + JsonToken.Name("a"), + JsonToken.Value(1), + JsonToken.Name("b"), + JsonToken.Value("bar"), + JsonToken.Name("c"), + JsonToken.Null, + JsonToken.Name("d"), + JsonToken.False, + JsonToken.Name("e"), + JsonToken.True, + JsonToken.Name("f"), + JsonToken.StartArray, + JsonToken.Value(2), + JsonToken.EndArray, + JsonToken.Name("g"), + JsonToken.StartObject, + JsonToken.Name("x"), + JsonToken.Value("y"), + JsonToken.EndObject, + JsonToken.EndObject); + } + + [Test] + public void NextAfterEndDocumentThrows() + { + var tokenizer = JsonTokenizer.FromTextReader(new StringReader("null")); + Assert.AreEqual(JsonToken.Null, tokenizer.Next()); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + Assert.Throws(() => tokenizer.Next()); + } + + [Test] + public void CanPushBackEndDocument() + { + var tokenizer = JsonTokenizer.FromTextReader(new StringReader("null")); + Assert.AreEqual(JsonToken.Null, tokenizer.Next()); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + tokenizer.PushBack(JsonToken.EndDocument); + Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next()); + Assert.Throws(() => tokenizer.Next()); + } + + /// + /// Asserts that the specified JSON is tokenized into the given sequence of tokens. + /// All apostrophes are first converted to double quotes, allowing any tests + /// that don't need to check actual apostrophe handling to use apostrophes in the JSON, avoiding + /// messy string literal escaping. The "end document" token is not specified in the list of + /// expected tokens, but is implicit. + /// + private static void AssertTokens(string json, params JsonToken[] expectedTokens) + { + AssertTokensNoReplacement(json.Replace('\'', '"'), expectedTokens); + } + + /// + /// Asserts that the specified JSON is tokenized into the given sequence of tokens. + /// Unlike , this does not perform any character + /// replacement on the specified JSON, and should be used when the text contains apostrophes which + /// are expected to be used *as* apostrophes. The "end document" token is not specified in the list of + /// expected tokens, but is implicit. + /// + private static void AssertTokensNoReplacement(string json, params JsonToken[] expectedTokens) + { + var reader = new StringReader(json); + var tokenizer = JsonTokenizer.FromTextReader(reader); + for (int i = 0; i < expectedTokens.Length; i++) + { + var actualToken = tokenizer.Next(); + if (actualToken == JsonToken.EndDocument) + { + Assert.Fail("Expected {0} but reached end of token stream", expectedTokens[i]); + } + Assert.AreEqual(expectedTokens[i], actualToken); + } + var finalToken = tokenizer.Next(); + if (finalToken != JsonToken.EndDocument) + { + Assert.Fail("Expected token stream to be exhausted; received {0}", finalToken); + } + } + + private static void AssertThrowsAfter(string json, params JsonToken[] expectedTokens) + { + var reader = new StringReader(json); + var tokenizer = JsonTokenizer.FromTextReader(reader); + for (int i = 0; i < expectedTokens.Length; i++) + { + var actualToken = tokenizer.Next(); + if (actualToken == JsonToken.EndDocument) + { + Assert.Fail("Expected {0} but reached end of document", expectedTokens[i]); + } + Assert.AreEqual(expectedTokens[i], actualToken); + } + Assert.Throws(() => tokenizer.Next()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs new file mode 100644 index 0000000000..9078e59b1d --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Program.cs @@ -0,0 +1,47 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnitLite; +using System.Reflection; + +// Note: this file wasn't in the actual 3.0, but is required due to build +// system changes + +namespace Google.Protobuf.Test +{ + class Program + { + public static int Main(string[] args) + { + return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args); + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs new file mode 100644 index 0000000000..52d5a67697 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs @@ -0,0 +1,259 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Linq; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using UnitTest.Issues.TestProtos; + +namespace Google.Protobuf.Reflection +{ + /// + /// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the + /// size doesn't warrant it. On the other hand, this makes me feel a bit dirty...) + /// + public class DescriptorsTest + { + [Test] + public void FileDescriptor() + { + FileDescriptor file = UnittestProto3Reflection.Descriptor; + + Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Name); + Assert.AreEqual("protobuf_unittest", file.Package); + + Assert.AreEqual("UnittestProto", file.Proto.Options.JavaOuterClassname); + Assert.AreEqual("google/protobuf/unittest_proto3.proto", file.Proto.Name); + + // unittest.proto doesn't have any public imports, but unittest_import.proto does. + Assert.AreEqual(0, file.PublicDependencies.Count); + Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.PublicDependencies.Count); + Assert.AreEqual(UnittestImportPublicProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor.PublicDependencies[0]); + + Assert.AreEqual(1, file.Dependencies.Count); + Assert.AreEqual(UnittestImportProto3Reflection.Descriptor, file.Dependencies[0]); + + MessageDescriptor messageType = TestAllTypes.Descriptor; + Assert.AreSame(typeof(TestAllTypes), messageType.ClrType); + Assert.AreSame(TestAllTypes.Parser, messageType.Parser); + Assert.AreEqual(messageType, file.MessageTypes[0]); + Assert.AreEqual(messageType, file.FindTypeByName("TestAllTypes")); + Assert.Null(file.FindTypeByName("NoSuchType")); + Assert.Null(file.FindTypeByName("protobuf_unittest.TestAllTypes")); + for (int i = 0; i < file.MessageTypes.Count; i++) + { + Assert.AreEqual(i, file.MessageTypes[i].Index); + } + + Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName("ForeignEnum")); + Assert.Null(file.FindTypeByName("NoSuchType")); + Assert.Null(file.FindTypeByName("protobuf_unittest.ForeignEnum")); + Assert.AreEqual(1, UnittestImportProto3Reflection.Descriptor.EnumTypes.Count); + Assert.AreEqual("ImportEnum", UnittestImportProto3Reflection.Descriptor.EnumTypes[0].Name); + for (int i = 0; i < file.EnumTypes.Count; i++) + { + Assert.AreEqual(i, file.EnumTypes[i].Index); + } + + Assert.AreEqual(10, file.SerializedData[0]); + } + + [Test] + public void MessageDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor; + + Assert.AreEqual("TestAllTypes", messageType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, messageType.File); + Assert.IsNull(messageType.ContainingType); + Assert.IsNull(messageType.Proto.Options); + + Assert.AreEqual("TestAllTypes", messageType.Name); + + Assert.AreEqual("NestedMessage", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File); + Assert.AreEqual(messageType, nestedType.ContainingType); + + FieldDescriptor field = messageType.Fields.InDeclarationOrder()[0]; + Assert.AreEqual("single_int32", field.Name); + Assert.AreEqual(field, messageType.FindDescriptor("single_int32")); + Assert.Null(messageType.FindDescriptor("no_such_field")); + Assert.AreEqual(field, messageType.FindFieldByNumber(1)); + Assert.Null(messageType.FindFieldByNumber(571283)); + var fieldsInDeclarationOrder = messageType.Fields.InDeclarationOrder(); + for (int i = 0; i < fieldsInDeclarationOrder.Count; i++) + { + Assert.AreEqual(i, fieldsInDeclarationOrder[i].Index); + } + + Assert.AreEqual(nestedType, messageType.NestedTypes[0]); + Assert.AreEqual(nestedType, messageType.FindDescriptor("NestedMessage")); + Assert.Null(messageType.FindDescriptor("NoSuchType")); + for (int i = 0; i < messageType.NestedTypes.Count; i++) + { + Assert.AreEqual(i, messageType.NestedTypes[i].Index); + } + + Assert.AreEqual(messageType.EnumTypes[0], messageType.FindDescriptor("NestedEnum")); + Assert.Null(messageType.FindDescriptor("NoSuchType")); + for (int i = 0; i < messageType.EnumTypes.Count; i++) + { + Assert.AreEqual(i, messageType.EnumTypes[i].Index); + } + } + + [Test] + public void FieldDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + FieldDescriptor primitiveField = messageType.FindDescriptor("single_int32"); + FieldDescriptor enumField = messageType.FindDescriptor("single_nested_enum"); + FieldDescriptor messageField = messageType.FindDescriptor("single_foreign_message"); + + Assert.AreEqual("single_int32", primitiveField.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.single_int32", + primitiveField.FullName); + Assert.AreEqual(1, primitiveField.FieldNumber); + Assert.AreEqual(messageType, primitiveField.ContainingType); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, primitiveField.File); + Assert.AreEqual(FieldType.Int32, primitiveField.FieldType); + Assert.IsNull(primitiveField.Proto.Options); + + Assert.AreEqual("single_nested_enum", enumField.Name); + Assert.AreEqual(FieldType.Enum, enumField.FieldType); + // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType); + + Assert.AreEqual("single_foreign_message", messageField.Name); + Assert.AreEqual(FieldType.Message, messageField.FieldType); + Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType); + } + + [Test] + public void FieldDescriptorLabel() + { + FieldDescriptor singleField = + TestAllTypes.Descriptor.FindDescriptor("single_int32"); + FieldDescriptor repeatedField = + TestAllTypes.Descriptor.FindDescriptor("repeated_int32"); + + Assert.IsFalse(singleField.IsRepeated); + Assert.IsTrue(repeatedField.IsRepeated); + } + + [Test] + public void EnumDescriptor() + { + // Note: this test is a bit different to the Java version because there's no static way of getting to the descriptor + EnumDescriptor enumType = UnittestProto3Reflection.Descriptor.FindTypeByName("ForeignEnum"); + EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor("NestedEnum"); + + Assert.AreEqual("ForeignEnum", enumType.Name); + Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, enumType.File); + Assert.Null(enumType.ContainingType); + Assert.Null(enumType.Proto.Options); + + Assert.AreEqual("NestedEnum", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", + nestedType.FullName); + Assert.AreEqual(UnittestProto3Reflection.Descriptor, nestedType.File); + Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); + + EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO"); + Assert.AreEqual(value, enumType.Values[1]); + Assert.AreEqual("FOREIGN_FOO", value.Name); + Assert.AreEqual(4, value.Number); + Assert.AreEqual((int) ForeignEnum.ForeignFoo, value.Number); + Assert.AreEqual(value, enumType.FindValueByNumber(4)); + Assert.Null(enumType.FindValueByName("NO_SUCH_VALUE")); + for (int i = 0; i < enumType.Values.Count; i++) + { + Assert.AreEqual(i, enumType.Values[i].Index); + } + } + + [Test] + public void OneofDescriptor() + { + OneofDescriptor descriptor = TestAllTypes.Descriptor.FindDescriptor("oneof_field"); + Assert.AreEqual("oneof_field", descriptor.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.oneof_field", descriptor.FullName); + + var expectedFields = new[] { + TestAllTypes.OneofBytesFieldNumber, + TestAllTypes.OneofNestedMessageFieldNumber, + TestAllTypes.OneofStringFieldNumber, + TestAllTypes.OneofUint32FieldNumber } + .Select(fieldNumber => TestAllTypes.Descriptor.FindFieldByNumber(fieldNumber)) + .ToList(); + foreach (var field in expectedFields) + { + Assert.AreSame(descriptor, field.ContainingOneof); + } + + CollectionAssert.AreEquivalent(expectedFields, descriptor.Fields); + } + + [Test] + public void MapEntryMessageDescriptor() + { + var descriptor = MapWellKnownTypes.Descriptor.NestedTypes[0]; + Assert.IsNull(descriptor.Parser); + Assert.IsNull(descriptor.ClrType); + Assert.IsNull(descriptor.Fields[1].Accessor); + } + + // From TestFieldOrdering: + // string my_string = 11; + // int64 my_int = 1; + // float my_float = 101; + // NestedMessage single_nested_message = 200; + [Test] + public void FieldListOrderings() + { + var fields = TestFieldOrderings.Descriptor.Fields; + Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber)); + Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber)); + } + + + [Test] + public void DescriptorProtoFileDescriptor() + { + var descriptor = Google.Protobuf.Reflection.FileDescriptor.DescriptorProtoFileDescriptor; + Assert.AreEqual("google/protobuf/descriptor.proto", descriptor.Name); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs new file mode 100644 index 0000000000..a488af30d4 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs @@ -0,0 +1,218 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + public class FieldAccessTest + { + [Test] + public void GetValue() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var fields = TestAllTypes.Descriptor.Fields; + Assert.AreEqual(message.SingleBool, fields[TestAllTypes.SingleBoolFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleBytes, fields[TestAllTypes.SingleBytesFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleDouble, fields[TestAllTypes.SingleDoubleFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleFixed32, fields[TestAllTypes.SingleFixed32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleFixed64, fields[TestAllTypes.SingleFixed64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleFloat, fields[TestAllTypes.SingleFloatFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleForeignEnum, fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleForeignMessage, fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleImportEnum, fields[TestAllTypes.SingleImportEnumFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleImportMessage, fields[TestAllTypes.SingleImportMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleInt32, fields[TestAllTypes.SingleInt32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleInt64, fields[TestAllTypes.SingleInt64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleNestedEnum, fields[TestAllTypes.SingleNestedEnumFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleNestedMessage, fields[TestAllTypes.SingleNestedMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SinglePublicImportMessage, fields[TestAllTypes.SinglePublicImportMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSint32, fields[TestAllTypes.SingleSint32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSint64, fields[TestAllTypes.SingleSint64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleString, fields[TestAllTypes.SingleStringFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSfixed32, fields[TestAllTypes.SingleSfixed32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleSfixed64, fields[TestAllTypes.SingleSfixed64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleUint32, fields[TestAllTypes.SingleUint32FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.SingleUint64, fields[TestAllTypes.SingleUint64FieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofBytes, fields[TestAllTypes.OneofBytesFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofString, fields[TestAllTypes.OneofStringFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofNestedMessage, fields[TestAllTypes.OneofNestedMessageFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(message.OneofUint32, fields[TestAllTypes.OneofUint32FieldNumber].Accessor.GetValue(message)); + + // Just one example for repeated fields - they're all just returning the list + var list = (IList) fields[TestAllTypes.RepeatedInt32FieldNumber].Accessor.GetValue(message); + Assert.AreEqual(message.RepeatedInt32, list); + Assert.AreEqual(message.RepeatedInt32[0], list[0]); // Just in case there was any doubt... + + // Just a single map field, for the same reason + var mapMessage = new TestMap { MapStringString = { { "key1", "value1" }, { "key2", "value2" } } }; + fields = TestMap.Descriptor.Fields; + var dictionary = (IDictionary) fields[TestMap.MapStringStringFieldNumber].Accessor.GetValue(mapMessage); + Assert.AreEqual(mapMessage.MapStringString, dictionary); + Assert.AreEqual("value1", dictionary["key1"]); + } + + [Test] + public void Clear() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var fields = TestAllTypes.Descriptor.Fields; + fields[TestAllTypes.SingleBoolFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleInt32FieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleStringFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleBytesFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.Clear(message); + fields[TestAllTypes.RepeatedDoubleFieldNumber].Accessor.Clear(message); + + var expected = new TestAllTypes(SampleMessages.CreateFullTestAllTypes()) + { + SingleBool = false, + SingleInt32 = 0, + SingleString = "", + SingleBytes = ByteString.Empty, + SingleForeignEnum = 0, + SingleForeignMessage = null, + }; + expected.RepeatedDouble.Clear(); + + Assert.AreEqual(expected, message); + + // Separately, maps. + var mapMessage = new TestMap { MapStringString = { { "key1", "value1" }, { "key2", "value2" } } }; + fields = TestMap.Descriptor.Fields; + fields[TestMap.MapStringStringFieldNumber].Accessor.Clear(mapMessage); + Assert.AreEqual(0, mapMessage.MapStringString.Count); + } + + [Test] + public void SetValue_SingleFields() + { + // Just a sample (primitives, messages, enums, strings, byte strings) + var message = SampleMessages.CreateFullTestAllTypes(); + var fields = TestAllTypes.Descriptor.Fields; + fields[TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, false); + fields[TestAllTypes.SingleInt32FieldNumber].Accessor.SetValue(message, 500); + fields[TestAllTypes.SingleStringFieldNumber].Accessor.SetValue(message, "It's a string"); + fields[TestAllTypes.SingleBytesFieldNumber].Accessor.SetValue(message, ByteString.CopyFrom(99, 98, 97)); + fields[TestAllTypes.SingleForeignEnumFieldNumber].Accessor.SetValue(message, ForeignEnum.ForeignFoo); + fields[TestAllTypes.SingleForeignMessageFieldNumber].Accessor.SetValue(message, new ForeignMessage { C = 12345 }); + fields[TestAllTypes.SingleDoubleFieldNumber].Accessor.SetValue(message, 20150701.5); + + var expected = new TestAllTypes(SampleMessages.CreateFullTestAllTypes()) + { + SingleBool = false, + SingleInt32 = 500, + SingleString = "It's a string", + SingleBytes = ByteString.CopyFrom(99, 98, 97), + SingleForeignEnum = ForeignEnum.ForeignFoo, + SingleForeignMessage = new ForeignMessage { C = 12345 }, + SingleDouble = 20150701.5 + }; + + Assert.AreEqual(expected, message); + } + + [Test] + public void SetValue_SingleFields_WrongType() + { + IMessage message = SampleMessages.CreateFullTestAllTypes(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestAllTypes.SingleBoolFieldNumber].Accessor.SetValue(message, "This isn't a bool")); + } + + [Test] + public void SetValue_MapFields() + { + IMessage message = new TestMap(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestMap.MapStringStringFieldNumber].Accessor.SetValue(message, new Dictionary())); + } + + [Test] + public void SetValue_RepeatedFields() + { + IMessage message = SampleMessages.CreateFullTestAllTypes(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestAllTypes.RepeatedDoubleFieldNumber].Accessor.SetValue(message, new double[10])); + } + + [Test] + public void GetValue_IncorrectType() + { + IMessage message = SampleMessages.CreateFullTestAllTypes(); + var fields = message.Descriptor.Fields; + Assert.Throws(() => fields[TestAllTypes.SingleBoolFieldNumber].Accessor.GetValue(new TestMap())); + } + + [Test] + public void Oneof() + { + var message = new TestAllTypes(); + var descriptor = TestAllTypes.Descriptor; + Assert.AreEqual(1, descriptor.Oneofs.Count); + var oneof = descriptor.Oneofs[0]; + Assert.AreEqual("oneof_field", oneof.Name); + Assert.IsNull(oneof.Accessor.GetCaseFieldDescriptor(message)); + + message.OneofString = "foo"; + Assert.AreSame(descriptor.Fields[TestAllTypes.OneofStringFieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message)); + + message.OneofUint32 = 10; + Assert.AreSame(descriptor.Fields[TestAllTypes.OneofUint32FieldNumber], oneof.Accessor.GetCaseFieldDescriptor(message)); + + oneof.Accessor.Clear(message); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + } + + [Test] + public void FieldDescriptor_ByName() + { + var descriptor = TestAllTypes.Descriptor; + Assert.AreSame( + descriptor.Fields[TestAllTypes.SingleBoolFieldNumber], + descriptor.Fields["single_bool"]); + } + + [Test] + public void FieldDescriptor_NotFound() + { + var descriptor = TestAllTypes.Descriptor; + Assert.Throws(() => descriptor.Fields[999999].ToString()); + Assert.Throws(() => descriptor.Fields["not found"].ToString()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs new file mode 100644 index 0000000000..5be7ca2361 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/TypeRegistryTest.cs @@ -0,0 +1,94 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.TestProtos; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; + +namespace Google.Protobuf.Reflection +{ + public class TypeRegistryTest + { + // Most of our tests use messages. Simple test that we really can use files... + [Test] + public void CreateWithFileDescriptor() + { + var registry = TypeRegistry.FromFiles(DurationReflection.Descriptor, StructReflection.Descriptor); + AssertDescriptorPresent(registry, Duration.Descriptor); + AssertDescriptorPresent(registry, ListValue.Descriptor); + AssertDescriptorAbsent(registry, Timestamp.Descriptor); + } + + [Test] + public void TypesFromSameFile() + { + // Just for kicks, let's start with a nested type + var registry = TypeRegistry.FromMessages(TestAllTypes.Types.NestedMessage.Descriptor); + // Top-level... + AssertDescriptorPresent(registry, TestFieldOrderings.Descriptor); + // ... and nested (not the same as the original NestedMessage!) + AssertDescriptorPresent(registry, TestFieldOrderings.Types.NestedMessage.Descriptor); + } + + [Test] + public void DependenciesAreIncluded() + { + var registry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + // Direct dependencies + AssertDescriptorPresent(registry, ImportMessage.Descriptor); + // Public dependencies + AssertDescriptorPresent(registry, PublicImportMessage.Descriptor); + } + + [Test] + public void DuplicateFiles() + { + // Duplicates via dependencies and simply via repetition + var registry = TypeRegistry.FromFiles( + UnittestProto3Reflection.Descriptor, UnittestImportProto3Reflection.Descriptor, + TimestampReflection.Descriptor, TimestampReflection.Descriptor); + AssertDescriptorPresent(registry, TestAllTypes.Descriptor); + AssertDescriptorPresent(registry, ImportMessage.Descriptor); + AssertDescriptorPresent(registry, Timestamp.Descriptor); + } + + private static void AssertDescriptorPresent(TypeRegistry registry, MessageDescriptor descriptor) + { + Assert.AreSame(descriptor, registry.Find(descriptor.FullName)); + } + + private static void AssertDescriptorAbsent(TypeRegistry registry, MessageDescriptor descriptor) + { + Assert.IsNull(registry.Find(descriptor.FullName)); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs new file mode 100644 index 0000000000..77447afa12 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs @@ -0,0 +1,42 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf +{ + // Just a sample enum with positive and negative values to be used in tests. + internal enum SampleEnum + { + NegativeValue = -2, + None = 0, + PositiveValue = 3 + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs new file mode 100644 index 0000000000..ffa4e2a7c2 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleMessages.cs @@ -0,0 +1,99 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using Google.Protobuf.TestProtos; + +namespace Google.Protobuf +{ + /// + /// Helper methods to create sample instances of types generated from unit test messages. + /// + public class SampleMessages + { + /// + /// Creates a new sample TestAllTypes message with all fields populated. + /// The "oneof" field is populated with the string property (OneofString). + /// + public static TestAllTypes CreateFullTestAllTypes() + { + return new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleForeignEnum = ForeignEnum.ForeignBar, + SingleForeignMessage = new ForeignMessage { C = 10 }, + SingleImportEnum = ImportEnum.ImportBaz, + SingleImportMessage = new ImportMessage { D = 20 }, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 }, + SinglePublicImportMessage = new PublicImportMessage { E = 54 }, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = UInt32.MaxValue, + SingleUint64 = UInt64.MaxValue, + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6), ByteString.CopyFrom(new byte[1000]) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { UInt32.MaxValue, 23 }, + RepeatedFixed64 = { UInt64.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar }, + RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } }, + RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified }, + RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, Int64.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } }, + RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { UInt32.MaxValue, UInt32.MinValue }, + RepeatedUint64 = { UInt64.MaxValue, UInt32.MinValue }, + OneofString = "Oneof string" + }; + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs new file mode 100644 index 0000000000..248f5fa913 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestCornerCases.cs @@ -0,0 +1,62 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using UnitTest.Issues.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class TestCornerCases + { + [Test] + public void TestRoundTripNegativeEnums() + { + NegativeEnumMessage msg = new NegativeEnumMessage + { + Value = NegativeEnum.MinusOne, + Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }, + PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow } + }; + + Assert.AreEqual(58, msg.CalculateSize()); + + byte[] bytes = new byte[58]; + CodedOutputStream output = new CodedOutputStream(bytes); + + msg.WriteTo(output); + Assert.AreEqual(0, output.SpaceLeft); + + NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes); + Assert.AreEqual(msg, copy); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs new file mode 100644 index 0000000000..5663a69902 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs @@ -0,0 +1,45 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2016 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +namespace Google.Protobuf.TestProtos +{ + /// + /// A message with custom diagnostics (to test that they work). + /// + public partial class ForeignMessage : ICustomDiagnosticMessage + { + public string ToDiagnosticString() + { + return $"{{ \"c\": {C}, \"@cInHex\": \"{C:x}\" }}"; + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs new file mode 100644 index 0000000000..4aecc998de --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs @@ -0,0 +1,116 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf.WellKnownTypes +{ + public class AnyTest + { + [Test] + public void Pack() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + Assert.AreEqual("type.googleapis.com/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual(message.CalculateSize(), any.Value.Length); + } + + [Test] + public void Pack_WithCustomPrefix() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message, "foo.bar/baz"); + Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual(message.CalculateSize(), any.Value.Length); + } + + [Test] + public void Pack_WithCustomPrefixTrailingSlash() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message, "foo.bar/baz/"); + Assert.AreEqual("foo.bar/baz/protobuf_unittest.TestAllTypes", any.TypeUrl); + Assert.AreEqual(message.CalculateSize(), any.Value.Length); + } + + [Test] + public void Unpack_WrongType() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + Assert.Throws(() => any.Unpack()); + } + + [Test] + public void Unpack_Success() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + var unpacked = any.Unpack(); + Assert.AreEqual(message, unpacked); + } + + [Test] + public void Unpack_CustomPrefix_Success() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message, "foo.bar/baz"); + var unpacked = any.Unpack(); + Assert.AreEqual(message, unpacked); + } + + [Test] + public void ToString_WithValues() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + var text = any.ToString(); + Assert.That(text, Does.Contain("\"@value\": \"" + message.ToByteString().ToBase64() + "\"")); + } + + [Test] + public void ToString_Empty() + { + var any = new Any(); + Assert.AreEqual("{ \"@type\": \"\", \"@value\": \"\" }", any.ToString()); + } + + [Test] + public void ToString_MessageContainingAny() + { + var message = new TestWellKnownTypes { AnyField = new Any() }; + Assert.AreEqual("{ \"anyField\": { \"@type\": \"\", \"@value\": \"\" } }", message.ToString()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs new file mode 100644 index 0000000000..141faf80e0 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/DurationTest.cs @@ -0,0 +1,132 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; +using System; + +namespace Google.Protobuf.WellKnownTypes +{ + public class DurationTest + { + [Test] + public void ToTimeSpan() + { + Assert.AreEqual(TimeSpan.FromSeconds(1), new Duration { Seconds = 1 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromSeconds(-1), new Duration { Seconds = -1 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromMilliseconds(1), new Duration { Nanos = 1000000 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromMilliseconds(-1), new Duration { Nanos = -1000000 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromTicks(1), new Duration { Nanos = 100 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromTicks(-1), new Duration { Nanos = -100 }.ToTimeSpan()); + + // Rounding is towards 0 + Assert.AreEqual(TimeSpan.FromTicks(2), new Duration { Nanos = 250 }.ToTimeSpan()); + Assert.AreEqual(TimeSpan.FromTicks(-2), new Duration { Nanos = -250 }.ToTimeSpan()); + } + + [Test] + public void Addition() + { + Assert.AreEqual(new Duration { Seconds = 2, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } + new Duration { Nanos = 500000000 }); + Assert.AreEqual(new Duration { Seconds = -2, Nanos = -100000000 }, + new Duration { Seconds = -1, Nanos = -600000000 } + new Duration { Nanos = -500000000 }); + Assert.AreEqual(new Duration { Seconds = 1, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } + new Duration { Nanos = -500000000 }); + + // Non-normalized durations, or non-normalized intermediate results + Assert.AreEqual(new Duration { Seconds = 1 }, + new Duration { Seconds = 1, Nanos = -500000000 } + new Duration { Nanos = 500000000 }); + + Assert.AreEqual(new Duration { Nanos = -900000000 }, + new Duration { Seconds = -1, Nanos = -100000000 } + new Duration { Nanos = 200000000 }); + Assert.AreEqual(new Duration { Nanos = 900000000 }, + new Duration { Seconds = 1, Nanos = 100000000 } + new Duration { Nanos = -200000000 }); + } + + [Test] + public void Subtraction() + { + Assert.AreEqual(new Duration { Seconds = 1, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } - new Duration { Nanos = 500000000 }); + Assert.AreEqual(new Duration { Seconds = -1, Nanos = -100000000 }, + new Duration { Seconds = -1, Nanos = -600000000 } - new Duration { Nanos = -500000000 }); + Assert.AreEqual(new Duration { Seconds = 2, Nanos = 100000000 }, + new Duration { Seconds = 1, Nanos = 600000000 } - new Duration { Nanos = -500000000 }); + + // Non-normalized durations + Assert.AreEqual(new Duration(), + new Duration { Seconds = 1, Nanos = -500000000 } - new Duration { Nanos = 500000000 }); + Assert.AreEqual(new Duration { Seconds = 1 }, + new Duration { Nanos = 2000000000 } - new Duration { Nanos = 1000000000 }); + } + + [Test] + public void FromTimeSpan() + { + Assert.AreEqual(new Duration { Seconds = 1 }, Duration.FromTimeSpan(TimeSpan.FromSeconds(1))); + Assert.AreEqual(new Duration { Nanos = Duration.NanosecondsPerTick }, Duration.FromTimeSpan(TimeSpan.FromTicks(1))); + } + + [Test] + [TestCase(0, Duration.MaxNanoseconds + 1)] + [TestCase(0, Duration.MinNanoseconds - 1)] + [TestCase(Duration.MinSeconds - 1, 0)] + [TestCase(Duration.MaxSeconds + 1, 0)] + [TestCase(1, -1)] + [TestCase(-1, 1)] + public void ToTimeSpan_Invalid(long seconds, int nanoseconds) + { + var duration = new Duration { Seconds = seconds, Nanos = nanoseconds }; + Assert.Throws(() => duration.ToTimeSpan()); + } + + [Test] + [TestCase(0, Duration.MaxNanoseconds)] + [TestCase(0, Duration.MinNanoseconds)] + [TestCase(Duration.MinSeconds, Duration.MinNanoseconds)] + [TestCase(Duration.MaxSeconds, Duration.MaxNanoseconds)] + public void ToTimeSpan_Valid(long seconds, int nanoseconds) + { + // Only testing that these values don't throw, unlike their similar tests in ToTimeSpan_Invalid + var duration = new Duration { Seconds = seconds, Nanos = nanoseconds }; + duration.ToTimeSpan(); + } + + [Test] + public void ToString_NonNormalized() + { + // Just a single example should be sufficient... + var duration = new Duration { Seconds = 1, Nanos = -1 }; + Assert.AreEqual("{ \"@warning\": \"Invalid Duration\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs new file mode 100644 index 0000000000..1d9908b4d3 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs @@ -0,0 +1,62 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2016 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + + +using NUnit.Framework; + +namespace Google.Protobuf.WellKnownTypes +{ + public class FieldMaskTest + { + [Test] + [TestCase("foo__bar")] + [TestCase("foo_3_ar")] + [TestCase("fooBar")] + public void ToString_Invalid(string input) + { + var mask = new FieldMask { Paths = { input } }; + var text = mask.ToString(); + // More specific test below + Assert.That(text, Does.Contain("@warning")); + Assert.That(text, Does.Contain(input)); + } + + [Test] + public void ToString_Invalid_Precise() + { + var mask = new FieldMask { Paths = { "x", "foo__bar", @"x\y" } }; + Assert.AreEqual( + "{ \"@warning\": \"Invalid FieldMask\", \"paths\": [ \"x\", \"foo__bar\", \"x\\\\y\" ] }", + mask.ToString()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs new file mode 100644 index 0000000000..9ecd24c62a --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs @@ -0,0 +1,115 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using NUnit.Framework; +using System; + +namespace Google.Protobuf.WellKnownTypes +{ + public class TimestampTest + { + [Test] + public void FromAndToDateTime() + { + DateTime utcMin = DateTime.SpecifyKind(DateTime.MinValue, DateTimeKind.Utc); + DateTime utcMax = DateTime.SpecifyKind(DateTime.MaxValue, DateTimeKind.Utc); + AssertRoundtrip(new Timestamp { Seconds = -62135596800 }, utcMin); + AssertRoundtrip(new Timestamp { Seconds = 253402300799, Nanos = 999999900 }, utcMax); + AssertRoundtrip(new Timestamp(), new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Nanos = 1000000}, new DateTime(1970, 1, 1, 0, 0, 0, 1, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Seconds = -1, Nanos = 999000000 }, new DateTime(1969, 12, 31, 23, 59, 59, 999, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Seconds = 3600 }, new DateTime(1970, 1, 1, 1, 0, 0, DateTimeKind.Utc)); + AssertRoundtrip(new Timestamp { Seconds = -3600 }, new DateTime(1969, 12, 31, 23, 0, 0, DateTimeKind.Utc)); + } + + [Test] + public void ToDateTimeTruncation() + { + var t1 = new Timestamp { Seconds = 1, Nanos = 1000000 + Duration.NanosecondsPerTick - 1 }; + Assert.AreEqual(new DateTime(1970, 1, 1, 0, 0, 1, DateTimeKind.Utc).AddMilliseconds(1), t1.ToDateTime()); + + var t2 = new Timestamp { Seconds = -1, Nanos = 1000000 + Duration.NanosecondsPerTick - 1 }; + Assert.AreEqual(new DateTime(1969, 12, 31, 23, 59, 59).AddMilliseconds(1), t2.ToDateTime()); + } + + [Test] + [TestCase(Timestamp.UnixSecondsAtBclMinValue - 1, Timestamp.MaxNanos)] + [TestCase(Timestamp.UnixSecondsAtBclMaxValue + 1, 0)] + [TestCase(0, -1)] + [TestCase(0, Timestamp.MaxNanos + 1)] + public void ToDateTime_OutOfRange(long seconds, int nanoseconds) + { + var value = new Timestamp { Seconds = seconds, Nanos = nanoseconds }; + Assert.Throws(() => value.ToDateTime()); + } + + // 1ns larger or smaller than the above values + [Test] + [TestCase(Timestamp.UnixSecondsAtBclMinValue, 0)] + [TestCase(Timestamp.UnixSecondsAtBclMaxValue, Timestamp.MaxNanos)] + [TestCase(0, 0)] + [TestCase(0, Timestamp.MaxNanos)] + public void ToDateTime_ValidBoundaries(long seconds, int nanoseconds) + { + var value = new Timestamp { Seconds = seconds, Nanos = nanoseconds }; + value.ToDateTime(); + } + + private static void AssertRoundtrip(Timestamp timestamp, DateTime dateTime) + { + Assert.AreEqual(timestamp, Timestamp.FromDateTime(dateTime)); + Assert.AreEqual(dateTime, timestamp.ToDateTime()); + Assert.AreEqual(DateTimeKind.Utc, timestamp.ToDateTime().Kind); + } + + [Test] + public void Arithmetic() + { + Timestamp t1 = new Timestamp { Seconds = 10000, Nanos = 5000 }; + Timestamp t2 = new Timestamp { Seconds = 8000, Nanos = 10000 }; + Duration difference = new Duration { Seconds = 1999, Nanos = Duration.NanosecondsPerSecond - 5000 }; + Assert.AreEqual(difference, t1 - t2); + Assert.AreEqual(-difference, t2 - t1); + + Assert.AreEqual(t1, t2 + difference); + Assert.AreEqual(t2, t1 - difference); + } + + [Test] + public void ToString_NonNormalized() + { + // Just a single example should be sufficient... + var duration = new Timestamp { Seconds = 1, Nanos = -1 }; + Assert.AreEqual("{ \"@warning\": \"Invalid Timestamp\", \"seconds\": \"1\", \"nanos\": -1 }", duration.ToString()); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs new file mode 100644 index 0000000000..5b7185dcd2 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs @@ -0,0 +1,421 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.IO; + +namespace Google.Protobuf.WellKnownTypes +{ + public class WrappersTest + { + [Test] + public void NullIsDefault() + { + var message = new TestWellKnownTypes(); + Assert.IsNull(message.StringField); + Assert.IsNull(message.BytesField); + Assert.IsNull(message.BoolField); + Assert.IsNull(message.FloatField); + Assert.IsNull(message.DoubleField); + Assert.IsNull(message.Int32Field); + Assert.IsNull(message.Int64Field); + Assert.IsNull(message.Uint32Field); + Assert.IsNull(message.Uint64Field); + } + + [Test] + public void NonDefaultSingleValues() + { + var message = new TestWellKnownTypes + { + StringField = "x", + BytesField = ByteString.CopyFrom(1, 2, 3), + BoolField = true, + FloatField = 12.5f, + DoubleField = 12.25d, + Int32Field = 1, + Int64Field = 2, + Uint32Field = 3, + Uint64Field = 4 + }; + + var bytes = message.ToByteArray(); + var parsed = TestWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual("x", parsed.StringField); + Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), parsed.BytesField); + Assert.AreEqual(true, parsed.BoolField); + Assert.AreEqual(12.5f, parsed.FloatField); + Assert.AreEqual(12.25d, parsed.DoubleField); + Assert.AreEqual(1, parsed.Int32Field); + Assert.AreEqual(2L, parsed.Int64Field); + Assert.AreEqual(3U, parsed.Uint32Field); + Assert.AreEqual(4UL, parsed.Uint64Field); + } + + [Test] + public void NonNullDefaultIsPreservedThroughSerialization() + { + var message = new TestWellKnownTypes + { + StringField = "", + BytesField = ByteString.Empty, + BoolField = false, + FloatField = 0f, + DoubleField = 0d, + Int32Field = 0, + Int64Field = 0, + Uint32Field = 0, + Uint64Field = 0 + }; + + var bytes = message.ToByteArray(); + var parsed = TestWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual("", parsed.StringField); + Assert.AreEqual(ByteString.Empty, parsed.BytesField); + Assert.AreEqual(false, parsed.BoolField); + Assert.AreEqual(0f, parsed.FloatField); + Assert.AreEqual(0d, parsed.DoubleField); + Assert.AreEqual(0, parsed.Int32Field); + Assert.AreEqual(0L, parsed.Int64Field); + Assert.AreEqual(0U, parsed.Uint32Field); + Assert.AreEqual(0UL, parsed.Uint64Field); + } + + [Test] + public void RepeatedWrappersProhibitNullItems() + { + var message = new RepeatedWellKnownTypes(); + Assert.Throws(() => message.BoolField.Add((bool?) null)); + Assert.Throws(() => message.Int32Field.Add((int?) null)); + Assert.Throws(() => message.StringField.Add((string) null)); + Assert.Throws(() => message.BytesField.Add((ByteString) null)); + } + + [Test] + public void RepeatedWrappersSerializeDeserialize() + { + var message = new RepeatedWellKnownTypes + { + BoolField = { true, false }, + BytesField = { ByteString.CopyFrom(1, 2, 3), ByteString.CopyFrom(4, 5, 6), ByteString.Empty }, + DoubleField = { 12.5, -1.5, 0d }, + FloatField = { 123.25f, -20f, 0f }, + Int32Field = { int.MaxValue, int.MinValue, 0 }, + Int64Field = { long.MaxValue, long.MinValue, 0L }, + StringField = { "First", "Second", "" }, + Uint32Field = { uint.MaxValue, uint.MinValue, 0U }, + Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL }, + }; + var bytes = message.ToByteArray(); + var parsed = RepeatedWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual(message, parsed); + // Just to test a single value for sanity... + Assert.AreEqual("Second", message.StringField[1]); + } + + [Test] + public void RepeatedWrappersBinaryFormat() + { + // At one point we accidentally used a packed format for repeated wrappers, which is wrong (and weird). + // This test is just to prove that we use the right format. + + var rawOutput = new MemoryStream(); + var output = new CodedOutputStream(rawOutput); + // Write a value of 5 + output.WriteTag(RepeatedWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(2); + output.WriteTag(WrappersReflection.WrapperValueFieldNumber, WireFormat.WireType.Varint); + output.WriteInt32(5); + // Write a value of 0 (empty message) + output.WriteTag(RepeatedWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(0); + output.Flush(); + var expectedBytes = rawOutput.ToArray(); + + var message = new RepeatedWellKnownTypes { Int32Field = { 5, 0 } }; + var actualBytes = message.ToByteArray(); + Assert.AreEqual(expectedBytes, actualBytes); + } + + [Test] + public void MapWrappersSerializeDeserialize() + { + // Note: no null values here, as they are prohibited in map fields + // (despite being representable). + var message = new MapWellKnownTypes + { + BoolField = { { 10, false }, { 20, true } }, + BytesField = { + { -1, ByteString.CopyFrom(1, 2, 3) }, + { 10, ByteString.CopyFrom(4, 5, 6) }, + { 1000, ByteString.Empty }, + }, + DoubleField = { { 1, 12.5 }, { 10, -1.5 }, { 20, 0d } }, + FloatField = { { 2, 123.25f }, { 3, -20f }, { 4, 0f } }, + Int32Field = { { 5, int.MaxValue }, { 6, int.MinValue }, { 7, 0 } }, + Int64Field = { { 8, long.MaxValue }, { 9, long.MinValue }, { 10, 0L } }, + StringField = { { 11, "First" }, { 12, "Second" }, { 13, "" } }, + Uint32Field = { { 15, uint.MaxValue }, { 16, uint.MinValue }, { 17, 0U } }, + Uint64Field = { { 18, ulong.MaxValue }, { 19, ulong.MinValue }, { 20, 0UL } }, + }; + + var bytes = message.ToByteArray(); + var parsed = MapWellKnownTypes.Parser.ParseFrom(bytes); + + Assert.AreEqual(message, parsed); + // Just to test a single value for sanity... + Assert.AreEqual("Second", message.StringField[12]); + } + + [Test] + public void Reflection_SingleValues() + { + var message = new TestWellKnownTypes + { + StringField = "x", + BytesField = ByteString.CopyFrom(1, 2, 3), + BoolField = true, + FloatField = 12.5f, + DoubleField = 12.25d, + Int32Field = 1, + Int64Field = 2, + Uint32Field = 3, + Uint64Field = 4 + }; + var fields = TestWellKnownTypes.Descriptor.Fields; + + Assert.AreEqual("x", fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(ByteString.CopyFrom(1, 2, 3), fields[TestWellKnownTypes.BytesFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(true, fields[TestWellKnownTypes.BoolFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(12.5f, fields[TestWellKnownTypes.FloatFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(12.25d, fields[TestWellKnownTypes.DoubleFieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(1, fields[TestWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(2L, fields[TestWellKnownTypes.Int64FieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(3U, fields[TestWellKnownTypes.Uint32FieldFieldNumber].Accessor.GetValue(message)); + Assert.AreEqual(4UL, fields[TestWellKnownTypes.Uint64FieldFieldNumber].Accessor.GetValue(message)); + + // And a couple of null fields... + message.StringField = null; + message.FloatField = null; + Assert.IsNull(fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.GetValue(message)); + Assert.IsNull(fields[TestWellKnownTypes.FloatFieldFieldNumber].Accessor.GetValue(message)); + } + + [Test] + public void Reflection_RepeatedFields() + { + // Just a single example... note that we can't have a null value here + var message = new RepeatedWellKnownTypes { Int32Field = { 1, 2 } }; + var fields = RepeatedWellKnownTypes.Descriptor.Fields; + var list = (IList) fields[RepeatedWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message); + CollectionAssert.AreEqual(new[] { 1, 2 }, list); + } + + [Test] + public void Reflection_MapFields() + { + // Just a single example... note that we can't have a null value here despite the value type being int? + var message = new MapWellKnownTypes { Int32Field = { { 1, 2 } } }; + var fields = MapWellKnownTypes.Descriptor.Fields; + var dictionary = (IDictionary) fields[MapWellKnownTypes.Int32FieldFieldNumber].Accessor.GetValue(message); + Assert.AreEqual(2, dictionary[1]); + } + + [Test] + public void Oneof() + { + var message = new OneofWellKnownTypes { EmptyField = new Empty() }; + // Start off with a non-wrapper + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.EmptyField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.StringField = "foo"; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.StringField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.StringField = "foo"; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.StringField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.DoubleField = 0.0f; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.DoubleField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.DoubleField = 1.0f; + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.DoubleField, message.OneofFieldCase); + AssertOneofRoundTrip(message); + + message.ClearOneofField(); + Assert.AreEqual(OneofWellKnownTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + AssertOneofRoundTrip(message); + } + + private void AssertOneofRoundTrip(OneofWellKnownTypes message) + { + // Normal roundtrip, but explicitly checking the case... + var bytes = message.ToByteArray(); + var parsed = OneofWellKnownTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + Assert.AreEqual(message.OneofFieldCase, parsed.OneofFieldCase); + } + + [Test] + [TestCase("x", "y", "y")] + [TestCase("x", "", "x")] + [TestCase("x", null, "x")] + [TestCase("", "y", "y")] + [TestCase("", "", "")] + [TestCase("", null, "")] + [TestCase(null, "y", "y")] + [TestCase(null, "", "")] + [TestCase(null, null, null)] + public void Merging(string original, string merged, string expected) + { + var originalMessage = new TestWellKnownTypes { StringField = original }; + var mergingMessage = new TestWellKnownTypes { StringField = merged }; + originalMessage.MergeFrom(mergingMessage); + Assert.AreEqual(expected, originalMessage.StringField); + + // Try it using MergeFrom(CodedInputStream) too... + originalMessage = new TestWellKnownTypes { StringField = original }; + originalMessage.MergeFrom(mergingMessage.ToByteArray()); + Assert.AreEqual(expected, originalMessage.StringField); + } + + // Merging is odd with wrapper types, due to the way that default values aren't emitted in + // the binary stream. In fact we cheat a little bit - a message with an explicitly present default + // value will have that default value ignored. See issue 615. Fixing this would require significant upheaval to + // the FieldCodec side of things. + [Test] + public void MergingStreamExplicitValue() + { + var message = new TestWellKnownTypes { Int32Field = 5 }; + + // Create a byte array which has the data of an Int32Value explicitly containing a value of 0. + // This wouldn't normally happen. + byte[] bytes; + var wrapperTag = WireFormat.MakeTag(TestWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + var valueTag = WireFormat.MakeTag(Int32Value.ValueFieldNumber, WireFormat.WireType.Varint); + using (var stream = new MemoryStream()) + { + var coded = new CodedOutputStream(stream); + coded.WriteTag(wrapperTag); + coded.WriteLength(2); // valueTag + a value 0, each one byte + coded.WriteTag(valueTag); + coded.WriteInt32(0); + coded.Flush(); + bytes = stream.ToArray(); + } + + message.MergeFrom(bytes); + // A normal implementation would have 0 now, as the explicit default would have been overwritten the 5. + // With the FieldCodec for Nullable, we can't tell the difference between an implicit 0 and an explicit 0. + Assert.AreEqual(5, message.Int32Field); + } + + [Test] + public void MergingStreamNoValue() + { + var message = new TestWellKnownTypes { Int32Field = 5 }; + + // Create a byte array which an Int32 field, but with no value. + var bytes = new TestWellKnownTypes { Int32Field = 0 }.ToByteArray(); + Assert.AreEqual(2, bytes.Length); // The tag for Int32Field is a single byte, then a byte indicating a 0-length message. + message.MergeFrom(bytes); + + // The "implicit" 0 did *not* overwrite the value. + // (This is the correct behaviour.) + Assert.AreEqual(5, message.Int32Field); + } + + // All permutations of origin/merging value being null, zero (default) or non-default. + // As this is the in-memory version, we don't need to worry about the difference between implicit and explicit 0. + [Test] + [TestCase(null, null, null)] + [TestCase(null, 0, 0)] + [TestCase(null, 5, 5)] + [TestCase(0, null, 0)] + [TestCase(0, 0, 0)] + [TestCase(0, 5, 5)] + [TestCase(5, null, 5)] + [TestCase(5, 0, 5)] + [TestCase(5, 10, 10)] + public void MergingMessageWithZero(int? originValue, int? mergingValue, int? expectedResult) + { + // This differs from the MergingStreamCornerCase because when we merge message *objects*, + // we ignore default values from the "source". + var message1 = new TestWellKnownTypes { Int32Field = originValue }; + var message2 = new TestWellKnownTypes { Int32Field = mergingValue }; + message1.MergeFrom(message2); + Assert.AreEqual(expectedResult, message1.Int32Field); + } + + [Test] + public void UnknownFieldInWrapper() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var wrapperTag = WireFormat.MakeTag(TestWellKnownTypes.Int32FieldFieldNumber, WireFormat.WireType.LengthDelimited); + var unknownTag = WireFormat.MakeTag(15, WireFormat.WireType.Varint); + var valueTag = WireFormat.MakeTag(Int32Value.ValueFieldNumber, WireFormat.WireType.Varint); + + output.WriteTag(wrapperTag); + output.WriteLength(4); // unknownTag + value 5 + valueType + value 6, each 1 byte + output.WriteTag(unknownTag); + output.WriteInt32((int) valueTag); // Sneakily "pretend" it's a tag when it's really a value + output.WriteTag(valueTag); + output.WriteInt32(6); + + output.Flush(); + stream.Position = 0; + + var message = TestWellKnownTypes.Parser.ParseFrom(stream); + Assert.AreEqual(6, message.Int32Field); + } + + [Test] + public void ClearWithReflection() + { + // String and Bytes are the tricky ones here, as the CLR type of the property + // is the same between the wrapper and non-wrapper types. + var message = new TestWellKnownTypes { StringField = "foo" }; + TestWellKnownTypes.Descriptor.Fields[TestWellKnownTypes.StringFieldFieldNumber].Accessor.Clear(message); + Assert.IsNull(message.StringField); + } + } +} diff --git a/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/test.sh b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/test.sh new file mode 100755 index 0000000000..54d28dfc26 --- /dev/null +++ b/packager/third_party/protobuf/csharp/compatibility_tests/v3.0.0/test.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +function run_test() { + # Generate test proto files. + ./protoc_1 -Iprotos/src -I../../../src/ --csharp_out=src/Google.Protobuf.Test \ + --csharp_opt=base_namespace=Google.Protobuf \ + protos/src/google/protobuf/unittest_import_proto3.proto \ + protos/src/google/protobuf/unittest_import_public_proto3.proto \ + protos/src/google/protobuf/unittest_well_known_types.proto + + ./protoc_1 -Iprotos/csharp --csharp_out=src/Google.Protobuf.Test \ + --csharp_opt=base_namespace=UnitTest.Issues \ + protos/csharp/protos/unittest_issues.proto + + ./protoc_2 -Iprotos/src --csharp_out=src/Google.Protobuf.Test \ + --csharp_opt=base_namespace=Google.Protobuf \ + protos/src/google/protobuf/unittest_proto3.proto \ + protos/src/google/protobuf/map_unittest_proto3.proto + + # Build and test. + dotnet restore src/Google.Protobuf/Google.Protobuf.csproj + dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj + dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj + dotnet run -c Release -f netcoreapp1.0 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj +} + +set -ex + +# Change to the script's directory. +cd $(dirname $0) + +# Version of the tests (i.e., the version of protobuf from where we extracted +# these tests). +TEST_VERSION=3.0.0 + +# The old version of protobuf that we are testing compatibility against. This +# is usually the same as TEST_VERSION (i.e., we use the tests extracted from +# that version to test compatibility of the newest runtime against it), but it +# is also possible to use this same test set to test the compatibiilty of the +# latest version against other versions. +case "$1" in + ""|3.0.0) + OLD_VERSION=3.0.0 + OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0/protoc-3.0.0-linux-x86_64.exe + ;; + 3.0.2) + OLD_VERSION=3.0.2 + OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.2/protoc-3.0.2-linux-x86_64.exe + ;; + 3.1.0) + OLD_VERSION=3.1.0 + OLD_VERSION_PROTOC=http://repo1.maven.org/maven2/com/google/protobuf/protoc/3.1.0/protoc-3.1.0-linux-x86_64.exe + ;; + *) + echo "[ERROR]: Unknown version number: $1" + exit 1 + ;; +esac + +echo "Running compatibility tests with $OLD_VERSION" + +# Check protoc +[ -f ../../../src/protoc ] || { + echo "[ERROR]: Please build protoc first." + exit 1 +} + +# Download old version protoc compiler (for linux). +wget $OLD_VERSION_PROTOC -O old_protoc +chmod +x old_protoc + +# Test source compatibility. In these tests we recompile everything against +# the new runtime (including old version generated code). +# Copy the new runtime and keys. +cp ../../src/Google.Protobuf src/Google.Protobuf -r +cp ../../keys . -r + +# Test A.1: +# proto set 1: use old version +# proto set 2 which may import protos in set 1: use old version +cp old_protoc protoc_1 +cp old_protoc protoc_2 +run_test + +# Test A.2: +# proto set 1: use new version +# proto set 2 which may import protos in set 1: use old version +cp ../../../src/protoc protoc_1 +cp old_protoc protoc_2 +run_test + +# Test A.3: +# proto set 1: use old version +# proto set 2 which may import protos in set 1: use new version +cp old_protoc protoc_1 +cp ../../../src/protoc protoc_2 +run_test + +rm protoc_1 +rm protoc_2 +rm old_protoc +rm keys -r +rm src/Google.Protobuf -r diff --git a/packager/third_party/protobuf/csharp/generate_protos.sh b/packager/third_party/protobuf/csharp/generate_protos.sh index d979aa52be..d2f474796f 100755 --- a/packager/third_party/protobuf/csharp/generate_protos.sh +++ b/packager/third_party/protobuf/csharp/generate_protos.sh @@ -50,9 +50,15 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test \ src/google/protobuf/unittest_well_known_types.proto # Different base namespace to the protos above -$PROTOC -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ +$PROTOC -Isrc -Icsharp/protos --csharp_out=csharp/src/Google.Protobuf.Test \ --csharp_opt=base_namespace=UnitTest.Issues \ - csharp/protos/unittest_issues.proto + csharp/protos/unittest_issues.proto \ + csharp/protos/unittest_custom_options_proto3.proto + +# Don't specify a base namespace at all; we just want to make sure the +# results end up in TestProtos. +$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \ + src/google/protobuf/test_messages_proto3.proto # AddressBook sample protos $PROTOC -Iexamples --csharp_out=csharp/src/AddressBook \ diff --git a/packager/third_party/protobuf/csharp/global.json b/packager/third_party/protobuf/csharp/global.json new file mode 100644 index 0000000000..3622b56494 --- /dev/null +++ b/packager/third_party/protobuf/csharp/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "1.0.0" + } +} diff --git a/packager/third_party/protobuf/csharp/protos/unittest_custom_options_proto3.proto b/packager/third_party/protobuf/csharp/protos/unittest_custom_options_proto3.proto new file mode 100644 index 0000000000..87bd0f7a84 --- /dev/null +++ b/packager/third_party/protobuf/csharp/protos/unittest_custom_options_proto3.proto @@ -0,0 +1,336 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: benjy@google.com (Benjy Weinberger) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file used to test the "custom options" feature of google.protobuf. + +// This file is based on unittest_custom_options.proto in +// src/google/protobuf, but is modified for proto3. It could +// potentially be moved into src/google/protobuf, but currently C# +// is the only language that really needs it, as we don't support +// proto2 syntax. It's cut down significantly as proto3 only supports +// extensions for options. + + +syntax = "proto3"; + +// A custom file option (defined below). +option (file_opt1) = 9876543210; + +import "google/protobuf/descriptor.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +package protobuf_unittest; +option csharp_namespace = "UnitTest.Issues.TestProtos"; + +// Some simple test custom options of various types. + +extend google.protobuf.FileOptions { + uint64 file_opt1 = 7736974; +} + +extend google.protobuf.MessageOptions { + int32 message_opt1 = 7739036; +} + +extend google.protobuf.FieldOptions { + fixed64 field_opt1 = 7740936; +} + +extend google.protobuf.OneofOptions { + int32 oneof_opt1 = 7740111; +} + +extend google.protobuf.EnumOptions { + sfixed32 enum_opt1 = 7753576; +} + +extend google.protobuf.EnumValueOptions { + int32 enum_value_opt1 = 1560678; +} + +extend google.protobuf.ServiceOptions { + sint64 service_opt1 = 7887650; +} + +enum MethodOpt1 { + METHODOPT1_UNSPECIFIED = 0; + METHODOPT1_VAL1 = 1; + METHODOPT1_VAL2 = 2; +} + +extend google.protobuf.MethodOptions { + MethodOpt1 method_opt1 = 7890860; +} + +// A test message with custom options at all possible locations (and also some +// regular options, to make sure they interact nicely). +message TestMessageWithCustomOptions { + option message_set_wire_format = false; + + option (message_opt1) = -56; + + string field1 = 1 [ctype=CORD, + (field_opt1)=8765432109]; + + oneof AnOneof { + option (oneof_opt1) = -99; + int32 oneof_field = 2; + } + + enum AnEnum { + option (enum_opt1) = -789; + ANENUM_UNSPECIFIED = 0; + ANENUM_VAL1 = 1; + ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; + } +} + + +// A test RPC service with custom options at all possible locations (and also +// some regular options, to make sure they interact nicely). +message CustomOptionFooRequest { +} + +message CustomOptionFooResponse { +} + +message CustomOptionFooClientMessage { +} + +message CustomOptionFooServerMessage { +} + +service TestServiceWithCustomOptions { + option (service_opt1) = -9876543210; + + rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { + option (method_opt1) = METHODOPT1_VAL2; + } +} + + + +// Options of every possible field type, so we can test them all exhaustively. + +message DummyMessageContainingEnum { + enum TestEnumType { + TEST_OPTION_ENUM_UNSPECIFIED = 0; + TEST_OPTION_ENUM_TYPE1 = 22; + TEST_OPTION_ENUM_TYPE2 = -23; + } +} + +message DummyMessageInvalidAsOptionType { +} + +extend google.protobuf.MessageOptions { + bool bool_opt = 7706090; + int32 int32_opt = 7705709; + int64 int64_opt = 7705542; + uint32 uint32_opt = 7704880; + uint64 uint64_opt = 7702367; + sint32 sint32_opt = 7701568; + sint64 sint64_opt = 7700863; + fixed32 fixed32_opt = 7700307; + fixed64 fixed64_opt = 7700194; + sfixed32 sfixed32_opt = 7698645; + sfixed64 sfixed64_opt = 7685475; + float float_opt = 7675390; + double double_opt = 7673293; + string string_opt = 7673285; + bytes bytes_opt = 7673238; + DummyMessageContainingEnum.TestEnumType enum_opt = 7673233; + DummyMessageInvalidAsOptionType message_type_opt = 7665967; +} + +message CustomOptionMinIntegerValues { + option (bool_opt) = false; + option (int32_opt) = -0x80000000; + option (int64_opt) = -0x8000000000000000; + option (uint32_opt) = 0; + option (uint64_opt) = 0; + option (sint32_opt) = -0x80000000; + option (sint64_opt) = -0x8000000000000000; + option (fixed32_opt) = 0; + option (fixed64_opt) = 0; + option (sfixed32_opt) = -0x80000000; + option (sfixed64_opt) = -0x8000000000000000; +} + +message CustomOptionMaxIntegerValues { + option (bool_opt) = true; + option (int32_opt) = 0x7FFFFFFF; + option (int64_opt) = 0x7FFFFFFFFFFFFFFF; + option (uint32_opt) = 0xFFFFFFFF; + option (uint64_opt) = 0xFFFFFFFFFFFFFFFF; + option (sint32_opt) = 0x7FFFFFFF; + option (sint64_opt) = 0x7FFFFFFFFFFFFFFF; + option (fixed32_opt) = 0xFFFFFFFF; + option (fixed64_opt) = 0xFFFFFFFFFFFFFFFF; + option (sfixed32_opt) = 0x7FFFFFFF; + option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF; +} + +message CustomOptionOtherValues { + option (int32_opt) = -100; // To test sign-extension. + option (float_opt) = 12.3456789; + option (double_opt) = 1.234567890123456789; + option (string_opt) = "Hello, \"World\""; + option (bytes_opt) = "Hello\0World"; + option (enum_opt) = TEST_OPTION_ENUM_TYPE2; +} + +message SettingRealsFromPositiveInts { + option (float_opt) = 12; + option (double_opt) = 154; +} + +message SettingRealsFromNegativeInts { + option (float_opt) = -12; + option (double_opt) = -154; +} + +// Options of complex message types, themselves combined and extended in +// various ways. + +message ComplexOptionType1 { + int32 foo = 1; + int32 foo2 = 2; + int32 foo3 = 3; + repeated int32 foo4 = 4; +} + +message ComplexOptionType2 { + ComplexOptionType1 bar = 1; + int32 baz = 2; + + message ComplexOptionType4 { + int32 waldo = 1; + + extend google.protobuf.MessageOptions { + ComplexOptionType4 complex_opt4 = 7633546; + } + } + + ComplexOptionType4 fred = 3; + repeated ComplexOptionType4 barney = 4; +} + +message ComplexOptionType3 { + int32 qux = 1; +} + +extend google.protobuf.MessageOptions { + protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756; + ComplexOptionType2 complex_opt2 = 7636949; + ComplexOptionType3 complex_opt3 = 7636463; +} + +// Note that we try various different ways of naming the same extension. +message VariousComplexOptions { + option (.protobuf_unittest.complex_opt1).foo = 42; + option (protobuf_unittest.complex_opt1).foo4 = 99; + option (protobuf_unittest.complex_opt1).foo4 = 88; + option (complex_opt2).baz = 987; + option (complex_opt2).bar.foo = 743; + option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; + option (complex_opt2).fred.waldo = 321; + option (complex_opt2).barney = { waldo: 101 }; + option (complex_opt2).barney = { waldo: 212 }; + option (protobuf_unittest.complex_opt3).qux = 9; +} + +// ------------------------------------------------------ +// Definitions for testing aggregate option parsing. +// See descriptor_unittest.cc. + +// A helper type used to test aggregate option parsing +message Aggregate { + int32 i = 1; + string s = 2; + + // A nested object + Aggregate sub = 3; +} + +// Allow Aggregate to be used as an option at all possible locations +// in the .proto grammer. +extend google.protobuf.FileOptions { Aggregate fileopt = 15478479; } +extend google.protobuf.MessageOptions { Aggregate msgopt = 15480088; } +extend google.protobuf.FieldOptions { Aggregate fieldopt = 15481374; } +extend google.protobuf.EnumOptions { Aggregate enumopt = 15483218; } +extend google.protobuf.EnumValueOptions { Aggregate enumvalopt = 15486921; } +extend google.protobuf.ServiceOptions { Aggregate serviceopt = 15497145; } +extend google.protobuf.MethodOptions { Aggregate methodopt = 15512713; } + +// Try using AggregateOption at different points in the proto grammar +option (fileopt) = { + s: 'FileAnnotation' + // Also test the handling of comments + /* of both types */ i: 100 + + sub { s: 'NestedFileAnnotation' } +}; + +message AggregateMessage { + option (msgopt) = { i:101 s:'MessageAnnotation' }; + int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }]; +} + +service AggregateService { + option (serviceopt) = { s:'ServiceAnnotation' }; + rpc Method (AggregateMessage) returns (AggregateMessage) { + option (methodopt) = { s:'MethodAnnotation' }; + } +} + +enum AggregateEnum { + option (enumopt) = { s:'EnumAnnotation' }; + UNSPECIFIED = 0; + VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }]; +} + +// Test custom options for nested type. +message NestedOptionType { + message NestedMessage { + option (message_opt1) = 1001; + int32 nested_field = 1 [(field_opt1) = 1002]; + } + enum NestedEnum { + UNSPECIFIED = 0; + option (enum_opt1) = 1003; + NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004]; + } +} diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/AddPerson.cs b/packager/third_party/protobuf/csharp/src/AddressBook/AddPerson.cs index 484f1ea25d..62d1788d55 100644 --- a/packager/third_party/protobuf/csharp/src/AddressBook/AddPerson.cs +++ b/packager/third_party/protobuf/csharp/src/AddressBook/AddPerson.cs @@ -1,132 +1,132 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; - -namespace Google.Protobuf.Examples.AddressBook -{ - internal class AddPerson - { - /// - /// Builds a person based on user input - /// - private static Person PromptForAddress(TextReader input, TextWriter output) - { - Person person = new Person(); - - output.Write("Enter person ID: "); - person.Id = int.Parse(input.ReadLine()); - - output.Write("Enter name: "); - person.Name = input.ReadLine(); - - output.Write("Enter email address (blank for none): "); - string email = input.ReadLine(); - if (email.Length > 0) - { - person.Email = email; - } - - while (true) - { - output.Write("Enter a phone number (or leave blank to finish): "); - string number = input.ReadLine(); - if (number.Length == 0) - { - break; - } - - Person.Types.PhoneNumber phoneNumber = new Person.Types.PhoneNumber { Number = number }; - - output.Write("Is this a mobile, home, or work phone? "); - String type = input.ReadLine(); - switch (type) - { - case "mobile": - phoneNumber.Type = Person.Types.PhoneType.Mobile; - break; - case "home": - phoneNumber.Type = Person.Types.PhoneType.Home; - break; - case "work": - phoneNumber.Type = Person.Types.PhoneType.Work; - break; - default: - output.Write("Unknown phone type. Using default."); - break; - } - - person.Phones.Add(phoneNumber); - } - return person; - } - - /// - /// Entry point - loads an existing addressbook or creates a new one, - /// then writes it back to the file. - /// - public static int Main(string[] args) - { - if (args.Length != 1) - { - Console.Error.WriteLine("Usage: AddPerson ADDRESS_BOOK_FILE"); - return -1; - } - - AddressBook addressBook; - - if (File.Exists(args[0])) - { - using (Stream file = File.OpenRead(args[0])) - { - addressBook = AddressBook.Parser.ParseFrom(file); - } - } - else - { - Console.WriteLine("{0}: File not found. Creating a new file.", args[0]); - addressBook = new AddressBook(); - } - - // Add an address. - addressBook.People.Add(PromptForAddress(Console.In, Console.Out)); - - // Write the new address book back to disk. - using (Stream output = File.OpenWrite(args[0])) - { - addressBook.WriteTo(output); - } - return 0; - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; + +namespace Google.Protobuf.Examples.AddressBook +{ + internal class AddPerson + { + /// + /// Builds a person based on user input + /// + private static Person PromptForAddress(TextReader input, TextWriter output) + { + Person person = new Person(); + + output.Write("Enter person ID: "); + person.Id = int.Parse(input.ReadLine()); + + output.Write("Enter name: "); + person.Name = input.ReadLine(); + + output.Write("Enter email address (blank for none): "); + string email = input.ReadLine(); + if (email.Length > 0) + { + person.Email = email; + } + + while (true) + { + output.Write("Enter a phone number (or leave blank to finish): "); + string number = input.ReadLine(); + if (number.Length == 0) + { + break; + } + + Person.Types.PhoneNumber phoneNumber = new Person.Types.PhoneNumber { Number = number }; + + output.Write("Is this a mobile, home, or work phone? "); + String type = input.ReadLine(); + switch (type) + { + case "mobile": + phoneNumber.Type = Person.Types.PhoneType.Mobile; + break; + case "home": + phoneNumber.Type = Person.Types.PhoneType.Home; + break; + case "work": + phoneNumber.Type = Person.Types.PhoneType.Work; + break; + default: + output.Write("Unknown phone type. Using default."); + break; + } + + person.Phones.Add(phoneNumber); + } + return person; + } + + /// + /// Entry point - loads an existing addressbook or creates a new one, + /// then writes it back to the file. + /// + public static int Main(string[] args) + { + if (args.Length != 1) + { + Console.Error.WriteLine("Usage: AddPerson ADDRESS_BOOK_FILE"); + return -1; + } + + AddressBook addressBook; + + if (File.Exists(args[0])) + { + using (Stream file = File.OpenRead(args[0])) + { + addressBook = AddressBook.Parser.ParseFrom(file); + } + } + else + { + Console.WriteLine("{0}: File not found. Creating a new file.", args[0]); + addressBook = new AddressBook(); + } + + // Add an address. + addressBook.People.Add(PromptForAddress(Console.In, Console.Out)); + + // Write the new address book back to disk. + using (Stream output = File.OpenWrite(args[0])) + { + addressBook.WriteTo(output); + } + return 0; + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/AddressBook.csproj b/packager/third_party/protobuf/csharp/src/AddressBook/AddressBook.csproj index 021647fc8c..6edfdcabb3 100644 --- a/packager/third_party/protobuf/csharp/src/AddressBook/AddressBook.csproj +++ b/packager/third_party/protobuf/csharp/src/AddressBook/AddressBook.csproj @@ -1,75 +1,14 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {A31F5FB2-4FF3-432A-B35B-5CD203606311} + netcoreapp1.0 Exe - Properties - Google.Protobuf.Examples.AddressBook - AddressBook - v4.5 - 512 Google.Protobuf.Examples.AddressBook.Program - - - - - true - full - false - bin\Debug - obj\Debug\ - DEBUG;TRACE - prompt - 4 - true - Off - false - - - pdbonly - true - bin\Release - obj\Release\ - TRACE - prompt - 4 - true - Off - false + False + - - - - + - - - - - - - - - - - {6908BDCE-D925-43F3-94AC-A531E6DF2591} - Google.Protobuf - - - - - - - - \ No newline at end of file + + diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/Addressbook.cs b/packager/third_party/protobuf/csharp/src/AddressBook/Addressbook.cs index 362e1cb6a2..75ed071b74 100644 --- a/packager/third_party/protobuf/csharp/src/AddressBook/Addressbook.cs +++ b/packager/third_party/protobuf/csharp/src/AddressBook/Addressbook.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.Examples.AddressBook { /// Holder for reflection information generated from addressbook.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class AddressbookReflection { #region Descriptor @@ -44,27 +43,31 @@ namespace Google.Protobuf.Examples.AddressBook { } #region Messages /// - /// [START messages] + /// [START messages] /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Person : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Person()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Person() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Person(Person other) : this() { name_ = other.name_; id_ = other.id_; @@ -72,6 +75,7 @@ namespace Google.Protobuf.Examples.AddressBook { phones_ = other.phones_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Person Clone() { return new Person(this); } @@ -79,6 +83,7 @@ namespace Google.Protobuf.Examples.AddressBook { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -90,8 +95,9 @@ namespace Google.Protobuf.Examples.AddressBook { public const int IdFieldNumber = 2; private int id_; /// - /// Unique ID number for this person. + /// Unique ID number for this person. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Id { get { return id_; } set { @@ -102,6 +108,7 @@ namespace Google.Protobuf.Examples.AddressBook { /// Field number for the "email" field. public const int EmailFieldNumber = 3; private string email_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Email { get { return email_; } set { @@ -114,14 +121,17 @@ namespace Google.Protobuf.Examples.AddressBook { private static readonly pb::FieldCodec _repeated_phones_codec = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser); private readonly pbc::RepeatedField phones_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Phones { get { return phones_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Person); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Person other) { if (ReferenceEquals(other, null)) { return false; @@ -136,6 +146,7 @@ namespace Google.Protobuf.Examples.AddressBook { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -145,10 +156,12 @@ namespace Google.Protobuf.Examples.AddressBook { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -165,6 +178,7 @@ namespace Google.Protobuf.Examples.AddressBook { phones_.WriteTo(output, _repeated_phones_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -180,6 +194,7 @@ namespace Google.Protobuf.Examples.AddressBook { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Person other) { if (other == null) { return; @@ -196,6 +211,7 @@ namespace Google.Protobuf.Examples.AddressBook { phones_.Add(other.phones_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -225,7 +241,7 @@ namespace Google.Protobuf.Examples.AddressBook { #region Nested types /// Container for nested types declared in the Person message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { public enum PhoneType { [pbr::OriginalName("MOBILE")] Mobile = 0, @@ -233,30 +249,35 @@ namespace Google.Protobuf.Examples.AddressBook { [pbr::OriginalName("WORK")] Work = 2, } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class PhoneNumber : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PhoneNumber()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Examples.AddressBook.Person.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PhoneNumber() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PhoneNumber(PhoneNumber other) : this() { number_ = other.number_; type_ = other.type_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PhoneNumber Clone() { return new PhoneNumber(this); } @@ -264,6 +285,7 @@ namespace Google.Protobuf.Examples.AddressBook { /// Field number for the "number" field. public const int NumberFieldNumber = 1; private string number_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Number { get { return number_; } set { @@ -274,6 +296,7 @@ namespace Google.Protobuf.Examples.AddressBook { /// Field number for the "type" field. public const int TypeFieldNumber = 2; private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type { get { return type_; } set { @@ -281,10 +304,12 @@ namespace Google.Protobuf.Examples.AddressBook { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as PhoneNumber); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(PhoneNumber other) { if (ReferenceEquals(other, null)) { return false; @@ -297,6 +322,7 @@ namespace Google.Protobuf.Examples.AddressBook { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Number.Length != 0) hash ^= Number.GetHashCode(); @@ -304,10 +330,12 @@ namespace Google.Protobuf.Examples.AddressBook { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Number.Length != 0) { output.WriteRawTag(10); @@ -319,6 +347,7 @@ namespace Google.Protobuf.Examples.AddressBook { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Number.Length != 0) { @@ -330,6 +359,7 @@ namespace Google.Protobuf.Examples.AddressBook { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(PhoneNumber other) { if (other == null) { return; @@ -342,6 +372,7 @@ namespace Google.Protobuf.Examples.AddressBook { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -369,31 +400,36 @@ namespace Google.Protobuf.Examples.AddressBook { } /// - /// Our address book file is just one of these. + /// Our address book file is just one of these. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class AddressBook : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddressBook()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Examples.AddressBook.AddressbookReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AddressBook() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AddressBook(AddressBook other) : this() { people_ = other.people_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AddressBook Clone() { return new AddressBook(this); } @@ -403,14 +439,17 @@ namespace Google.Protobuf.Examples.AddressBook { private static readonly pb::FieldCodec _repeated_people_codec = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Examples.AddressBook.Person.Parser); private readonly pbc::RepeatedField people_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField People { get { return people_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as AddressBook); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(AddressBook other) { if (ReferenceEquals(other, null)) { return false; @@ -422,26 +461,31 @@ namespace Google.Protobuf.Examples.AddressBook { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= people_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { people_.WriteTo(output, _repeated_people_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += people_.CalculateSize(_repeated_people_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(AddressBook other) { if (other == null) { return; @@ -449,6 +493,7 @@ namespace Google.Protobuf.Examples.AddressBook { people_.Add(other.people_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/ListPeople.cs b/packager/third_party/protobuf/csharp/src/AddressBook/ListPeople.cs index 71572289d4..3758c1bce5 100644 --- a/packager/third_party/protobuf/csharp/src/AddressBook/ListPeople.cs +++ b/packager/third_party/protobuf/csharp/src/AddressBook/ListPeople.cs @@ -1,99 +1,99 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; - -namespace Google.Protobuf.Examples.AddressBook -{ - internal class ListPeople - { - /// - /// Iterates though all people in the AddressBook and prints info about them. - /// - private static void Print(AddressBook addressBook) - { - foreach (Person person in addressBook.People) - { - Console.WriteLine("Person ID: {0}", person.Id); - Console.WriteLine(" Name: {0}", person.Name); - if (person.Email != "") - { - Console.WriteLine(" E-mail address: {0}", person.Email); - } - - foreach (Person.Types.PhoneNumber phoneNumber in person.Phones) - { - switch (phoneNumber.Type) - { - case Person.Types.PhoneType.Mobile: - Console.Write(" Mobile phone #: "); - break; - case Person.Types.PhoneType.Home: - Console.Write(" Home phone #: "); - break; - case Person.Types.PhoneType.Work: - Console.Write(" Work phone #: "); - break; - } - Console.WriteLine(phoneNumber.Number); - } - } - } - - /// - /// Entry point - loads the addressbook and then displays it. - /// - public static int Main(string[] args) - { - if (args.Length != 1) - { - Console.Error.WriteLine("Usage: ListPeople ADDRESS_BOOK_FILE"); - return 1; - } - - if (!File.Exists(args[0])) - { - Console.WriteLine("{0} doesn't exist. Add a person to create the file first.", args[0]); - return 0; - } - - // Read the existing address book. - using (Stream stream = File.OpenRead(args[0])) - { - AddressBook addressBook = AddressBook.Parser.ParseFrom(stream); - Print(addressBook); - } - return 0; - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; + +namespace Google.Protobuf.Examples.AddressBook +{ + internal class ListPeople + { + /// + /// Iterates though all people in the AddressBook and prints info about them. + /// + private static void Print(AddressBook addressBook) + { + foreach (Person person in addressBook.People) + { + Console.WriteLine("Person ID: {0}", person.Id); + Console.WriteLine(" Name: {0}", person.Name); + if (person.Email != "") + { + Console.WriteLine(" E-mail address: {0}", person.Email); + } + + foreach (Person.Types.PhoneNumber phoneNumber in person.Phones) + { + switch (phoneNumber.Type) + { + case Person.Types.PhoneType.Mobile: + Console.Write(" Mobile phone #: "); + break; + case Person.Types.PhoneType.Home: + Console.Write(" Home phone #: "); + break; + case Person.Types.PhoneType.Work: + Console.Write(" Work phone #: "); + break; + } + Console.WriteLine(phoneNumber.Number); + } + } + } + + /// + /// Entry point - loads the addressbook and then displays it. + /// + public static int Main(string[] args) + { + if (args.Length != 1) + { + Console.Error.WriteLine("Usage: ListPeople ADDRESS_BOOK_FILE"); + return 1; + } + + if (!File.Exists(args[0])) + { + Console.WriteLine("{0} doesn't exist. Add a person to create the file first.", args[0]); + return 0; + } + + // Read the existing address book. + using (Stream stream = File.OpenRead(args[0])) + { + AddressBook addressBook = AddressBook.Parser.ParseFrom(stream); + Print(addressBook); + } + return 0; + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/Program.cs b/packager/third_party/protobuf/csharp/src/AddressBook/Program.cs index 8164f44179..ff7b9c085e 100644 --- a/packager/third_party/protobuf/csharp/src/AddressBook/Program.cs +++ b/packager/third_party/protobuf/csharp/src/AddressBook/Program.cs @@ -1,95 +1,95 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; - -namespace Google.Protobuf.Examples.AddressBook -{ - /// - /// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour - /// to individual actions. Each action has its own Main method, so that it can be used as an - /// invidual complete program. - /// - internal class Program - { - private static int Main(string[] args) - { - if (args.Length > 1) - { - Console.Error.WriteLine("Usage: AddressBook [file]"); - Console.Error.WriteLine("If the filename isn't specified, \"addressbook.data\" is used instead."); - return 1; - } - string addressBookFile = args.Length > 0 ? args[0] : "addressbook.data"; - - bool stopping = false; - while (!stopping) - { - Console.WriteLine("Options:"); - Console.WriteLine(" L: List contents"); - Console.WriteLine(" A: Add new person"); - Console.WriteLine(" Q: Quit"); - Console.Write("Action? "); - Console.Out.Flush(); - char choice = Console.ReadKey().KeyChar; - Console.WriteLine(); - try - { - switch (choice) - { - case 'A': - case 'a': - AddPerson.Main(new string[] {addressBookFile}); - break; - case 'L': - case 'l': - ListPeople.Main(new string[] {addressBookFile}); - break; - case 'Q': - case 'q': - stopping = true; - break; - default: - Console.WriteLine("Unknown option: {0}", choice); - break; - } - } - catch (Exception e) - { - Console.WriteLine("Exception executing action: {0}", e); - } - Console.WriteLine(); - } - return 0; - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; + +namespace Google.Protobuf.Examples.AddressBook +{ + /// + /// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour + /// to individual actions. Each action has its own Main method, so that it can be used as an + /// invidual complete program. + /// + internal class Program + { + private static int Main(string[] args) + { + if (args.Length > 1) + { + Console.Error.WriteLine("Usage: AddressBook [file]"); + Console.Error.WriteLine("If the filename isn't specified, \"addressbook.data\" is used instead."); + return 1; + } + string addressBookFile = args.Length > 0 ? args[0] : "addressbook.data"; + + bool stopping = false; + while (!stopping) + { + Console.WriteLine("Options:"); + Console.WriteLine(" L: List contents"); + Console.WriteLine(" A: Add new person"); + Console.WriteLine(" Q: Quit"); + Console.Write("Action? "); + Console.Out.Flush(); + char choice = Console.ReadKey().KeyChar; + Console.WriteLine(); + try + { + switch (choice) + { + case 'A': + case 'a': + AddPerson.Main(new string[] {addressBookFile}); + break; + case 'L': + case 'l': + ListPeople.Main(new string[] {addressBookFile}); + break; + case 'Q': + case 'q': + stopping = true; + break; + default: + Console.WriteLine("Unknown option: {0}", choice); + break; + } + } + catch (Exception e) + { + Console.WriteLine("Exception executing action: {0}", e); + } + Console.WriteLine(); + } + return 0; + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/Properties/AssemblyInfo.cs b/packager/third_party/protobuf/csharp/src/AddressBook/Properties/AssemblyInfo.cs deleted file mode 100644 index 1452f7a411..0000000000 --- a/packager/third_party/protobuf/csharp/src/AddressBook/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("AddressBook")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AddressBook")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/SampleUsage.cs b/packager/third_party/protobuf/csharp/src/AddressBook/SampleUsage.cs index aad7d70027..941d865aa4 100644 --- a/packager/third_party/protobuf/csharp/src/AddressBook/SampleUsage.cs +++ b/packager/third_party/protobuf/csharp/src/AddressBook/SampleUsage.cs @@ -1,73 +1,73 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; - -namespace Google.Protobuf.Examples.AddressBook -{ - internal class SampleUsage - { - private static void Main() - { - byte[] bytes; - // Create a new person - Person person = new Person - { - Id = 1, - Name = "Foo", - Email = "foo@bar", - Phones = { new Person.Types.PhoneNumber { Number = "555-1212" } } - }; - using (MemoryStream stream = new MemoryStream()) - { - // Save the person to a stream - person.WriteTo(stream); - bytes = stream.ToArray(); - } - Person copy = Person.Parser.ParseFrom(bytes); - - AddressBook book = new AddressBook - { - People = { copy } - }; - bytes = book.ToByteArray(); - // And read the address book back again - AddressBook restored = AddressBook.Parser.ParseFrom(bytes); - // The message performs a deep-comparison on equality: - if (restored.People.Count != 1 || !person.Equals(restored.People[0])) - { - throw new ApplicationException("There is a bad person in here!"); - } - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; + +namespace Google.Protobuf.Examples.AddressBook +{ + internal class SampleUsage + { + private static void Main() + { + byte[] bytes; + // Create a new person + Person person = new Person + { + Id = 1, + Name = "Foo", + Email = "foo@bar", + Phones = { new Person.Types.PhoneNumber { Number = "555-1212" } } + }; + using (MemoryStream stream = new MemoryStream()) + { + // Save the person to a stream + person.WriteTo(stream); + bytes = stream.ToArray(); + } + Person copy = Person.Parser.ParseFrom(bytes); + + AddressBook book = new AddressBook + { + People = { copy } + }; + bytes = book.ToByteArray(); + // And read the address book back again + AddressBook restored = AddressBook.Parser.ParseFrom(bytes); + // The message performs a deep-comparison on equality: + if (restored.People.Count != 1 || !person.Equals(restored.People[0])) + { + throw new Exception("There is a bad person in here!"); + } + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/AddressBook/app.config b/packager/third_party/protobuf/csharp/src/AddressBook/app.config deleted file mode 100644 index a80813afe3..0000000000 --- a/packager/third_party/protobuf/csharp/src/AddressBook/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/App.config b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/App.config deleted file mode 100644 index 8e15646352..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Conformance.cs index 1674a6734f..1a835aef02 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Conformance.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Conformance.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Conformance { /// Holder for reflection information generated from conformance.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class ConformanceReflection { #region Descriptor @@ -23,175 +22,22 @@ namespace Conformance { static ConformanceReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UaGWdvb2dsZS9wcm90", - "b2J1Zi9hbnkucHJvdG8aHmdvb2dsZS9wcm90b2J1Zi9kdXJhdGlvbi5wcm90", - "bxogZ29vZ2xlL3Byb3RvYnVmL2ZpZWxkX21hc2sucHJvdG8aHGdvb2dsZS9w", - "cm90b2J1Zi9zdHJ1Y3QucHJvdG8aH2dvb2dsZS9wcm90b2J1Zi90aW1lc3Rh", - "bXAucHJvdG8aHmdvb2dsZS9wcm90b2J1Zi93cmFwcGVycy5wcm90byKNAQoS", - "Q29uZm9ybWFuY2VSZXF1ZXN0EhoKEHByb3RvYnVmX3BheWxvYWQYASABKAxI", - "ABIWCgxqc29uX3BheWxvYWQYAiABKAlIABI4ChdyZXF1ZXN0ZWRfb3V0cHV0", - "X2Zvcm1hdBgDIAEoDjIXLmNvbmZvcm1hbmNlLldpcmVGb3JtYXRCCQoHcGF5", - "bG9hZCKxAQoTQ29uZm9ybWFuY2VSZXNwb25zZRIVCgtwYXJzZV9lcnJvchgB", - "IAEoCUgAEhkKD3NlcmlhbGl6ZV9lcnJvchgGIAEoCUgAEhcKDXJ1bnRpbWVf", - "ZXJyb3IYAiABKAlIABIaChBwcm90b2J1Zl9wYXlsb2FkGAMgASgMSAASFgoM", - "anNvbl9wYXlsb2FkGAQgASgJSAASEQoHc2tpcHBlZBgFIAEoCUgAQggKBnJl", - "c3VsdCLVMgoMVGVzdEFsbFR5cGVzEhYKDm9wdGlvbmFsX2ludDMyGAEgASgF", - "EhYKDm9wdGlvbmFsX2ludDY0GAIgASgDEhcKD29wdGlvbmFsX3VpbnQzMhgD", - "IAEoDRIXCg9vcHRpb25hbF91aW50NjQYBCABKAQSFwoPb3B0aW9uYWxfc2lu", - "dDMyGAUgASgREhcKD29wdGlvbmFsX3NpbnQ2NBgGIAEoEhIYChBvcHRpb25h", - "bF9maXhlZDMyGAcgASgHEhgKEG9wdGlvbmFsX2ZpeGVkNjQYCCABKAYSGQoR", - "b3B0aW9uYWxfc2ZpeGVkMzIYCSABKA8SGQoRb3B0aW9uYWxfc2ZpeGVkNjQY", - "CiABKBASFgoOb3B0aW9uYWxfZmxvYXQYCyABKAISFwoPb3B0aW9uYWxfZG91", - "YmxlGAwgASgBEhUKDW9wdGlvbmFsX2Jvb2wYDSABKAgSFwoPb3B0aW9uYWxf", - "c3RyaW5nGA4gASgJEhYKDm9wdGlvbmFsX2J5dGVzGA8gASgMEkgKF29wdGlv", - "bmFsX25lc3RlZF9tZXNzYWdlGBIgASgLMicuY29uZm9ybWFuY2UuVGVzdEFs", - "bFR5cGVzLk5lc3RlZE1lc3NhZ2USPQoYb3B0aW9uYWxfZm9yZWlnbl9tZXNz", - "YWdlGBMgASgLMhsuY29uZm9ybWFuY2UuRm9yZWlnbk1lc3NhZ2USQgoUb3B0", - "aW9uYWxfbmVzdGVkX2VudW0YFSABKA4yJC5jb25mb3JtYW5jZS5UZXN0QWxs", - "VHlwZXMuTmVzdGVkRW51bRI3ChVvcHRpb25hbF9mb3JlaWduX2VudW0YFiAB", - "KA4yGC5jb25mb3JtYW5jZS5Gb3JlaWduRW51bRIhChVvcHRpb25hbF9zdHJp", - "bmdfcGllY2UYGCABKAlCAggCEhkKDW9wdGlvbmFsX2NvcmQYGSABKAlCAggB", - "EjQKEXJlY3Vyc2l2ZV9tZXNzYWdlGBsgASgLMhkuY29uZm9ybWFuY2UuVGVz", - "dEFsbFR5cGVzEhYKDnJlcGVhdGVkX2ludDMyGB8gAygFEhYKDnJlcGVhdGVk", - "X2ludDY0GCAgAygDEhcKD3JlcGVhdGVkX3VpbnQzMhghIAMoDRIXCg9yZXBl", - "YXRlZF91aW50NjQYIiADKAQSFwoPcmVwZWF0ZWRfc2ludDMyGCMgAygREhcK", - "D3JlcGVhdGVkX3NpbnQ2NBgkIAMoEhIYChByZXBlYXRlZF9maXhlZDMyGCUg", - "AygHEhgKEHJlcGVhdGVkX2ZpeGVkNjQYJiADKAYSGQoRcmVwZWF0ZWRfc2Zp", - "eGVkMzIYJyADKA8SGQoRcmVwZWF0ZWRfc2ZpeGVkNjQYKCADKBASFgoOcmVw", - "ZWF0ZWRfZmxvYXQYKSADKAISFwoPcmVwZWF0ZWRfZG91YmxlGCogAygBEhUK", - "DXJlcGVhdGVkX2Jvb2wYKyADKAgSFwoPcmVwZWF0ZWRfc3RyaW5nGCwgAygJ", - "EhYKDnJlcGVhdGVkX2J5dGVzGC0gAygMEkgKF3JlcGVhdGVkX25lc3RlZF9t", - "ZXNzYWdlGDAgAygLMicuY29uZm9ybWFuY2UuVGVzdEFsbFR5cGVzLk5lc3Rl", - "ZE1lc3NhZ2USPQoYcmVwZWF0ZWRfZm9yZWlnbl9tZXNzYWdlGDEgAygLMhsu", - "Y29uZm9ybWFuY2UuRm9yZWlnbk1lc3NhZ2USQgoUcmVwZWF0ZWRfbmVzdGVk", - "X2VudW0YMyADKA4yJC5jb25mb3JtYW5jZS5UZXN0QWxsVHlwZXMuTmVzdGVk", - "RW51bRI3ChVyZXBlYXRlZF9mb3JlaWduX2VudW0YNCADKA4yGC5jb25mb3Jt", - "YW5jZS5Gb3JlaWduRW51bRIhChVyZXBlYXRlZF9zdHJpbmdfcGllY2UYNiAD", - "KAlCAggCEhkKDXJlcGVhdGVkX2NvcmQYNyADKAlCAggBEkUKD21hcF9pbnQz", - "Ml9pbnQzMhg4IAMoCzIsLmNvbmZvcm1hbmNlLlRlc3RBbGxUeXBlcy5NYXBJ", - "bnQzMkludDMyRW50cnkSRQoPbWFwX2ludDY0X2ludDY0GDkgAygLMiwuY29u", - "Zm9ybWFuY2UuVGVzdEFsbFR5cGVzLk1hcEludDY0SW50NjRFbnRyeRJJChFt", - "YXBfdWludDMyX3VpbnQzMhg6IAMoCzIuLmNvbmZvcm1hbmNlLlRlc3RBbGxU", - "eXBlcy5NYXBVaW50MzJVaW50MzJFbnRyeRJJChFtYXBfdWludDY0X3VpbnQ2", - "NBg7IAMoCzIuLmNvbmZvcm1hbmNlLlRlc3RBbGxUeXBlcy5NYXBVaW50NjRV", - "aW50NjRFbnRyeRJJChFtYXBfc2ludDMyX3NpbnQzMhg8IAMoCzIuLmNvbmZv", - "cm1hbmNlLlRlc3RBbGxUeXBlcy5NYXBTaW50MzJTaW50MzJFbnRyeRJJChFt", - "YXBfc2ludDY0X3NpbnQ2NBg9IAMoCzIuLmNvbmZvcm1hbmNlLlRlc3RBbGxU", - "eXBlcy5NYXBTaW50NjRTaW50NjRFbnRyeRJNChNtYXBfZml4ZWQzMl9maXhl", - "ZDMyGD4gAygLMjAuY29uZm9ybWFuY2UuVGVzdEFsbFR5cGVzLk1hcEZpeGVk", - "MzJGaXhlZDMyRW50cnkSTQoTbWFwX2ZpeGVkNjRfZml4ZWQ2NBg/IAMoCzIw", - "LmNvbmZvcm1hbmNlLlRlc3RBbGxUeXBlcy5NYXBGaXhlZDY0Rml4ZWQ2NEVu", - "dHJ5ElEKFW1hcF9zZml4ZWQzMl9zZml4ZWQzMhhAIAMoCzIyLmNvbmZvcm1h", - "bmNlLlRlc3RBbGxUeXBlcy5NYXBTZml4ZWQzMlNmaXhlZDMyRW50cnkSUQoV", - "bWFwX3NmaXhlZDY0X3NmaXhlZDY0GEEgAygLMjIuY29uZm9ybWFuY2UuVGVz", - "dEFsbFR5cGVzLk1hcFNmaXhlZDY0U2ZpeGVkNjRFbnRyeRJFCg9tYXBfaW50", - "MzJfZmxvYXQYQiADKAsyLC5jb25mb3JtYW5jZS5UZXN0QWxsVHlwZXMuTWFw", - "SW50MzJGbG9hdEVudHJ5EkcKEG1hcF9pbnQzMl9kb3VibGUYQyADKAsyLS5j", - "b25mb3JtYW5jZS5UZXN0QWxsVHlwZXMuTWFwSW50MzJEb3VibGVFbnRyeRJB", - "Cg1tYXBfYm9vbF9ib29sGEQgAygLMiouY29uZm9ybWFuY2UuVGVzdEFsbFR5", - "cGVzLk1hcEJvb2xCb29sRW50cnkSSQoRbWFwX3N0cmluZ19zdHJpbmcYRSAD", - "KAsyLi5jb25mb3JtYW5jZS5UZXN0QWxsVHlwZXMuTWFwU3RyaW5nU3RyaW5n", - "RW50cnkSRwoQbWFwX3N0cmluZ19ieXRlcxhGIAMoCzItLmNvbmZvcm1hbmNl", - "LlRlc3RBbGxUeXBlcy5NYXBTdHJpbmdCeXRlc0VudHJ5ElgKGW1hcF9zdHJp", - "bmdfbmVzdGVkX21lc3NhZ2UYRyADKAsyNS5jb25mb3JtYW5jZS5UZXN0QWxs", - "VHlwZXMuTWFwU3RyaW5nTmVzdGVkTWVzc2FnZUVudHJ5EloKGm1hcF9zdHJp", - "bmdfZm9yZWlnbl9tZXNzYWdlGEggAygLMjYuY29uZm9ybWFuY2UuVGVzdEFs", - "bFR5cGVzLk1hcFN0cmluZ0ZvcmVpZ25NZXNzYWdlRW50cnkSUgoWbWFwX3N0", - "cmluZ19uZXN0ZWRfZW51bRhJIAMoCzIyLmNvbmZvcm1hbmNlLlRlc3RBbGxU", - "eXBlcy5NYXBTdHJpbmdOZXN0ZWRFbnVtRW50cnkSVAoXbWFwX3N0cmluZ19m", - "b3JlaWduX2VudW0YSiADKAsyMy5jb25mb3JtYW5jZS5UZXN0QWxsVHlwZXMu", - "TWFwU3RyaW5nRm9yZWlnbkVudW1FbnRyeRIWCgxvbmVvZl91aW50MzIYbyAB", - "KA1IABJHChRvbmVvZl9uZXN0ZWRfbWVzc2FnZRhwIAEoCzInLmNvbmZvcm1h", - "bmNlLlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlSAASFgoMb25lb2Zfc3Ry", - "aW5nGHEgASgJSAASFQoLb25lb2ZfYnl0ZXMYciABKAxIABI6ChVvcHRpb25h", - "bF9ib29sX3dyYXBwZXIYyQEgASgLMhouZ29vZ2xlLnByb3RvYnVmLkJvb2xW", - "YWx1ZRI8ChZvcHRpb25hbF9pbnQzMl93cmFwcGVyGMoBIAEoCzIbLmdvb2ds", - "ZS5wcm90b2J1Zi5JbnQzMlZhbHVlEjwKFm9wdGlvbmFsX2ludDY0X3dyYXBw", - "ZXIYywEgASgLMhsuZ29vZ2xlLnByb3RvYnVmLkludDY0VmFsdWUSPgoXb3B0", - "aW9uYWxfdWludDMyX3dyYXBwZXIYzAEgASgLMhwuZ29vZ2xlLnByb3RvYnVm", - "LlVJbnQzMlZhbHVlEj4KF29wdGlvbmFsX3VpbnQ2NF93cmFwcGVyGM0BIAEo", - "CzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50NjRWYWx1ZRI8ChZvcHRpb25hbF9m", - "bG9hdF93cmFwcGVyGM4BIAEoCzIbLmdvb2dsZS5wcm90b2J1Zi5GbG9hdFZh", - "bHVlEj4KF29wdGlvbmFsX2RvdWJsZV93cmFwcGVyGM8BIAEoCzIcLmdvb2ds", - "ZS5wcm90b2J1Zi5Eb3VibGVWYWx1ZRI+ChdvcHRpb25hbF9zdHJpbmdfd3Jh", - "cHBlchjQASABKAsyHC5nb29nbGUucHJvdG9idWYuU3RyaW5nVmFsdWUSPAoW", - "b3B0aW9uYWxfYnl0ZXNfd3JhcHBlchjRASABKAsyGy5nb29nbGUucHJvdG9i", - "dWYuQnl0ZXNWYWx1ZRI6ChVyZXBlYXRlZF9ib29sX3dyYXBwZXIY0wEgAygL", - "MhouZ29vZ2xlLnByb3RvYnVmLkJvb2xWYWx1ZRI8ChZyZXBlYXRlZF9pbnQz", - "Ml93cmFwcGVyGNQBIAMoCzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQzMlZhbHVl", - "EjwKFnJlcGVhdGVkX2ludDY0X3dyYXBwZXIY1QEgAygLMhsuZ29vZ2xlLnBy", - "b3RvYnVmLkludDY0VmFsdWUSPgoXcmVwZWF0ZWRfdWludDMyX3dyYXBwZXIY", - "1gEgAygLMhwuZ29vZ2xlLnByb3RvYnVmLlVJbnQzMlZhbHVlEj4KF3JlcGVh", - "dGVkX3VpbnQ2NF93cmFwcGVyGNcBIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5V", - "SW50NjRWYWx1ZRI8ChZyZXBlYXRlZF9mbG9hdF93cmFwcGVyGNgBIAMoCzIb", - "Lmdvb2dsZS5wcm90b2J1Zi5GbG9hdFZhbHVlEj4KF3JlcGVhdGVkX2RvdWJs", - "ZV93cmFwcGVyGNkBIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5Eb3VibGVWYWx1", - "ZRI+ChdyZXBlYXRlZF9zdHJpbmdfd3JhcHBlchjaASADKAsyHC5nb29nbGUu", - "cHJvdG9idWYuU3RyaW5nVmFsdWUSPAoWcmVwZWF0ZWRfYnl0ZXNfd3JhcHBl", - "chjbASADKAsyGy5nb29nbGUucHJvdG9idWYuQnl0ZXNWYWx1ZRI1ChFvcHRp", - "b25hbF9kdXJhdGlvbhitAiABKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRp", - "b24SNwoSb3B0aW9uYWxfdGltZXN0YW1wGK4CIAEoCzIaLmdvb2dsZS5wcm90", - "b2J1Zi5UaW1lc3RhbXASOAoTb3B0aW9uYWxfZmllbGRfbWFzaxivAiABKAsy", - "Gi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrEjEKD29wdGlvbmFsX3N0cnVj", - "dBiwAiABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EisKDG9wdGlvbmFs", - "X2FueRixAiABKAsyFC5nb29nbGUucHJvdG9idWYuQW55Ei8KDm9wdGlvbmFs", - "X3ZhbHVlGLICIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZRI1ChFyZXBl", - "YXRlZF9kdXJhdGlvbhi3AiADKAsyGS5nb29nbGUucHJvdG9idWYuRHVyYXRp", - "b24SNwoScmVwZWF0ZWRfdGltZXN0YW1wGLgCIAMoCzIaLmdvb2dsZS5wcm90", - "b2J1Zi5UaW1lc3RhbXASNwoScmVwZWF0ZWRfZmllbGRtYXNrGLkCIAMoCzIa", - "Lmdvb2dsZS5wcm90b2J1Zi5GaWVsZE1hc2sSMQoPcmVwZWF0ZWRfc3RydWN0", - "GMQCIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5TdHJ1Y3QSKwoMcmVwZWF0ZWRf", - "YW55GLsCIAMoCzIULmdvb2dsZS5wcm90b2J1Zi5BbnkSLwoOcmVwZWF0ZWRf", - "dmFsdWUYvAIgAygLMhYuZ29vZ2xlLnByb3RvYnVmLlZhbHVlEhMKCmZpZWxk", - "bmFtZTEYkQMgASgFEhQKC2ZpZWxkX25hbWUyGJIDIAEoBRIVCgxfZmllbGRf", - "bmFtZTMYkwMgASgFEhYKDWZpZWxkX19uYW1lNF8YlAMgASgFEhQKC2ZpZWxk", - "MG5hbWU1GJUDIAEoBRIWCg1maWVsZF8wX25hbWU2GJYDIAEoBRITCgpmaWVs", - "ZE5hbWU3GJcDIAEoBRITCgpGaWVsZE5hbWU4GJgDIAEoBRIUCgtmaWVsZF9O", - "YW1lORiZAyABKAUSFQoMRmllbGRfTmFtZTEwGJoDIAEoBRIVCgxGSUVMRF9O", - "QU1FMTEYmwMgASgFEhUKDEZJRUxEX25hbWUxMhicAyABKAUaSgoNTmVzdGVk", - "TWVzc2FnZRIJCgFhGAEgASgFEi4KC2NvcmVjdXJzaXZlGAIgASgLMhkuY29u", - "Zm9ybWFuY2UuVGVzdEFsbFR5cGVzGjQKEk1hcEludDMySW50MzJFbnRyeRIL", - "CgNrZXkYASABKAUSDQoFdmFsdWUYAiABKAU6AjgBGjQKEk1hcEludDY0SW50", - "NjRFbnRyeRILCgNrZXkYASABKAMSDQoFdmFsdWUYAiABKAM6AjgBGjYKFE1h", - "cFVpbnQzMlVpbnQzMkVudHJ5EgsKA2tleRgBIAEoDRINCgV2YWx1ZRgCIAEo", - "DToCOAEaNgoUTWFwVWludDY0VWludDY0RW50cnkSCwoDa2V5GAEgASgEEg0K", - "BXZhbHVlGAIgASgEOgI4ARo2ChRNYXBTaW50MzJTaW50MzJFbnRyeRILCgNr", - "ZXkYASABKBESDQoFdmFsdWUYAiABKBE6AjgBGjYKFE1hcFNpbnQ2NFNpbnQ2", - "NEVudHJ5EgsKA2tleRgBIAEoEhINCgV2YWx1ZRgCIAEoEjoCOAEaOAoWTWFw", - "Rml4ZWQzMkZpeGVkMzJFbnRyeRILCgNrZXkYASABKAcSDQoFdmFsdWUYAiAB", - "KAc6AjgBGjgKFk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSCwoDa2V5GAEgASgG", - "Eg0KBXZhbHVlGAIgASgGOgI4ARo6ChhNYXBTZml4ZWQzMlNmaXhlZDMyRW50", - "cnkSCwoDa2V5GAEgASgPEg0KBXZhbHVlGAIgASgPOgI4ARo6ChhNYXBTZml4", - "ZWQ2NFNmaXhlZDY0RW50cnkSCwoDa2V5GAEgASgQEg0KBXZhbHVlGAIgASgQ", - "OgI4ARo0ChJNYXBJbnQzMkZsb2F0RW50cnkSCwoDa2V5GAEgASgFEg0KBXZh", - "bHVlGAIgASgCOgI4ARo1ChNNYXBJbnQzMkRvdWJsZUVudHJ5EgsKA2tleRgB", - "IAEoBRINCgV2YWx1ZRgCIAEoAToCOAEaMgoQTWFwQm9vbEJvb2xFbnRyeRIL", - "CgNrZXkYASABKAgSDQoFdmFsdWUYAiABKAg6AjgBGjYKFE1hcFN0cmluZ1N0", - "cmluZ0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAEaNQoT", - "TWFwU3RyaW5nQnl0ZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiAB", - "KAw6AjgBGmYKG01hcFN0cmluZ05lc3RlZE1lc3NhZ2VFbnRyeRILCgNrZXkY", - "ASABKAkSNgoFdmFsdWUYAiABKAsyJy5jb25mb3JtYW5jZS5UZXN0QWxsVHlw", - "ZXMuTmVzdGVkTWVzc2FnZToCOAEaWwocTWFwU3RyaW5nRm9yZWlnbk1lc3Nh", - "Z2VFbnRyeRILCgNrZXkYASABKAkSKgoFdmFsdWUYAiABKAsyGy5jb25mb3Jt", - "YW5jZS5Gb3JlaWduTWVzc2FnZToCOAEaYAoYTWFwU3RyaW5nTmVzdGVkRW51", - "bUVudHJ5EgsKA2tleRgBIAEoCRIzCgV2YWx1ZRgCIAEoDjIkLmNvbmZvcm1h", - "bmNlLlRlc3RBbGxUeXBlcy5OZXN0ZWRFbnVtOgI4ARpVChlNYXBTdHJpbmdG", - "b3JlaWduRW51bUVudHJ5EgsKA2tleRgBIAEoCRInCgV2YWx1ZRgCIAEoDjIY", - "LmNvbmZvcm1hbmNlLkZvcmVpZ25FbnVtOgI4ASI5CgpOZXN0ZWRFbnVtEgcK", - "A0ZPTxAAEgcKA0JBUhABEgcKA0JBWhACEhAKA05FRxD///////////8BQg0K", - "C29uZW9mX2ZpZWxkIhsKDkZvcmVpZ25NZXNzYWdlEgkKAWMYASABKAUqNQoK", + "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UijQEKEkNvbmZvcm1h", + "bmNlUmVxdWVzdBIaChBwcm90b2J1Zl9wYXlsb2FkGAEgASgMSAASFgoManNv", + "bl9wYXlsb2FkGAIgASgJSAASOAoXcmVxdWVzdGVkX291dHB1dF9mb3JtYXQY", + "AyABKA4yFy5jb25mb3JtYW5jZS5XaXJlRm9ybWF0QgkKB3BheWxvYWQisQEK", + "E0NvbmZvcm1hbmNlUmVzcG9uc2USFQoLcGFyc2VfZXJyb3IYASABKAlIABIZ", + "Cg9zZXJpYWxpemVfZXJyb3IYBiABKAlIABIXCg1ydW50aW1lX2Vycm9yGAIg", + "ASgJSAASGgoQcHJvdG9idWZfcGF5bG9hZBgDIAEoDEgAEhYKDGpzb25fcGF5", + "bG9hZBgEIAEoCUgAEhEKB3NraXBwZWQYBSABKAlIAEIICgZyZXN1bHQqNQoK", "V2lyZUZvcm1hdBIPCgtVTlNQRUNJRklFRBAAEgwKCFBST1RPQlVGEAESCAoE", - "SlNPThACKkAKC0ZvcmVpZ25FbnVtEg8KC0ZPUkVJR05fRk9PEAASDwoLRk9S", - "RUlHTl9CQVIQARIPCgtGT1JFSUdOX0JBWhACQiEKH2NvbS5nb29nbGUucHJv", - "dG9idWYuY29uZm9ybWFuY2ViBnByb3RvMw==")); + "SlNPThACQiEKH2NvbS5nb29nbGUucHJvdG9idWYuY29uZm9ybWFuY2ViBnBy", + "b3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), }, 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::GeneratedClrTypeInfo(typeof(global::Conformance.ForeignMessage), global::Conformance.ForeignMessage.Parser, new[]{ "C" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped" }, new[]{ "Result" }, null, null) })); } #endregion @@ -204,41 +50,39 @@ namespace Conformance { [pbr::OriginalName("JSON")] Json = 2, } - public enum ForeignEnum { - [pbr::OriginalName("FOREIGN_FOO")] ForeignFoo = 0, - [pbr::OriginalName("FOREIGN_BAR")] ForeignBar = 1, - [pbr::OriginalName("FOREIGN_BAZ")] ForeignBaz = 2, - } - #endregion #region Messages /// - /// Represents a single test case's input. The testee should: + /// Represents a single test case's input. The testee should: /// - /// 1. parse this proto (which should always succeed) - /// 2. parse the protobuf or JSON payload in "payload" (which may fail) - /// 3. if the parse succeeded, serialize the message in the requested format. + /// 1. parse this proto (which should always succeed) + /// 2. parse the protobuf or JSON payload in "payload" (which may fail) + /// 3. if the parse succeeded, serialize the message in the requested format. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ConformanceRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ConformanceRequest() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ConformanceRequest(ConformanceRequest other) : this() { requestedOutputFormat_ = other.requestedOutputFormat_; switch (other.PayloadCase) { @@ -252,12 +96,14 @@ namespace Conformance { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ConformanceRequest Clone() { return new ConformanceRequest(this); } /// Field number for the "protobuf_payload" field. public const int ProtobufPayloadFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString ProtobufPayload { get { return payloadCase_ == PayloadOneofCase.ProtobufPayload ? (pb::ByteString) payload_ : pb::ByteString.Empty; } set { @@ -268,6 +114,7 @@ namespace Conformance { /// Field number for the "json_payload" field. public const int JsonPayloadFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonPayload { get { return payloadCase_ == PayloadOneofCase.JsonPayload ? (string) payload_ : ""; } set { @@ -280,8 +127,9 @@ namespace Conformance { public const int RequestedOutputFormatFieldNumber = 3; private global::Conformance.WireFormat requestedOutputFormat_ = 0; /// - /// Which format should the testee serialize its message to? + /// Which format should the testee serialize its message to? /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Conformance.WireFormat RequestedOutputFormat { get { return requestedOutputFormat_; } set { @@ -297,19 +145,23 @@ namespace Conformance { JsonPayload = 2, } private PayloadOneofCase payloadCase_ = PayloadOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PayloadOneofCase PayloadCase { get { return payloadCase_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearPayload() { payloadCase_ = PayloadOneofCase.None; payload_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ConformanceRequest); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ConformanceRequest other) { if (ReferenceEquals(other, null)) { return false; @@ -324,6 +176,7 @@ namespace Conformance { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (payloadCase_ == PayloadOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode(); @@ -333,10 +186,12 @@ namespace Conformance { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { output.WriteRawTag(10); @@ -352,6 +207,7 @@ namespace Conformance { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (payloadCase_ == PayloadOneofCase.ProtobufPayload) { @@ -366,6 +222,7 @@ namespace Conformance { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ConformanceRequest other) { if (other == null) { return; @@ -384,6 +241,7 @@ namespace Conformance { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -410,27 +268,31 @@ namespace Conformance { } /// - /// Represents a single test case's output. + /// Represents a single test case's output. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ConformanceResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ConformanceResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ConformanceResponse() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ConformanceResponse(ConformanceResponse other) : this() { switch (other.ResultCase) { case ResultOneofCase.ParseError: @@ -455,6 +317,7 @@ namespace Conformance { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ConformanceResponse Clone() { return new ConformanceResponse(this); } @@ -462,12 +325,13 @@ namespace Conformance { /// Field number for the "parse_error" field. public const int ParseErrorFieldNumber = 1; /// - /// This string should be set to indicate parsing failed. The string can - /// provide more information about the parse error if it is available. + /// This string should be set to indicate parsing failed. The string can + /// provide more information about the parse error if it is available. /// - /// Setting this string does not necessarily mean the testee failed the - /// test. Some of the test cases are intentionally invalid input. + /// Setting this string does not necessarily mean the testee failed the + /// test. Some of the test cases are intentionally invalid input. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ParseError { get { return resultCase_ == ResultOneofCase.ParseError ? (string) result_ : ""; } set { @@ -479,10 +343,11 @@ namespace Conformance { /// Field number for the "serialize_error" field. public const int SerializeErrorFieldNumber = 6; /// - /// If the input was successfully parsed but errors occurred when - /// serializing it to the requested output format, set the error message in - /// this field. + /// If the input was successfully parsed but errors occurred when + /// serializing it to the requested output format, set the error message in + /// this field. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SerializeError { get { return resultCase_ == ResultOneofCase.SerializeError ? (string) result_ : ""; } set { @@ -494,10 +359,11 @@ namespace Conformance { /// Field number for the "runtime_error" field. public const int RuntimeErrorFieldNumber = 2; /// - /// This should be set if some other error occurred. This will always - /// indicate that the test failed. The string can provide more information - /// about the failure. + /// This should be set if some other error occurred. This will always + /// indicate that the test failed. The string can provide more information + /// about the failure. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string RuntimeError { get { return resultCase_ == ResultOneofCase.RuntimeError ? (string) result_ : ""; } set { @@ -509,9 +375,10 @@ namespace Conformance { /// Field number for the "protobuf_payload" field. public const int ProtobufPayloadFieldNumber = 3; /// - /// If the input was successfully parsed and the requested output was - /// protobuf, serialize it to protobuf and set it in this field. + /// If the input was successfully parsed and the requested output was + /// protobuf, serialize it to protobuf and set it in this field. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString ProtobufPayload { get { return resultCase_ == ResultOneofCase.ProtobufPayload ? (pb::ByteString) result_ : pb::ByteString.Empty; } set { @@ -523,9 +390,10 @@ namespace Conformance { /// Field number for the "json_payload" field. public const int JsonPayloadFieldNumber = 4; /// - /// If the input was successfully parsed and the requested output was JSON, - /// serialize to JSON and set it in this field. + /// If the input was successfully parsed and the requested output was JSON, + /// serialize to JSON and set it in this field. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonPayload { get { return resultCase_ == ResultOneofCase.JsonPayload ? (string) result_ : ""; } set { @@ -537,9 +405,10 @@ namespace Conformance { /// Field number for the "skipped" field. public const int SkippedFieldNumber = 5; /// - /// For when the testee skipped the test, likely because a certain feature - /// wasn't supported, like JSON input/output. + /// For when the testee skipped the test, likely because a certain feature + /// wasn't supported, like JSON input/output. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Skipped { get { return resultCase_ == ResultOneofCase.Skipped ? (string) result_ : ""; } set { @@ -560,19 +429,23 @@ namespace Conformance { Skipped = 5, } private ResultOneofCase resultCase_ = ResultOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ResultOneofCase ResultCase { get { return resultCase_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearResult() { resultCase_ = ResultOneofCase.None; result_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ConformanceResponse); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ConformanceResponse other) { if (ReferenceEquals(other, null)) { return false; @@ -590,6 +463,7 @@ namespace Conformance { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (resultCase_ == ResultOneofCase.ParseError) hash ^= ParseError.GetHashCode(); @@ -602,10 +476,12 @@ namespace Conformance { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (resultCase_ == ResultOneofCase.ParseError) { output.WriteRawTag(10); @@ -633,6 +509,7 @@ namespace Conformance { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (resultCase_ == ResultOneofCase.ParseError) { @@ -656,6 +533,7 @@ namespace Conformance { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ConformanceResponse other) { if (other == null) { return; @@ -683,6 +561,7 @@ namespace Conformance { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -720,2987 +599,6 @@ namespace Conformance { } - /// - /// This proto includes every type of field in both singular and repeated - /// forms. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestAllTypes : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAllTypes()); - public static pb::MessageParser Parser { get { return _parser; } } - - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[2]; } - } - - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - public TestAllTypes() { - OnConstruction(); - } - - partial void OnConstruction(); - - public TestAllTypes(TestAllTypes other) : this() { - optionalInt32_ = other.optionalInt32_; - optionalInt64_ = other.optionalInt64_; - optionalUint32_ = other.optionalUint32_; - optionalUint64_ = other.optionalUint64_; - optionalSint32_ = other.optionalSint32_; - optionalSint64_ = other.optionalSint64_; - optionalFixed32_ = other.optionalFixed32_; - optionalFixed64_ = other.optionalFixed64_; - optionalSfixed32_ = other.optionalSfixed32_; - optionalSfixed64_ = other.optionalSfixed64_; - optionalFloat_ = other.optionalFloat_; - optionalDouble_ = other.optionalDouble_; - optionalBool_ = other.optionalBool_; - optionalString_ = other.optionalString_; - optionalBytes_ = other.optionalBytes_; - OptionalNestedMessage = other.optionalNestedMessage_ != null ? other.OptionalNestedMessage.Clone() : null; - OptionalForeignMessage = other.optionalForeignMessage_ != null ? other.OptionalForeignMessage.Clone() : null; - optionalNestedEnum_ = other.optionalNestedEnum_; - optionalForeignEnum_ = other.optionalForeignEnum_; - optionalStringPiece_ = other.optionalStringPiece_; - optionalCord_ = other.optionalCord_; - RecursiveMessage = other.recursiveMessage_ != null ? other.RecursiveMessage.Clone() : null; - repeatedInt32_ = other.repeatedInt32_.Clone(); - repeatedInt64_ = other.repeatedInt64_.Clone(); - repeatedUint32_ = other.repeatedUint32_.Clone(); - repeatedUint64_ = other.repeatedUint64_.Clone(); - repeatedSint32_ = other.repeatedSint32_.Clone(); - repeatedSint64_ = other.repeatedSint64_.Clone(); - repeatedFixed32_ = other.repeatedFixed32_.Clone(); - repeatedFixed64_ = other.repeatedFixed64_.Clone(); - repeatedSfixed32_ = other.repeatedSfixed32_.Clone(); - repeatedSfixed64_ = other.repeatedSfixed64_.Clone(); - repeatedFloat_ = other.repeatedFloat_.Clone(); - repeatedDouble_ = other.repeatedDouble_.Clone(); - repeatedBool_ = other.repeatedBool_.Clone(); - repeatedString_ = other.repeatedString_.Clone(); - repeatedBytes_ = other.repeatedBytes_.Clone(); - repeatedNestedMessage_ = other.repeatedNestedMessage_.Clone(); - repeatedForeignMessage_ = other.repeatedForeignMessage_.Clone(); - repeatedNestedEnum_ = other.repeatedNestedEnum_.Clone(); - repeatedForeignEnum_ = other.repeatedForeignEnum_.Clone(); - repeatedStringPiece_ = other.repeatedStringPiece_.Clone(); - repeatedCord_ = other.repeatedCord_.Clone(); - mapInt32Int32_ = other.mapInt32Int32_.Clone(); - mapInt64Int64_ = other.mapInt64Int64_.Clone(); - mapUint32Uint32_ = other.mapUint32Uint32_.Clone(); - mapUint64Uint64_ = other.mapUint64Uint64_.Clone(); - mapSint32Sint32_ = other.mapSint32Sint32_.Clone(); - mapSint64Sint64_ = other.mapSint64Sint64_.Clone(); - mapFixed32Fixed32_ = other.mapFixed32Fixed32_.Clone(); - mapFixed64Fixed64_ = other.mapFixed64Fixed64_.Clone(); - mapSfixed32Sfixed32_ = other.mapSfixed32Sfixed32_.Clone(); - mapSfixed64Sfixed64_ = other.mapSfixed64Sfixed64_.Clone(); - mapInt32Float_ = other.mapInt32Float_.Clone(); - mapInt32Double_ = other.mapInt32Double_.Clone(); - mapBoolBool_ = other.mapBoolBool_.Clone(); - mapStringString_ = other.mapStringString_.Clone(); - mapStringBytes_ = other.mapStringBytes_.Clone(); - mapStringNestedMessage_ = other.mapStringNestedMessage_.Clone(); - mapStringForeignMessage_ = other.mapStringForeignMessage_.Clone(); - mapStringNestedEnum_ = other.mapStringNestedEnum_.Clone(); - mapStringForeignEnum_ = other.mapStringForeignEnum_.Clone(); - OptionalBoolWrapper = other.OptionalBoolWrapper; - OptionalInt32Wrapper = other.OptionalInt32Wrapper; - OptionalInt64Wrapper = other.OptionalInt64Wrapper; - OptionalUint32Wrapper = other.OptionalUint32Wrapper; - OptionalUint64Wrapper = other.OptionalUint64Wrapper; - OptionalFloatWrapper = other.OptionalFloatWrapper; - OptionalDoubleWrapper = other.OptionalDoubleWrapper; - OptionalStringWrapper = other.OptionalStringWrapper; - OptionalBytesWrapper = other.OptionalBytesWrapper; - repeatedBoolWrapper_ = other.repeatedBoolWrapper_.Clone(); - repeatedInt32Wrapper_ = other.repeatedInt32Wrapper_.Clone(); - repeatedInt64Wrapper_ = other.repeatedInt64Wrapper_.Clone(); - repeatedUint32Wrapper_ = other.repeatedUint32Wrapper_.Clone(); - repeatedUint64Wrapper_ = other.repeatedUint64Wrapper_.Clone(); - repeatedFloatWrapper_ = other.repeatedFloatWrapper_.Clone(); - repeatedDoubleWrapper_ = other.repeatedDoubleWrapper_.Clone(); - repeatedStringWrapper_ = other.repeatedStringWrapper_.Clone(); - repeatedBytesWrapper_ = other.repeatedBytesWrapper_.Clone(); - OptionalDuration = other.optionalDuration_ != null ? other.OptionalDuration.Clone() : null; - OptionalTimestamp = other.optionalTimestamp_ != null ? other.OptionalTimestamp.Clone() : null; - OptionalFieldMask = other.optionalFieldMask_ != null ? other.OptionalFieldMask.Clone() : null; - OptionalStruct = other.optionalStruct_ != null ? other.OptionalStruct.Clone() : null; - OptionalAny = other.optionalAny_ != null ? other.OptionalAny.Clone() : null; - OptionalValue = other.optionalValue_ != null ? other.OptionalValue.Clone() : null; - repeatedDuration_ = other.repeatedDuration_.Clone(); - repeatedTimestamp_ = other.repeatedTimestamp_.Clone(); - repeatedFieldmask_ = other.repeatedFieldmask_.Clone(); - repeatedStruct_ = other.repeatedStruct_.Clone(); - repeatedAny_ = other.repeatedAny_.Clone(); - repeatedValue_ = other.repeatedValue_.Clone(); - fieldname1_ = other.fieldname1_; - fieldName2_ = other.fieldName2_; - FieldName3_ = other.FieldName3_; - fieldName4_ = other.fieldName4_; - field0Name5_ = other.field0Name5_; - field0Name6_ = other.field0Name6_; - fieldName7_ = other.fieldName7_; - fieldName8_ = other.fieldName8_; - fieldName9_ = other.fieldName9_; - fieldName10_ = other.fieldName10_; - fIELDNAME11_ = other.fIELDNAME11_; - fIELDName12_ = other.fIELDName12_; - switch (other.OneofFieldCase) { - case OneofFieldOneofCase.OneofUint32: - OneofUint32 = other.OneofUint32; - break; - case OneofFieldOneofCase.OneofNestedMessage: - OneofNestedMessage = other.OneofNestedMessage.Clone(); - break; - case OneofFieldOneofCase.OneofString: - OneofString = other.OneofString; - break; - case OneofFieldOneofCase.OneofBytes: - OneofBytes = other.OneofBytes; - break; - } - - } - - public TestAllTypes Clone() { - return new TestAllTypes(this); - } - - /// Field number for the "optional_int32" field. - public const int OptionalInt32FieldNumber = 1; - private int optionalInt32_; - /// - /// Singular - /// - public int OptionalInt32 { - get { return optionalInt32_; } - set { - optionalInt32_ = value; - } - } - - /// Field number for the "optional_int64" field. - public const int OptionalInt64FieldNumber = 2; - private long optionalInt64_; - public long OptionalInt64 { - get { return optionalInt64_; } - set { - optionalInt64_ = value; - } - } - - /// Field number for the "optional_uint32" field. - public const int OptionalUint32FieldNumber = 3; - private uint optionalUint32_; - public uint OptionalUint32 { - get { return optionalUint32_; } - set { - optionalUint32_ = value; - } - } - - /// Field number for the "optional_uint64" field. - public const int OptionalUint64FieldNumber = 4; - private ulong optionalUint64_; - public ulong OptionalUint64 { - get { return optionalUint64_; } - set { - optionalUint64_ = value; - } - } - - /// Field number for the "optional_sint32" field. - public const int OptionalSint32FieldNumber = 5; - private int optionalSint32_; - public int OptionalSint32 { - get { return optionalSint32_; } - set { - optionalSint32_ = value; - } - } - - /// Field number for the "optional_sint64" field. - public const int OptionalSint64FieldNumber = 6; - private long optionalSint64_; - public long OptionalSint64 { - get { return optionalSint64_; } - set { - optionalSint64_ = value; - } - } - - /// Field number for the "optional_fixed32" field. - public const int OptionalFixed32FieldNumber = 7; - private uint optionalFixed32_; - public uint OptionalFixed32 { - get { return optionalFixed32_; } - set { - optionalFixed32_ = value; - } - } - - /// Field number for the "optional_fixed64" field. - public const int OptionalFixed64FieldNumber = 8; - private ulong optionalFixed64_; - public ulong OptionalFixed64 { - get { return optionalFixed64_; } - set { - optionalFixed64_ = value; - } - } - - /// Field number for the "optional_sfixed32" field. - public const int OptionalSfixed32FieldNumber = 9; - private int optionalSfixed32_; - public int OptionalSfixed32 { - get { return optionalSfixed32_; } - set { - optionalSfixed32_ = value; - } - } - - /// Field number for the "optional_sfixed64" field. - public const int OptionalSfixed64FieldNumber = 10; - private long optionalSfixed64_; - public long OptionalSfixed64 { - get { return optionalSfixed64_; } - set { - optionalSfixed64_ = value; - } - } - - /// Field number for the "optional_float" field. - public const int OptionalFloatFieldNumber = 11; - private float optionalFloat_; - public float OptionalFloat { - get { return optionalFloat_; } - set { - optionalFloat_ = value; - } - } - - /// Field number for the "optional_double" field. - public const int OptionalDoubleFieldNumber = 12; - private double optionalDouble_; - public double OptionalDouble { - get { return optionalDouble_; } - set { - optionalDouble_ = value; - } - } - - /// Field number for the "optional_bool" field. - public const int OptionalBoolFieldNumber = 13; - private bool optionalBool_; - public bool OptionalBool { - get { return optionalBool_; } - set { - optionalBool_ = value; - } - } - - /// Field number for the "optional_string" field. - public const int OptionalStringFieldNumber = 14; - private string optionalString_ = ""; - public string OptionalString { - get { return optionalString_; } - set { - optionalString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "optional_bytes" field. - public const int OptionalBytesFieldNumber = 15; - private pb::ByteString optionalBytes_ = pb::ByteString.Empty; - public pb::ByteString OptionalBytes { - get { return optionalBytes_; } - set { - optionalBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "optional_nested_message" field. - public const int OptionalNestedMessageFieldNumber = 18; - private global::Conformance.TestAllTypes.Types.NestedMessage optionalNestedMessage_; - public global::Conformance.TestAllTypes.Types.NestedMessage OptionalNestedMessage { - get { return optionalNestedMessage_; } - set { - optionalNestedMessage_ = value; - } - } - - /// Field number for the "optional_foreign_message" field. - public const int OptionalForeignMessageFieldNumber = 19; - private global::Conformance.ForeignMessage optionalForeignMessage_; - public global::Conformance.ForeignMessage OptionalForeignMessage { - get { return optionalForeignMessage_; } - set { - optionalForeignMessage_ = value; - } - } - - /// Field number for the "optional_nested_enum" field. - public const int OptionalNestedEnumFieldNumber = 21; - private global::Conformance.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = 0; - public global::Conformance.TestAllTypes.Types.NestedEnum OptionalNestedEnum { - get { return optionalNestedEnum_; } - set { - optionalNestedEnum_ = value; - } - } - - /// Field number for the "optional_foreign_enum" field. - public const int OptionalForeignEnumFieldNumber = 22; - private global::Conformance.ForeignEnum optionalForeignEnum_ = 0; - public global::Conformance.ForeignEnum OptionalForeignEnum { - get { return optionalForeignEnum_; } - set { - optionalForeignEnum_ = value; - } - } - - /// Field number for the "optional_string_piece" field. - public const int OptionalStringPieceFieldNumber = 24; - private string optionalStringPiece_ = ""; - public string OptionalStringPiece { - get { return optionalStringPiece_; } - set { - optionalStringPiece_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "optional_cord" field. - public const int OptionalCordFieldNumber = 25; - private string optionalCord_ = ""; - public string OptionalCord { - get { return optionalCord_; } - set { - optionalCord_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "recursive_message" field. - public const int RecursiveMessageFieldNumber = 27; - private global::Conformance.TestAllTypes recursiveMessage_; - public global::Conformance.TestAllTypes RecursiveMessage { - get { return recursiveMessage_; } - set { - recursiveMessage_ = value; - } - } - - /// Field number for the "repeated_int32" field. - public const int RepeatedInt32FieldNumber = 31; - private static readonly pb::FieldCodec _repeated_repeatedInt32_codec - = pb::FieldCodec.ForInt32(250); - private readonly pbc::RepeatedField repeatedInt32_ = new pbc::RepeatedField(); - /// - /// Repeated - /// - public pbc::RepeatedField RepeatedInt32 { - get { return repeatedInt32_; } - } - - /// Field number for the "repeated_int64" field. - public const int RepeatedInt64FieldNumber = 32; - private static readonly pb::FieldCodec _repeated_repeatedInt64_codec - = pb::FieldCodec.ForInt64(258); - private readonly pbc::RepeatedField repeatedInt64_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedInt64 { - get { return repeatedInt64_; } - } - - /// Field number for the "repeated_uint32" field. - public const int RepeatedUint32FieldNumber = 33; - private static readonly pb::FieldCodec _repeated_repeatedUint32_codec - = pb::FieldCodec.ForUInt32(266); - private readonly pbc::RepeatedField repeatedUint32_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedUint32 { - get { return repeatedUint32_; } - } - - /// Field number for the "repeated_uint64" field. - public const int RepeatedUint64FieldNumber = 34; - private static readonly pb::FieldCodec _repeated_repeatedUint64_codec - = pb::FieldCodec.ForUInt64(274); - private readonly pbc::RepeatedField repeatedUint64_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedUint64 { - get { return repeatedUint64_; } - } - - /// Field number for the "repeated_sint32" field. - public const int RepeatedSint32FieldNumber = 35; - private static readonly pb::FieldCodec _repeated_repeatedSint32_codec - = pb::FieldCodec.ForSInt32(282); - private readonly pbc::RepeatedField repeatedSint32_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedSint32 { - get { return repeatedSint32_; } - } - - /// Field number for the "repeated_sint64" field. - public const int RepeatedSint64FieldNumber = 36; - private static readonly pb::FieldCodec _repeated_repeatedSint64_codec - = pb::FieldCodec.ForSInt64(290); - private readonly pbc::RepeatedField repeatedSint64_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedSint64 { - get { return repeatedSint64_; } - } - - /// Field number for the "repeated_fixed32" field. - public const int RepeatedFixed32FieldNumber = 37; - private static readonly pb::FieldCodec _repeated_repeatedFixed32_codec - = pb::FieldCodec.ForFixed32(298); - private readonly pbc::RepeatedField repeatedFixed32_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedFixed32 { - get { return repeatedFixed32_; } - } - - /// Field number for the "repeated_fixed64" field. - public const int RepeatedFixed64FieldNumber = 38; - private static readonly pb::FieldCodec _repeated_repeatedFixed64_codec - = pb::FieldCodec.ForFixed64(306); - private readonly pbc::RepeatedField repeatedFixed64_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedFixed64 { - get { return repeatedFixed64_; } - } - - /// Field number for the "repeated_sfixed32" field. - public const int RepeatedSfixed32FieldNumber = 39; - private static readonly pb::FieldCodec _repeated_repeatedSfixed32_codec - = pb::FieldCodec.ForSFixed32(314); - private readonly pbc::RepeatedField repeatedSfixed32_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedSfixed32 { - get { return repeatedSfixed32_; } - } - - /// Field number for the "repeated_sfixed64" field. - public const int RepeatedSfixed64FieldNumber = 40; - private static readonly pb::FieldCodec _repeated_repeatedSfixed64_codec - = pb::FieldCodec.ForSFixed64(322); - private readonly pbc::RepeatedField repeatedSfixed64_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedSfixed64 { - get { return repeatedSfixed64_; } - } - - /// Field number for the "repeated_float" field. - public const int RepeatedFloatFieldNumber = 41; - private static readonly pb::FieldCodec _repeated_repeatedFloat_codec - = pb::FieldCodec.ForFloat(330); - private readonly pbc::RepeatedField repeatedFloat_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedFloat { - get { return repeatedFloat_; } - } - - /// Field number for the "repeated_double" field. - public const int RepeatedDoubleFieldNumber = 42; - private static readonly pb::FieldCodec _repeated_repeatedDouble_codec - = pb::FieldCodec.ForDouble(338); - private readonly pbc::RepeatedField repeatedDouble_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedDouble { - get { return repeatedDouble_; } - } - - /// Field number for the "repeated_bool" field. - public const int RepeatedBoolFieldNumber = 43; - private static readonly pb::FieldCodec _repeated_repeatedBool_codec - = pb::FieldCodec.ForBool(346); - private readonly pbc::RepeatedField repeatedBool_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedBool { - get { return repeatedBool_; } - } - - /// Field number for the "repeated_string" field. - public const int RepeatedStringFieldNumber = 44; - private static readonly pb::FieldCodec _repeated_repeatedString_codec - = pb::FieldCodec.ForString(354); - private readonly pbc::RepeatedField repeatedString_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedString { - get { return repeatedString_; } - } - - /// Field number for the "repeated_bytes" field. - public const int RepeatedBytesFieldNumber = 45; - private static readonly pb::FieldCodec _repeated_repeatedBytes_codec - = pb::FieldCodec.ForBytes(362); - private readonly pbc::RepeatedField repeatedBytes_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedBytes { - get { return repeatedBytes_; } - } - - /// Field number for the "repeated_nested_message" field. - public const int RepeatedNestedMessageFieldNumber = 48; - private static readonly pb::FieldCodec _repeated_repeatedNestedMessage_codec - = pb::FieldCodec.ForMessage(386, global::Conformance.TestAllTypes.Types.NestedMessage.Parser); - private readonly pbc::RepeatedField repeatedNestedMessage_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedNestedMessage { - get { return repeatedNestedMessage_; } - } - - /// Field number for the "repeated_foreign_message" field. - public const int RepeatedForeignMessageFieldNumber = 49; - private static readonly pb::FieldCodec _repeated_repeatedForeignMessage_codec - = pb::FieldCodec.ForMessage(394, global::Conformance.ForeignMessage.Parser); - private readonly pbc::RepeatedField repeatedForeignMessage_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedForeignMessage { - get { return repeatedForeignMessage_; } - } - - /// Field number for the "repeated_nested_enum" field. - public const int RepeatedNestedEnumFieldNumber = 51; - private static readonly pb::FieldCodec _repeated_repeatedNestedEnum_codec - = pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::Conformance.TestAllTypes.Types.NestedEnum) x); - private readonly pbc::RepeatedField repeatedNestedEnum_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedNestedEnum { - get { return repeatedNestedEnum_; } - } - - /// Field number for the "repeated_foreign_enum" field. - public const int RepeatedForeignEnumFieldNumber = 52; - private static readonly pb::FieldCodec _repeated_repeatedForeignEnum_codec - = pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::Conformance.ForeignEnum) x); - private readonly pbc::RepeatedField repeatedForeignEnum_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedForeignEnum { - get { return repeatedForeignEnum_; } - } - - /// Field number for the "repeated_string_piece" field. - public const int RepeatedStringPieceFieldNumber = 54; - private static readonly pb::FieldCodec _repeated_repeatedStringPiece_codec - = pb::FieldCodec.ForString(434); - private readonly pbc::RepeatedField repeatedStringPiece_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedStringPiece { - get { return repeatedStringPiece_; } - } - - /// Field number for the "repeated_cord" field. - public const int RepeatedCordFieldNumber = 55; - private static readonly pb::FieldCodec _repeated_repeatedCord_codec - = pb::FieldCodec.ForString(442); - private readonly pbc::RepeatedField repeatedCord_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedCord { - get { return repeatedCord_; } - } - - /// Field number for the "map_int32_int32" field. - public const int MapInt32Int32FieldNumber = 56; - private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 450); - private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); - /// - /// Map - /// - public pbc::MapField MapInt32Int32 { - get { return mapInt32Int32_; } - } - - /// Field number for the "map_int64_int64" field. - public const int MapInt64Int64FieldNumber = 57; - private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 458); - private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); - public pbc::MapField MapInt64Int64 { - get { return mapInt64Int64_; } - } - - /// Field number for the "map_uint32_uint32" field. - public const int MapUint32Uint32FieldNumber = 58; - private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 466); - private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); - public pbc::MapField MapUint32Uint32 { - get { return mapUint32Uint32_; } - } - - /// Field number for the "map_uint64_uint64" field. - public const int MapUint64Uint64FieldNumber = 59; - private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 474); - private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); - public pbc::MapField MapUint64Uint64 { - get { return mapUint64Uint64_; } - } - - /// Field number for the "map_sint32_sint32" field. - public const int MapSint32Sint32FieldNumber = 60; - private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 482); - private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); - public pbc::MapField MapSint32Sint32 { - get { return mapSint32Sint32_; } - } - - /// Field number for the "map_sint64_sint64" field. - public const int MapSint64Sint64FieldNumber = 61; - private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 490); - private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); - public pbc::MapField MapSint64Sint64 { - get { return mapSint64Sint64_; } - } - - /// Field number for the "map_fixed32_fixed32" field. - public const int MapFixed32Fixed32FieldNumber = 62; - private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 498); - private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); - public pbc::MapField MapFixed32Fixed32 { - get { return mapFixed32Fixed32_; } - } - - /// Field number for the "map_fixed64_fixed64" field. - public const int MapFixed64Fixed64FieldNumber = 63; - private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 506); - private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); - public pbc::MapField MapFixed64Fixed64 { - get { return mapFixed64Fixed64_; } - } - - /// Field number for the "map_sfixed32_sfixed32" field. - public const int MapSfixed32Sfixed32FieldNumber = 64; - private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 514); - private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); - public pbc::MapField MapSfixed32Sfixed32 { - get { return mapSfixed32Sfixed32_; } - } - - /// Field number for the "map_sfixed64_sfixed64" field. - public const int MapSfixed64Sfixed64FieldNumber = 65; - private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 522); - private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); - public pbc::MapField MapSfixed64Sfixed64 { - get { return mapSfixed64Sfixed64_; } - } - - /// Field number for the "map_int32_float" field. - public const int MapInt32FloatFieldNumber = 66; - private static readonly pbc::MapField.Codec _map_mapInt32Float_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 530); - private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); - public pbc::MapField MapInt32Float { - get { return mapInt32Float_; } - } - - /// Field number for the "map_int32_double" field. - public const int MapInt32DoubleFieldNumber = 67; - private static readonly pbc::MapField.Codec _map_mapInt32Double_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 538); - private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); - public pbc::MapField MapInt32Double { - get { return mapInt32Double_; } - } - - /// Field number for the "map_bool_bool" field. - public const int MapBoolBoolFieldNumber = 68; - private static readonly pbc::MapField.Codec _map_mapBoolBool_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 546); - private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); - public pbc::MapField MapBoolBool { - get { return mapBoolBool_; } - } - - /// Field number for the "map_string_string" field. - public const int MapStringStringFieldNumber = 69; - private static readonly pbc::MapField.Codec _map_mapStringString_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 554); - private readonly pbc::MapField mapStringString_ = new pbc::MapField(); - public pbc::MapField MapStringString { - get { return mapStringString_; } - } - - /// Field number for the "map_string_bytes" field. - public const int MapStringBytesFieldNumber = 70; - private static readonly pbc::MapField.Codec _map_mapStringBytes_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForBytes(18), 562); - private readonly pbc::MapField mapStringBytes_ = new pbc::MapField(); - public pbc::MapField MapStringBytes { - get { return mapStringBytes_; } - } - - /// Field number for the "map_string_nested_message" field. - public const int MapStringNestedMessageFieldNumber = 71; - private static readonly pbc::MapField.Codec _map_mapStringNestedMessage_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Conformance.TestAllTypes.Types.NestedMessage.Parser), 570); - private readonly pbc::MapField mapStringNestedMessage_ = new pbc::MapField(); - public pbc::MapField MapStringNestedMessage { - get { return mapStringNestedMessage_; } - } - - /// Field number for the "map_string_foreign_message" field. - public const int MapStringForeignMessageFieldNumber = 72; - private static readonly pbc::MapField.Codec _map_mapStringForeignMessage_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Conformance.ForeignMessage.Parser), 578); - private readonly pbc::MapField mapStringForeignMessage_ = new pbc::MapField(); - public pbc::MapField MapStringForeignMessage { - get { return mapStringForeignMessage_; } - } - - /// Field number for the "map_string_nested_enum" field. - public const int MapStringNestedEnumFieldNumber = 73; - private static readonly pbc::MapField.Codec _map_mapStringNestedEnum_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Conformance.TestAllTypes.Types.NestedEnum) x), 586); - private readonly pbc::MapField mapStringNestedEnum_ = new pbc::MapField(); - public pbc::MapField MapStringNestedEnum { - get { return mapStringNestedEnum_; } - } - - /// Field number for the "map_string_foreign_enum" field. - public const int MapStringForeignEnumFieldNumber = 74; - private static readonly pbc::MapField.Codec _map_mapStringForeignEnum_codec - = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Conformance.ForeignEnum) x), 594); - private readonly pbc::MapField mapStringForeignEnum_ = new pbc::MapField(); - public pbc::MapField MapStringForeignEnum { - get { return mapStringForeignEnum_; } - } - - /// Field number for the "oneof_uint32" field. - public const int OneofUint32FieldNumber = 111; - public uint OneofUint32 { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; } - set { - oneofField_ = value; - oneofFieldCase_ = OneofFieldOneofCase.OneofUint32; - } - } - - /// Field number for the "oneof_nested_message" field. - public const int OneofNestedMessageFieldNumber = 112; - public global::Conformance.TestAllTypes.Types.NestedMessage OneofNestedMessage { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Conformance.TestAllTypes.Types.NestedMessage) oneofField_ : null; } - set { - oneofField_ = value; - oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage; - } - } - - /// Field number for the "oneof_string" field. - public const int OneofStringFieldNumber = 113; - public string OneofString { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } - set { - oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - oneofFieldCase_ = OneofFieldOneofCase.OneofString; - } - } - - /// Field number for the "oneof_bytes" field. - public const int OneofBytesFieldNumber = 114; - public pb::ByteString OneofBytes { - get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } - set { - oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; - } - } - - /// Field number for the "optional_bool_wrapper" field. - public const int OptionalBoolWrapperFieldNumber = 201; - private static readonly pb::FieldCodec _single_optionalBoolWrapper_codec = pb::FieldCodec.ForStructWrapper(1610); - private bool? optionalBoolWrapper_; - /// - /// Well-known types - /// - public bool? OptionalBoolWrapper { - get { return optionalBoolWrapper_; } - set { - optionalBoolWrapper_ = value; - } - } - - /// Field number for the "optional_int32_wrapper" field. - public const int OptionalInt32WrapperFieldNumber = 202; - private static readonly pb::FieldCodec _single_optionalInt32Wrapper_codec = pb::FieldCodec.ForStructWrapper(1618); - private int? optionalInt32Wrapper_; - public int? OptionalInt32Wrapper { - get { return optionalInt32Wrapper_; } - set { - optionalInt32Wrapper_ = value; - } - } - - /// Field number for the "optional_int64_wrapper" field. - public const int OptionalInt64WrapperFieldNumber = 203; - private static readonly pb::FieldCodec _single_optionalInt64Wrapper_codec = pb::FieldCodec.ForStructWrapper(1626); - private long? optionalInt64Wrapper_; - public long? OptionalInt64Wrapper { - get { return optionalInt64Wrapper_; } - set { - optionalInt64Wrapper_ = value; - } - } - - /// Field number for the "optional_uint32_wrapper" field. - public const int OptionalUint32WrapperFieldNumber = 204; - private static readonly pb::FieldCodec _single_optionalUint32Wrapper_codec = pb::FieldCodec.ForStructWrapper(1634); - private uint? optionalUint32Wrapper_; - public uint? OptionalUint32Wrapper { - get { return optionalUint32Wrapper_; } - set { - optionalUint32Wrapper_ = value; - } - } - - /// Field number for the "optional_uint64_wrapper" field. - public const int OptionalUint64WrapperFieldNumber = 205; - private static readonly pb::FieldCodec _single_optionalUint64Wrapper_codec = pb::FieldCodec.ForStructWrapper(1642); - private ulong? optionalUint64Wrapper_; - public ulong? OptionalUint64Wrapper { - get { return optionalUint64Wrapper_; } - set { - optionalUint64Wrapper_ = value; - } - } - - /// Field number for the "optional_float_wrapper" field. - public const int OptionalFloatWrapperFieldNumber = 206; - private static readonly pb::FieldCodec _single_optionalFloatWrapper_codec = pb::FieldCodec.ForStructWrapper(1650); - private float? optionalFloatWrapper_; - public float? OptionalFloatWrapper { - get { return optionalFloatWrapper_; } - set { - optionalFloatWrapper_ = value; - } - } - - /// Field number for the "optional_double_wrapper" field. - public const int OptionalDoubleWrapperFieldNumber = 207; - private static readonly pb::FieldCodec _single_optionalDoubleWrapper_codec = pb::FieldCodec.ForStructWrapper(1658); - private double? optionalDoubleWrapper_; - public double? OptionalDoubleWrapper { - get { return optionalDoubleWrapper_; } - set { - optionalDoubleWrapper_ = value; - } - } - - /// Field number for the "optional_string_wrapper" field. - public const int OptionalStringWrapperFieldNumber = 208; - private static readonly pb::FieldCodec _single_optionalStringWrapper_codec = pb::FieldCodec.ForClassWrapper(1666); - private string optionalStringWrapper_; - public string OptionalStringWrapper { - get { return optionalStringWrapper_; } - set { - optionalStringWrapper_ = value; - } - } - - /// Field number for the "optional_bytes_wrapper" field. - public const int OptionalBytesWrapperFieldNumber = 209; - private static readonly pb::FieldCodec _single_optionalBytesWrapper_codec = pb::FieldCodec.ForClassWrapper(1674); - private pb::ByteString optionalBytesWrapper_; - public pb::ByteString OptionalBytesWrapper { - get { return optionalBytesWrapper_; } - set { - optionalBytesWrapper_ = value; - } - } - - /// Field number for the "repeated_bool_wrapper" field. - public const int RepeatedBoolWrapperFieldNumber = 211; - private static readonly pb::FieldCodec _repeated_repeatedBoolWrapper_codec - = pb::FieldCodec.ForStructWrapper(1690); - private readonly pbc::RepeatedField repeatedBoolWrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedBoolWrapper { - get { return repeatedBoolWrapper_; } - } - - /// Field number for the "repeated_int32_wrapper" field. - public const int RepeatedInt32WrapperFieldNumber = 212; - private static readonly pb::FieldCodec _repeated_repeatedInt32Wrapper_codec - = pb::FieldCodec.ForStructWrapper(1698); - private readonly pbc::RepeatedField repeatedInt32Wrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedInt32Wrapper { - get { return repeatedInt32Wrapper_; } - } - - /// Field number for the "repeated_int64_wrapper" field. - public const int RepeatedInt64WrapperFieldNumber = 213; - private static readonly pb::FieldCodec _repeated_repeatedInt64Wrapper_codec - = pb::FieldCodec.ForStructWrapper(1706); - private readonly pbc::RepeatedField repeatedInt64Wrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedInt64Wrapper { - get { return repeatedInt64Wrapper_; } - } - - /// Field number for the "repeated_uint32_wrapper" field. - public const int RepeatedUint32WrapperFieldNumber = 214; - private static readonly pb::FieldCodec _repeated_repeatedUint32Wrapper_codec - = pb::FieldCodec.ForStructWrapper(1714); - private readonly pbc::RepeatedField repeatedUint32Wrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedUint32Wrapper { - get { return repeatedUint32Wrapper_; } - } - - /// Field number for the "repeated_uint64_wrapper" field. - public const int RepeatedUint64WrapperFieldNumber = 215; - private static readonly pb::FieldCodec _repeated_repeatedUint64Wrapper_codec - = pb::FieldCodec.ForStructWrapper(1722); - private readonly pbc::RepeatedField repeatedUint64Wrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedUint64Wrapper { - get { return repeatedUint64Wrapper_; } - } - - /// Field number for the "repeated_float_wrapper" field. - public const int RepeatedFloatWrapperFieldNumber = 216; - private static readonly pb::FieldCodec _repeated_repeatedFloatWrapper_codec - = pb::FieldCodec.ForStructWrapper(1730); - private readonly pbc::RepeatedField repeatedFloatWrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedFloatWrapper { - get { return repeatedFloatWrapper_; } - } - - /// Field number for the "repeated_double_wrapper" field. - public const int RepeatedDoubleWrapperFieldNumber = 217; - private static readonly pb::FieldCodec _repeated_repeatedDoubleWrapper_codec - = pb::FieldCodec.ForStructWrapper(1738); - private readonly pbc::RepeatedField repeatedDoubleWrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedDoubleWrapper { - get { return repeatedDoubleWrapper_; } - } - - /// Field number for the "repeated_string_wrapper" field. - public const int RepeatedStringWrapperFieldNumber = 218; - private static readonly pb::FieldCodec _repeated_repeatedStringWrapper_codec - = pb::FieldCodec.ForClassWrapper(1746); - private readonly pbc::RepeatedField repeatedStringWrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedStringWrapper { - get { return repeatedStringWrapper_; } - } - - /// Field number for the "repeated_bytes_wrapper" field. - public const int RepeatedBytesWrapperFieldNumber = 219; - private static readonly pb::FieldCodec _repeated_repeatedBytesWrapper_codec - = pb::FieldCodec.ForClassWrapper(1754); - private readonly pbc::RepeatedField repeatedBytesWrapper_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedBytesWrapper { - get { return repeatedBytesWrapper_; } - } - - /// Field number for the "optional_duration" field. - public const int OptionalDurationFieldNumber = 301; - private global::Google.Protobuf.WellKnownTypes.Duration optionalDuration_; - public global::Google.Protobuf.WellKnownTypes.Duration OptionalDuration { - get { return optionalDuration_; } - set { - optionalDuration_ = value; - } - } - - /// Field number for the "optional_timestamp" field. - public const int OptionalTimestampFieldNumber = 302; - private global::Google.Protobuf.WellKnownTypes.Timestamp optionalTimestamp_; - public global::Google.Protobuf.WellKnownTypes.Timestamp OptionalTimestamp { - get { return optionalTimestamp_; } - set { - optionalTimestamp_ = value; - } - } - - /// Field number for the "optional_field_mask" field. - public const int OptionalFieldMaskFieldNumber = 303; - private global::Google.Protobuf.WellKnownTypes.FieldMask optionalFieldMask_; - public global::Google.Protobuf.WellKnownTypes.FieldMask OptionalFieldMask { - get { return optionalFieldMask_; } - set { - optionalFieldMask_ = value; - } - } - - /// Field number for the "optional_struct" field. - public const int OptionalStructFieldNumber = 304; - private global::Google.Protobuf.WellKnownTypes.Struct optionalStruct_; - public global::Google.Protobuf.WellKnownTypes.Struct OptionalStruct { - get { return optionalStruct_; } - set { - optionalStruct_ = value; - } - } - - /// Field number for the "optional_any" field. - public const int OptionalAnyFieldNumber = 305; - private global::Google.Protobuf.WellKnownTypes.Any optionalAny_; - public global::Google.Protobuf.WellKnownTypes.Any OptionalAny { - get { return optionalAny_; } - set { - optionalAny_ = value; - } - } - - /// Field number for the "optional_value" field. - public const int OptionalValueFieldNumber = 306; - private global::Google.Protobuf.WellKnownTypes.Value optionalValue_; - public global::Google.Protobuf.WellKnownTypes.Value OptionalValue { - get { return optionalValue_; } - set { - optionalValue_ = value; - } - } - - /// Field number for the "repeated_duration" field. - public const int RepeatedDurationFieldNumber = 311; - private static readonly pb::FieldCodec _repeated_repeatedDuration_codec - = pb::FieldCodec.ForMessage(2490, global::Google.Protobuf.WellKnownTypes.Duration.Parser); - private readonly pbc::RepeatedField repeatedDuration_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedDuration { - get { return repeatedDuration_; } - } - - /// Field number for the "repeated_timestamp" field. - public const int RepeatedTimestampFieldNumber = 312; - private static readonly pb::FieldCodec _repeated_repeatedTimestamp_codec - = pb::FieldCodec.ForMessage(2498, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser); - private readonly pbc::RepeatedField repeatedTimestamp_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedTimestamp { - get { return repeatedTimestamp_; } - } - - /// Field number for the "repeated_fieldmask" field. - public const int RepeatedFieldmaskFieldNumber = 313; - private static readonly pb::FieldCodec _repeated_repeatedFieldmask_codec - = pb::FieldCodec.ForMessage(2506, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser); - private readonly pbc::RepeatedField repeatedFieldmask_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedFieldmask { - get { return repeatedFieldmask_; } - } - - /// Field number for the "repeated_struct" field. - public const int RepeatedStructFieldNumber = 324; - private static readonly pb::FieldCodec _repeated_repeatedStruct_codec - = pb::FieldCodec.ForMessage(2594, global::Google.Protobuf.WellKnownTypes.Struct.Parser); - private readonly pbc::RepeatedField repeatedStruct_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedStruct { - get { return repeatedStruct_; } - } - - /// Field number for the "repeated_any" field. - public const int RepeatedAnyFieldNumber = 315; - private static readonly pb::FieldCodec _repeated_repeatedAny_codec - = pb::FieldCodec.ForMessage(2522, global::Google.Protobuf.WellKnownTypes.Any.Parser); - private readonly pbc::RepeatedField repeatedAny_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedAny { - get { return repeatedAny_; } - } - - /// Field number for the "repeated_value" field. - public const int RepeatedValueFieldNumber = 316; - private static readonly pb::FieldCodec _repeated_repeatedValue_codec - = pb::FieldCodec.ForMessage(2530, global::Google.Protobuf.WellKnownTypes.Value.Parser); - private readonly pbc::RepeatedField repeatedValue_ = new pbc::RepeatedField(); - public pbc::RepeatedField RepeatedValue { - get { return repeatedValue_; } - } - - /// Field number for the "fieldname1" field. - public const int Fieldname1FieldNumber = 401; - private int fieldname1_; - /// - /// Test field-name-to-JSON-name convention. - /// - public int Fieldname1 { - get { return fieldname1_; } - set { - fieldname1_ = value; - } - } - - /// Field number for the "field_name2" field. - public const int FieldName2FieldNumber = 402; - private int fieldName2_; - public int FieldName2 { - get { return fieldName2_; } - set { - fieldName2_ = value; - } - } - - /// Field number for the "_field_name3" field. - public const int FieldName3FieldNumber = 403; - private int FieldName3_; - public int FieldName3 { - get { return FieldName3_; } - set { - FieldName3_ = value; - } - } - - /// Field number for the "field__name4_" field. - public const int FieldName4FieldNumber = 404; - private int fieldName4_; - public int FieldName4 { - get { return fieldName4_; } - set { - fieldName4_ = value; - } - } - - /// Field number for the "field0name5" field. - public const int Field0Name5FieldNumber = 405; - private int field0Name5_; - public int Field0Name5 { - get { return field0Name5_; } - set { - field0Name5_ = value; - } - } - - /// Field number for the "field_0_name6" field. - public const int Field0Name6FieldNumber = 406; - private int field0Name6_; - public int Field0Name6 { - get { return field0Name6_; } - set { - field0Name6_ = value; - } - } - - /// Field number for the "fieldName7" field. - public const int FieldName7FieldNumber = 407; - private int fieldName7_; - public int FieldName7 { - get { return fieldName7_; } - set { - fieldName7_ = value; - } - } - - /// Field number for the "FieldName8" field. - public const int FieldName8FieldNumber = 408; - private int fieldName8_; - public int FieldName8 { - get { return fieldName8_; } - set { - fieldName8_ = value; - } - } - - /// Field number for the "field_Name9" field. - public const int FieldName9FieldNumber = 409; - private int fieldName9_; - public int FieldName9 { - get { return fieldName9_; } - set { - fieldName9_ = value; - } - } - - /// Field number for the "Field_Name10" field. - public const int FieldName10FieldNumber = 410; - private int fieldName10_; - public int FieldName10 { - get { return fieldName10_; } - set { - fieldName10_ = value; - } - } - - /// Field number for the "FIELD_NAME11" field. - public const int FIELDNAME11FieldNumber = 411; - private int fIELDNAME11_; - public int FIELDNAME11 { - get { return fIELDNAME11_; } - set { - fIELDNAME11_ = value; - } - } - - /// Field number for the "FIELD_name12" field. - public const int FIELDName12FieldNumber = 412; - private int fIELDName12_; - public int FIELDName12 { - get { return fIELDName12_; } - set { - fIELDName12_ = value; - } - } - - private object oneofField_; - /// Enum of possible cases for the "oneof_field" oneof. - public enum OneofFieldOneofCase { - None = 0, - OneofUint32 = 111, - OneofNestedMessage = 112, - OneofString = 113, - OneofBytes = 114, - } - private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None; - public OneofFieldOneofCase OneofFieldCase { - get { return oneofFieldCase_; } - } - - public void ClearOneofField() { - oneofFieldCase_ = OneofFieldOneofCase.None; - oneofField_ = null; - } - - public override bool Equals(object other) { - return Equals(other as TestAllTypes); - } - - public bool Equals(TestAllTypes other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (OptionalInt32 != other.OptionalInt32) return false; - if (OptionalInt64 != other.OptionalInt64) return false; - if (OptionalUint32 != other.OptionalUint32) return false; - if (OptionalUint64 != other.OptionalUint64) return false; - if (OptionalSint32 != other.OptionalSint32) return false; - if (OptionalSint64 != other.OptionalSint64) return false; - if (OptionalFixed32 != other.OptionalFixed32) return false; - if (OptionalFixed64 != other.OptionalFixed64) return false; - if (OptionalSfixed32 != other.OptionalSfixed32) return false; - if (OptionalSfixed64 != other.OptionalSfixed64) return false; - if (OptionalFloat != other.OptionalFloat) return false; - if (OptionalDouble != other.OptionalDouble) return false; - if (OptionalBool != other.OptionalBool) return false; - if (OptionalString != other.OptionalString) return false; - if (OptionalBytes != other.OptionalBytes) return false; - if (!object.Equals(OptionalNestedMessage, other.OptionalNestedMessage)) return false; - if (!object.Equals(OptionalForeignMessage, other.OptionalForeignMessage)) return false; - if (OptionalNestedEnum != other.OptionalNestedEnum) return false; - if (OptionalForeignEnum != other.OptionalForeignEnum) return false; - if (OptionalStringPiece != other.OptionalStringPiece) return false; - if (OptionalCord != other.OptionalCord) return false; - if (!object.Equals(RecursiveMessage, other.RecursiveMessage)) return false; - if(!repeatedInt32_.Equals(other.repeatedInt32_)) return false; - if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false; - if(!repeatedUint32_.Equals(other.repeatedUint32_)) return false; - if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false; - if(!repeatedSint32_.Equals(other.repeatedSint32_)) return false; - if(!repeatedSint64_.Equals(other.repeatedSint64_)) return false; - if(!repeatedFixed32_.Equals(other.repeatedFixed32_)) return false; - if(!repeatedFixed64_.Equals(other.repeatedFixed64_)) return false; - if(!repeatedSfixed32_.Equals(other.repeatedSfixed32_)) return false; - if(!repeatedSfixed64_.Equals(other.repeatedSfixed64_)) return false; - if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false; - if(!repeatedDouble_.Equals(other.repeatedDouble_)) return false; - if(!repeatedBool_.Equals(other.repeatedBool_)) return false; - if(!repeatedString_.Equals(other.repeatedString_)) return false; - if(!repeatedBytes_.Equals(other.repeatedBytes_)) return false; - if(!repeatedNestedMessage_.Equals(other.repeatedNestedMessage_)) return false; - if(!repeatedForeignMessage_.Equals(other.repeatedForeignMessage_)) return false; - if(!repeatedNestedEnum_.Equals(other.repeatedNestedEnum_)) return false; - if(!repeatedForeignEnum_.Equals(other.repeatedForeignEnum_)) return false; - if(!repeatedStringPiece_.Equals(other.repeatedStringPiece_)) return false; - if(!repeatedCord_.Equals(other.repeatedCord_)) return false; - if (!MapInt32Int32.Equals(other.MapInt32Int32)) return false; - if (!MapInt64Int64.Equals(other.MapInt64Int64)) return false; - if (!MapUint32Uint32.Equals(other.MapUint32Uint32)) return false; - if (!MapUint64Uint64.Equals(other.MapUint64Uint64)) return false; - if (!MapSint32Sint32.Equals(other.MapSint32Sint32)) return false; - if (!MapSint64Sint64.Equals(other.MapSint64Sint64)) return false; - if (!MapFixed32Fixed32.Equals(other.MapFixed32Fixed32)) return false; - if (!MapFixed64Fixed64.Equals(other.MapFixed64Fixed64)) return false; - if (!MapSfixed32Sfixed32.Equals(other.MapSfixed32Sfixed32)) return false; - if (!MapSfixed64Sfixed64.Equals(other.MapSfixed64Sfixed64)) return false; - if (!MapInt32Float.Equals(other.MapInt32Float)) return false; - if (!MapInt32Double.Equals(other.MapInt32Double)) return false; - if (!MapBoolBool.Equals(other.MapBoolBool)) return false; - if (!MapStringString.Equals(other.MapStringString)) return false; - if (!MapStringBytes.Equals(other.MapStringBytes)) return false; - if (!MapStringNestedMessage.Equals(other.MapStringNestedMessage)) return false; - if (!MapStringForeignMessage.Equals(other.MapStringForeignMessage)) return false; - if (!MapStringNestedEnum.Equals(other.MapStringNestedEnum)) return false; - if (!MapStringForeignEnum.Equals(other.MapStringForeignEnum)) return false; - if (OneofUint32 != other.OneofUint32) return false; - if (!object.Equals(OneofNestedMessage, other.OneofNestedMessage)) return false; - if (OneofString != other.OneofString) return false; - if (OneofBytes != other.OneofBytes) return false; - if (OptionalBoolWrapper != other.OptionalBoolWrapper) return false; - if (OptionalInt32Wrapper != other.OptionalInt32Wrapper) return false; - if (OptionalInt64Wrapper != other.OptionalInt64Wrapper) return false; - if (OptionalUint32Wrapper != other.OptionalUint32Wrapper) return false; - if (OptionalUint64Wrapper != other.OptionalUint64Wrapper) return false; - if (OptionalFloatWrapper != other.OptionalFloatWrapper) return false; - if (OptionalDoubleWrapper != other.OptionalDoubleWrapper) return false; - if (OptionalStringWrapper != other.OptionalStringWrapper) return false; - if (OptionalBytesWrapper != other.OptionalBytesWrapper) return false; - if(!repeatedBoolWrapper_.Equals(other.repeatedBoolWrapper_)) return false; - if(!repeatedInt32Wrapper_.Equals(other.repeatedInt32Wrapper_)) return false; - if(!repeatedInt64Wrapper_.Equals(other.repeatedInt64Wrapper_)) return false; - if(!repeatedUint32Wrapper_.Equals(other.repeatedUint32Wrapper_)) return false; - if(!repeatedUint64Wrapper_.Equals(other.repeatedUint64Wrapper_)) return false; - if(!repeatedFloatWrapper_.Equals(other.repeatedFloatWrapper_)) return false; - if(!repeatedDoubleWrapper_.Equals(other.repeatedDoubleWrapper_)) return false; - if(!repeatedStringWrapper_.Equals(other.repeatedStringWrapper_)) return false; - if(!repeatedBytesWrapper_.Equals(other.repeatedBytesWrapper_)) return false; - if (!object.Equals(OptionalDuration, other.OptionalDuration)) return false; - if (!object.Equals(OptionalTimestamp, other.OptionalTimestamp)) return false; - if (!object.Equals(OptionalFieldMask, other.OptionalFieldMask)) return false; - if (!object.Equals(OptionalStruct, other.OptionalStruct)) return false; - if (!object.Equals(OptionalAny, other.OptionalAny)) return false; - if (!object.Equals(OptionalValue, other.OptionalValue)) return false; - if(!repeatedDuration_.Equals(other.repeatedDuration_)) return false; - if(!repeatedTimestamp_.Equals(other.repeatedTimestamp_)) return false; - if(!repeatedFieldmask_.Equals(other.repeatedFieldmask_)) return false; - if(!repeatedStruct_.Equals(other.repeatedStruct_)) return false; - if(!repeatedAny_.Equals(other.repeatedAny_)) return false; - if(!repeatedValue_.Equals(other.repeatedValue_)) return false; - if (Fieldname1 != other.Fieldname1) return false; - if (FieldName2 != other.FieldName2) return false; - if (FieldName3 != other.FieldName3) return false; - if (FieldName4 != other.FieldName4) return false; - if (Field0Name5 != other.Field0Name5) return false; - if (Field0Name6 != other.Field0Name6) return false; - if (FieldName7 != other.FieldName7) return false; - if (FieldName8 != other.FieldName8) return false; - if (FieldName9 != other.FieldName9) return false; - if (FieldName10 != other.FieldName10) return false; - if (FIELDNAME11 != other.FIELDNAME11) return false; - if (FIELDName12 != other.FIELDName12) return false; - if (OneofFieldCase != other.OneofFieldCase) return false; - return true; - } - - public override int GetHashCode() { - int hash = 1; - if (OptionalInt32 != 0) hash ^= OptionalInt32.GetHashCode(); - if (OptionalInt64 != 0L) hash ^= OptionalInt64.GetHashCode(); - if (OptionalUint32 != 0) hash ^= OptionalUint32.GetHashCode(); - if (OptionalUint64 != 0UL) hash ^= OptionalUint64.GetHashCode(); - if (OptionalSint32 != 0) hash ^= OptionalSint32.GetHashCode(); - if (OptionalSint64 != 0L) hash ^= OptionalSint64.GetHashCode(); - if (OptionalFixed32 != 0) hash ^= OptionalFixed32.GetHashCode(); - if (OptionalFixed64 != 0UL) hash ^= OptionalFixed64.GetHashCode(); - if (OptionalSfixed32 != 0) hash ^= OptionalSfixed32.GetHashCode(); - if (OptionalSfixed64 != 0L) hash ^= OptionalSfixed64.GetHashCode(); - if (OptionalFloat != 0F) hash ^= OptionalFloat.GetHashCode(); - if (OptionalDouble != 0D) hash ^= OptionalDouble.GetHashCode(); - if (OptionalBool != false) hash ^= OptionalBool.GetHashCode(); - if (OptionalString.Length != 0) hash ^= OptionalString.GetHashCode(); - if (OptionalBytes.Length != 0) hash ^= OptionalBytes.GetHashCode(); - if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode(); - if (optionalForeignMessage_ != null) hash ^= OptionalForeignMessage.GetHashCode(); - if (OptionalNestedEnum != 0) hash ^= OptionalNestedEnum.GetHashCode(); - if (OptionalForeignEnum != 0) hash ^= OptionalForeignEnum.GetHashCode(); - if (OptionalStringPiece.Length != 0) hash ^= OptionalStringPiece.GetHashCode(); - if (OptionalCord.Length != 0) hash ^= OptionalCord.GetHashCode(); - if (recursiveMessage_ != null) hash ^= RecursiveMessage.GetHashCode(); - hash ^= repeatedInt32_.GetHashCode(); - hash ^= repeatedInt64_.GetHashCode(); - hash ^= repeatedUint32_.GetHashCode(); - hash ^= repeatedUint64_.GetHashCode(); - hash ^= repeatedSint32_.GetHashCode(); - hash ^= repeatedSint64_.GetHashCode(); - hash ^= repeatedFixed32_.GetHashCode(); - hash ^= repeatedFixed64_.GetHashCode(); - hash ^= repeatedSfixed32_.GetHashCode(); - hash ^= repeatedSfixed64_.GetHashCode(); - hash ^= repeatedFloat_.GetHashCode(); - hash ^= repeatedDouble_.GetHashCode(); - hash ^= repeatedBool_.GetHashCode(); - hash ^= repeatedString_.GetHashCode(); - hash ^= repeatedBytes_.GetHashCode(); - hash ^= repeatedNestedMessage_.GetHashCode(); - hash ^= repeatedForeignMessage_.GetHashCode(); - hash ^= repeatedNestedEnum_.GetHashCode(); - hash ^= repeatedForeignEnum_.GetHashCode(); - hash ^= repeatedStringPiece_.GetHashCode(); - hash ^= repeatedCord_.GetHashCode(); - hash ^= MapInt32Int32.GetHashCode(); - hash ^= MapInt64Int64.GetHashCode(); - hash ^= MapUint32Uint32.GetHashCode(); - hash ^= MapUint64Uint64.GetHashCode(); - hash ^= MapSint32Sint32.GetHashCode(); - hash ^= MapSint64Sint64.GetHashCode(); - hash ^= MapFixed32Fixed32.GetHashCode(); - hash ^= MapFixed64Fixed64.GetHashCode(); - hash ^= MapSfixed32Sfixed32.GetHashCode(); - hash ^= MapSfixed64Sfixed64.GetHashCode(); - hash ^= MapInt32Float.GetHashCode(); - hash ^= MapInt32Double.GetHashCode(); - hash ^= MapBoolBool.GetHashCode(); - hash ^= MapStringString.GetHashCode(); - hash ^= MapStringBytes.GetHashCode(); - hash ^= MapStringNestedMessage.GetHashCode(); - hash ^= MapStringForeignMessage.GetHashCode(); - hash ^= MapStringNestedEnum.GetHashCode(); - hash ^= MapStringForeignEnum.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) hash ^= OneofUint32.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) hash ^= OneofString.GetHashCode(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode(); - if (optionalBoolWrapper_ != null) hash ^= OptionalBoolWrapper.GetHashCode(); - if (optionalInt32Wrapper_ != null) hash ^= OptionalInt32Wrapper.GetHashCode(); - if (optionalInt64Wrapper_ != null) hash ^= OptionalInt64Wrapper.GetHashCode(); - if (optionalUint32Wrapper_ != null) hash ^= OptionalUint32Wrapper.GetHashCode(); - if (optionalUint64Wrapper_ != null) hash ^= OptionalUint64Wrapper.GetHashCode(); - if (optionalFloatWrapper_ != null) hash ^= OptionalFloatWrapper.GetHashCode(); - if (optionalDoubleWrapper_ != null) hash ^= OptionalDoubleWrapper.GetHashCode(); - if (optionalStringWrapper_ != null) hash ^= OptionalStringWrapper.GetHashCode(); - if (optionalBytesWrapper_ != null) hash ^= OptionalBytesWrapper.GetHashCode(); - hash ^= repeatedBoolWrapper_.GetHashCode(); - hash ^= repeatedInt32Wrapper_.GetHashCode(); - hash ^= repeatedInt64Wrapper_.GetHashCode(); - hash ^= repeatedUint32Wrapper_.GetHashCode(); - hash ^= repeatedUint64Wrapper_.GetHashCode(); - hash ^= repeatedFloatWrapper_.GetHashCode(); - hash ^= repeatedDoubleWrapper_.GetHashCode(); - hash ^= repeatedStringWrapper_.GetHashCode(); - hash ^= repeatedBytesWrapper_.GetHashCode(); - if (optionalDuration_ != null) hash ^= OptionalDuration.GetHashCode(); - if (optionalTimestamp_ != null) hash ^= OptionalTimestamp.GetHashCode(); - if (optionalFieldMask_ != null) hash ^= OptionalFieldMask.GetHashCode(); - if (optionalStruct_ != null) hash ^= OptionalStruct.GetHashCode(); - if (optionalAny_ != null) hash ^= OptionalAny.GetHashCode(); - if (optionalValue_ != null) hash ^= OptionalValue.GetHashCode(); - hash ^= repeatedDuration_.GetHashCode(); - hash ^= repeatedTimestamp_.GetHashCode(); - hash ^= repeatedFieldmask_.GetHashCode(); - hash ^= repeatedStruct_.GetHashCode(); - hash ^= repeatedAny_.GetHashCode(); - hash ^= repeatedValue_.GetHashCode(); - if (Fieldname1 != 0) hash ^= Fieldname1.GetHashCode(); - if (FieldName2 != 0) hash ^= FieldName2.GetHashCode(); - if (FieldName3 != 0) hash ^= FieldName3.GetHashCode(); - if (FieldName4 != 0) hash ^= FieldName4.GetHashCode(); - if (Field0Name5 != 0) hash ^= Field0Name5.GetHashCode(); - if (Field0Name6 != 0) hash ^= Field0Name6.GetHashCode(); - if (FieldName7 != 0) hash ^= FieldName7.GetHashCode(); - if (FieldName8 != 0) hash ^= FieldName8.GetHashCode(); - if (FieldName9 != 0) hash ^= FieldName9.GetHashCode(); - if (FieldName10 != 0) hash ^= FieldName10.GetHashCode(); - if (FIELDNAME11 != 0) hash ^= FIELDNAME11.GetHashCode(); - if (FIELDName12 != 0) hash ^= FIELDName12.GetHashCode(); - hash ^= (int) oneofFieldCase_; - return hash; - } - - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - public void WriteTo(pb::CodedOutputStream output) { - if (OptionalInt32 != 0) { - output.WriteRawTag(8); - output.WriteInt32(OptionalInt32); - } - if (OptionalInt64 != 0L) { - output.WriteRawTag(16); - output.WriteInt64(OptionalInt64); - } - if (OptionalUint32 != 0) { - output.WriteRawTag(24); - output.WriteUInt32(OptionalUint32); - } - if (OptionalUint64 != 0UL) { - output.WriteRawTag(32); - output.WriteUInt64(OptionalUint64); - } - if (OptionalSint32 != 0) { - output.WriteRawTag(40); - output.WriteSInt32(OptionalSint32); - } - if (OptionalSint64 != 0L) { - output.WriteRawTag(48); - output.WriteSInt64(OptionalSint64); - } - if (OptionalFixed32 != 0) { - output.WriteRawTag(61); - output.WriteFixed32(OptionalFixed32); - } - if (OptionalFixed64 != 0UL) { - output.WriteRawTag(65); - output.WriteFixed64(OptionalFixed64); - } - if (OptionalSfixed32 != 0) { - output.WriteRawTag(77); - output.WriteSFixed32(OptionalSfixed32); - } - if (OptionalSfixed64 != 0L) { - output.WriteRawTag(81); - output.WriteSFixed64(OptionalSfixed64); - } - if (OptionalFloat != 0F) { - output.WriteRawTag(93); - output.WriteFloat(OptionalFloat); - } - if (OptionalDouble != 0D) { - output.WriteRawTag(97); - output.WriteDouble(OptionalDouble); - } - if (OptionalBool != false) { - output.WriteRawTag(104); - output.WriteBool(OptionalBool); - } - if (OptionalString.Length != 0) { - output.WriteRawTag(114); - output.WriteString(OptionalString); - } - if (OptionalBytes.Length != 0) { - output.WriteRawTag(122); - output.WriteBytes(OptionalBytes); - } - if (optionalNestedMessage_ != null) { - output.WriteRawTag(146, 1); - output.WriteMessage(OptionalNestedMessage); - } - if (optionalForeignMessage_ != null) { - output.WriteRawTag(154, 1); - output.WriteMessage(OptionalForeignMessage); - } - if (OptionalNestedEnum != 0) { - output.WriteRawTag(168, 1); - output.WriteEnum((int) OptionalNestedEnum); - } - if (OptionalForeignEnum != 0) { - output.WriteRawTag(176, 1); - output.WriteEnum((int) OptionalForeignEnum); - } - if (OptionalStringPiece.Length != 0) { - output.WriteRawTag(194, 1); - output.WriteString(OptionalStringPiece); - } - if (OptionalCord.Length != 0) { - output.WriteRawTag(202, 1); - output.WriteString(OptionalCord); - } - if (recursiveMessage_ != null) { - output.WriteRawTag(218, 1); - output.WriteMessage(RecursiveMessage); - } - repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec); - repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec); - repeatedUint32_.WriteTo(output, _repeated_repeatedUint32_codec); - repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec); - repeatedSint32_.WriteTo(output, _repeated_repeatedSint32_codec); - repeatedSint64_.WriteTo(output, _repeated_repeatedSint64_codec); - repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec); - repeatedFixed64_.WriteTo(output, _repeated_repeatedFixed64_codec); - repeatedSfixed32_.WriteTo(output, _repeated_repeatedSfixed32_codec); - repeatedSfixed64_.WriteTo(output, _repeated_repeatedSfixed64_codec); - repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec); - repeatedDouble_.WriteTo(output, _repeated_repeatedDouble_codec); - repeatedBool_.WriteTo(output, _repeated_repeatedBool_codec); - repeatedString_.WriteTo(output, _repeated_repeatedString_codec); - repeatedBytes_.WriteTo(output, _repeated_repeatedBytes_codec); - repeatedNestedMessage_.WriteTo(output, _repeated_repeatedNestedMessage_codec); - repeatedForeignMessage_.WriteTo(output, _repeated_repeatedForeignMessage_codec); - repeatedNestedEnum_.WriteTo(output, _repeated_repeatedNestedEnum_codec); - repeatedForeignEnum_.WriteTo(output, _repeated_repeatedForeignEnum_codec); - repeatedStringPiece_.WriteTo(output, _repeated_repeatedStringPiece_codec); - repeatedCord_.WriteTo(output, _repeated_repeatedCord_codec); - mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); - mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); - mapUint32Uint32_.WriteTo(output, _map_mapUint32Uint32_codec); - mapUint64Uint64_.WriteTo(output, _map_mapUint64Uint64_codec); - mapSint32Sint32_.WriteTo(output, _map_mapSint32Sint32_codec); - mapSint64Sint64_.WriteTo(output, _map_mapSint64Sint64_codec); - mapFixed32Fixed32_.WriteTo(output, _map_mapFixed32Fixed32_codec); - mapFixed64Fixed64_.WriteTo(output, _map_mapFixed64Fixed64_codec); - mapSfixed32Sfixed32_.WriteTo(output, _map_mapSfixed32Sfixed32_codec); - mapSfixed64Sfixed64_.WriteTo(output, _map_mapSfixed64Sfixed64_codec); - mapInt32Float_.WriteTo(output, _map_mapInt32Float_codec); - mapInt32Double_.WriteTo(output, _map_mapInt32Double_codec); - mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec); - mapStringString_.WriteTo(output, _map_mapStringString_codec); - mapStringBytes_.WriteTo(output, _map_mapStringBytes_codec); - mapStringNestedMessage_.WriteTo(output, _map_mapStringNestedMessage_codec); - mapStringForeignMessage_.WriteTo(output, _map_mapStringForeignMessage_codec); - mapStringNestedEnum_.WriteTo(output, _map_mapStringNestedEnum_codec); - mapStringForeignEnum_.WriteTo(output, _map_mapStringForeignEnum_codec); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { - output.WriteRawTag(248, 6); - output.WriteUInt32(OneofUint32); - } - if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { - output.WriteRawTag(130, 7); - output.WriteMessage(OneofNestedMessage); - } - if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) { - output.WriteRawTag(138, 7); - output.WriteString(OneofString); - } - if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { - output.WriteRawTag(146, 7); - output.WriteBytes(OneofBytes); - } - if (optionalBoolWrapper_ != null) { - _single_optionalBoolWrapper_codec.WriteTagAndValue(output, OptionalBoolWrapper); - } - if (optionalInt32Wrapper_ != null) { - _single_optionalInt32Wrapper_codec.WriteTagAndValue(output, OptionalInt32Wrapper); - } - if (optionalInt64Wrapper_ != null) { - _single_optionalInt64Wrapper_codec.WriteTagAndValue(output, OptionalInt64Wrapper); - } - if (optionalUint32Wrapper_ != null) { - _single_optionalUint32Wrapper_codec.WriteTagAndValue(output, OptionalUint32Wrapper); - } - if (optionalUint64Wrapper_ != null) { - _single_optionalUint64Wrapper_codec.WriteTagAndValue(output, OptionalUint64Wrapper); - } - if (optionalFloatWrapper_ != null) { - _single_optionalFloatWrapper_codec.WriteTagAndValue(output, OptionalFloatWrapper); - } - if (optionalDoubleWrapper_ != null) { - _single_optionalDoubleWrapper_codec.WriteTagAndValue(output, OptionalDoubleWrapper); - } - if (optionalStringWrapper_ != null) { - _single_optionalStringWrapper_codec.WriteTagAndValue(output, OptionalStringWrapper); - } - if (optionalBytesWrapper_ != null) { - _single_optionalBytesWrapper_codec.WriteTagAndValue(output, OptionalBytesWrapper); - } - repeatedBoolWrapper_.WriteTo(output, _repeated_repeatedBoolWrapper_codec); - repeatedInt32Wrapper_.WriteTo(output, _repeated_repeatedInt32Wrapper_codec); - repeatedInt64Wrapper_.WriteTo(output, _repeated_repeatedInt64Wrapper_codec); - repeatedUint32Wrapper_.WriteTo(output, _repeated_repeatedUint32Wrapper_codec); - repeatedUint64Wrapper_.WriteTo(output, _repeated_repeatedUint64Wrapper_codec); - repeatedFloatWrapper_.WriteTo(output, _repeated_repeatedFloatWrapper_codec); - repeatedDoubleWrapper_.WriteTo(output, _repeated_repeatedDoubleWrapper_codec); - repeatedStringWrapper_.WriteTo(output, _repeated_repeatedStringWrapper_codec); - repeatedBytesWrapper_.WriteTo(output, _repeated_repeatedBytesWrapper_codec); - if (optionalDuration_ != null) { - output.WriteRawTag(234, 18); - output.WriteMessage(OptionalDuration); - } - if (optionalTimestamp_ != null) { - output.WriteRawTag(242, 18); - output.WriteMessage(OptionalTimestamp); - } - if (optionalFieldMask_ != null) { - output.WriteRawTag(250, 18); - output.WriteMessage(OptionalFieldMask); - } - if (optionalStruct_ != null) { - output.WriteRawTag(130, 19); - output.WriteMessage(OptionalStruct); - } - if (optionalAny_ != null) { - output.WriteRawTag(138, 19); - output.WriteMessage(OptionalAny); - } - if (optionalValue_ != null) { - output.WriteRawTag(146, 19); - output.WriteMessage(OptionalValue); - } - repeatedDuration_.WriteTo(output, _repeated_repeatedDuration_codec); - repeatedTimestamp_.WriteTo(output, _repeated_repeatedTimestamp_codec); - repeatedFieldmask_.WriteTo(output, _repeated_repeatedFieldmask_codec); - repeatedAny_.WriteTo(output, _repeated_repeatedAny_codec); - repeatedValue_.WriteTo(output, _repeated_repeatedValue_codec); - repeatedStruct_.WriteTo(output, _repeated_repeatedStruct_codec); - if (Fieldname1 != 0) { - output.WriteRawTag(136, 25); - output.WriteInt32(Fieldname1); - } - if (FieldName2 != 0) { - output.WriteRawTag(144, 25); - output.WriteInt32(FieldName2); - } - if (FieldName3 != 0) { - output.WriteRawTag(152, 25); - output.WriteInt32(FieldName3); - } - if (FieldName4 != 0) { - output.WriteRawTag(160, 25); - output.WriteInt32(FieldName4); - } - if (Field0Name5 != 0) { - output.WriteRawTag(168, 25); - output.WriteInt32(Field0Name5); - } - if (Field0Name6 != 0) { - output.WriteRawTag(176, 25); - output.WriteInt32(Field0Name6); - } - if (FieldName7 != 0) { - output.WriteRawTag(184, 25); - output.WriteInt32(FieldName7); - } - if (FieldName8 != 0) { - output.WriteRawTag(192, 25); - output.WriteInt32(FieldName8); - } - if (FieldName9 != 0) { - output.WriteRawTag(200, 25); - output.WriteInt32(FieldName9); - } - if (FieldName10 != 0) { - output.WriteRawTag(208, 25); - output.WriteInt32(FieldName10); - } - if (FIELDNAME11 != 0) { - output.WriteRawTag(216, 25); - output.WriteInt32(FIELDNAME11); - } - if (FIELDName12 != 0) { - output.WriteRawTag(224, 25); - output.WriteInt32(FIELDName12); - } - } - - public int CalculateSize() { - int size = 0; - if (OptionalInt32 != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32); - } - if (OptionalInt64 != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(OptionalInt64); - } - if (OptionalUint32 != 0) { - size += 1 + pb::CodedOutputStream.ComputeUInt32Size(OptionalUint32); - } - if (OptionalUint64 != 0UL) { - size += 1 + pb::CodedOutputStream.ComputeUInt64Size(OptionalUint64); - } - if (OptionalSint32 != 0) { - size += 1 + pb::CodedOutputStream.ComputeSInt32Size(OptionalSint32); - } - if (OptionalSint64 != 0L) { - size += 1 + pb::CodedOutputStream.ComputeSInt64Size(OptionalSint64); - } - if (OptionalFixed32 != 0) { - size += 1 + 4; - } - if (OptionalFixed64 != 0UL) { - size += 1 + 8; - } - if (OptionalSfixed32 != 0) { - size += 1 + 4; - } - if (OptionalSfixed64 != 0L) { - size += 1 + 8; - } - if (OptionalFloat != 0F) { - size += 1 + 4; - } - if (OptionalDouble != 0D) { - size += 1 + 8; - } - if (OptionalBool != false) { - size += 1 + 1; - } - if (OptionalString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OptionalString); - } - if (OptionalBytes.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(OptionalBytes); - } - if (optionalNestedMessage_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage); - } - if (optionalForeignMessage_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalForeignMessage); - } - if (OptionalNestedEnum != 0) { - size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalNestedEnum); - } - if (OptionalForeignEnum != 0) { - size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalForeignEnum); - } - if (OptionalStringPiece.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalStringPiece); - } - if (OptionalCord.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalCord); - } - if (recursiveMessage_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(RecursiveMessage); - } - size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec); - size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec); - size += repeatedUint32_.CalculateSize(_repeated_repeatedUint32_codec); - size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec); - size += repeatedSint32_.CalculateSize(_repeated_repeatedSint32_codec); - size += repeatedSint64_.CalculateSize(_repeated_repeatedSint64_codec); - size += repeatedFixed32_.CalculateSize(_repeated_repeatedFixed32_codec); - size += repeatedFixed64_.CalculateSize(_repeated_repeatedFixed64_codec); - size += repeatedSfixed32_.CalculateSize(_repeated_repeatedSfixed32_codec); - size += repeatedSfixed64_.CalculateSize(_repeated_repeatedSfixed64_codec); - size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec); - size += repeatedDouble_.CalculateSize(_repeated_repeatedDouble_codec); - size += repeatedBool_.CalculateSize(_repeated_repeatedBool_codec); - size += repeatedString_.CalculateSize(_repeated_repeatedString_codec); - size += repeatedBytes_.CalculateSize(_repeated_repeatedBytes_codec); - size += repeatedNestedMessage_.CalculateSize(_repeated_repeatedNestedMessage_codec); - size += repeatedForeignMessage_.CalculateSize(_repeated_repeatedForeignMessage_codec); - size += repeatedNestedEnum_.CalculateSize(_repeated_repeatedNestedEnum_codec); - size += repeatedForeignEnum_.CalculateSize(_repeated_repeatedForeignEnum_codec); - size += repeatedStringPiece_.CalculateSize(_repeated_repeatedStringPiece_codec); - size += repeatedCord_.CalculateSize(_repeated_repeatedCord_codec); - size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec); - size += mapInt64Int64_.CalculateSize(_map_mapInt64Int64_codec); - size += mapUint32Uint32_.CalculateSize(_map_mapUint32Uint32_codec); - size += mapUint64Uint64_.CalculateSize(_map_mapUint64Uint64_codec); - size += mapSint32Sint32_.CalculateSize(_map_mapSint32Sint32_codec); - size += mapSint64Sint64_.CalculateSize(_map_mapSint64Sint64_codec); - size += mapFixed32Fixed32_.CalculateSize(_map_mapFixed32Fixed32_codec); - size += mapFixed64Fixed64_.CalculateSize(_map_mapFixed64Fixed64_codec); - size += mapSfixed32Sfixed32_.CalculateSize(_map_mapSfixed32Sfixed32_codec); - size += mapSfixed64Sfixed64_.CalculateSize(_map_mapSfixed64Sfixed64_codec); - size += mapInt32Float_.CalculateSize(_map_mapInt32Float_codec); - size += mapInt32Double_.CalculateSize(_map_mapInt32Double_codec); - size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec); - size += mapStringString_.CalculateSize(_map_mapStringString_codec); - size += mapStringBytes_.CalculateSize(_map_mapStringBytes_codec); - size += mapStringNestedMessage_.CalculateSize(_map_mapStringNestedMessage_codec); - size += mapStringForeignMessage_.CalculateSize(_map_mapStringForeignMessage_codec); - size += mapStringNestedEnum_.CalculateSize(_map_mapStringNestedEnum_codec); - size += mapStringForeignEnum_.CalculateSize(_map_mapStringForeignEnum_codec); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { - size += 2 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32); - } - if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OneofNestedMessage); - } - if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(OneofString); - } - if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { - size += 2 + pb::CodedOutputStream.ComputeBytesSize(OneofBytes); - } - if (optionalBoolWrapper_ != null) { - size += _single_optionalBoolWrapper_codec.CalculateSizeWithTag(OptionalBoolWrapper); - } - if (optionalInt32Wrapper_ != null) { - size += _single_optionalInt32Wrapper_codec.CalculateSizeWithTag(OptionalInt32Wrapper); - } - if (optionalInt64Wrapper_ != null) { - size += _single_optionalInt64Wrapper_codec.CalculateSizeWithTag(OptionalInt64Wrapper); - } - if (optionalUint32Wrapper_ != null) { - size += _single_optionalUint32Wrapper_codec.CalculateSizeWithTag(OptionalUint32Wrapper); - } - if (optionalUint64Wrapper_ != null) { - size += _single_optionalUint64Wrapper_codec.CalculateSizeWithTag(OptionalUint64Wrapper); - } - if (optionalFloatWrapper_ != null) { - size += _single_optionalFloatWrapper_codec.CalculateSizeWithTag(OptionalFloatWrapper); - } - if (optionalDoubleWrapper_ != null) { - size += _single_optionalDoubleWrapper_codec.CalculateSizeWithTag(OptionalDoubleWrapper); - } - if (optionalStringWrapper_ != null) { - size += _single_optionalStringWrapper_codec.CalculateSizeWithTag(OptionalStringWrapper); - } - if (optionalBytesWrapper_ != null) { - size += _single_optionalBytesWrapper_codec.CalculateSizeWithTag(OptionalBytesWrapper); - } - size += repeatedBoolWrapper_.CalculateSize(_repeated_repeatedBoolWrapper_codec); - size += repeatedInt32Wrapper_.CalculateSize(_repeated_repeatedInt32Wrapper_codec); - size += repeatedInt64Wrapper_.CalculateSize(_repeated_repeatedInt64Wrapper_codec); - size += repeatedUint32Wrapper_.CalculateSize(_repeated_repeatedUint32Wrapper_codec); - size += repeatedUint64Wrapper_.CalculateSize(_repeated_repeatedUint64Wrapper_codec); - size += repeatedFloatWrapper_.CalculateSize(_repeated_repeatedFloatWrapper_codec); - size += repeatedDoubleWrapper_.CalculateSize(_repeated_repeatedDoubleWrapper_codec); - size += repeatedStringWrapper_.CalculateSize(_repeated_repeatedStringWrapper_codec); - size += repeatedBytesWrapper_.CalculateSize(_repeated_repeatedBytesWrapper_codec); - if (optionalDuration_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalDuration); - } - if (optionalTimestamp_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalTimestamp); - } - if (optionalFieldMask_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalFieldMask); - } - if (optionalStruct_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalStruct); - } - if (optionalAny_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalAny); - } - if (optionalValue_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalValue); - } - size += repeatedDuration_.CalculateSize(_repeated_repeatedDuration_codec); - size += repeatedTimestamp_.CalculateSize(_repeated_repeatedTimestamp_codec); - size += repeatedFieldmask_.CalculateSize(_repeated_repeatedFieldmask_codec); - size += repeatedStruct_.CalculateSize(_repeated_repeatedStruct_codec); - size += repeatedAny_.CalculateSize(_repeated_repeatedAny_codec); - size += repeatedValue_.CalculateSize(_repeated_repeatedValue_codec); - if (Fieldname1 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(Fieldname1); - } - if (FieldName2 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName2); - } - if (FieldName3 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName3); - } - if (FieldName4 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName4); - } - if (Field0Name5 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field0Name5); - } - if (Field0Name6 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field0Name6); - } - if (FieldName7 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName7); - } - if (FieldName8 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName8); - } - if (FieldName9 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName9); - } - if (FieldName10 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName10); - } - if (FIELDNAME11 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FIELDNAME11); - } - if (FIELDName12 != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32Size(FIELDName12); - } - return size; - } - - public void MergeFrom(TestAllTypes other) { - if (other == null) { - return; - } - if (other.OptionalInt32 != 0) { - OptionalInt32 = other.OptionalInt32; - } - if (other.OptionalInt64 != 0L) { - OptionalInt64 = other.OptionalInt64; - } - if (other.OptionalUint32 != 0) { - OptionalUint32 = other.OptionalUint32; - } - if (other.OptionalUint64 != 0UL) { - OptionalUint64 = other.OptionalUint64; - } - if (other.OptionalSint32 != 0) { - OptionalSint32 = other.OptionalSint32; - } - if (other.OptionalSint64 != 0L) { - OptionalSint64 = other.OptionalSint64; - } - if (other.OptionalFixed32 != 0) { - OptionalFixed32 = other.OptionalFixed32; - } - if (other.OptionalFixed64 != 0UL) { - OptionalFixed64 = other.OptionalFixed64; - } - if (other.OptionalSfixed32 != 0) { - OptionalSfixed32 = other.OptionalSfixed32; - } - if (other.OptionalSfixed64 != 0L) { - OptionalSfixed64 = other.OptionalSfixed64; - } - if (other.OptionalFloat != 0F) { - OptionalFloat = other.OptionalFloat; - } - if (other.OptionalDouble != 0D) { - OptionalDouble = other.OptionalDouble; - } - if (other.OptionalBool != false) { - OptionalBool = other.OptionalBool; - } - if (other.OptionalString.Length != 0) { - OptionalString = other.OptionalString; - } - if (other.OptionalBytes.Length != 0) { - OptionalBytes = other.OptionalBytes; - } - if (other.optionalNestedMessage_ != null) { - if (optionalNestedMessage_ == null) { - optionalNestedMessage_ = new global::Conformance.TestAllTypes.Types.NestedMessage(); - } - OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage); - } - if (other.optionalForeignMessage_ != null) { - if (optionalForeignMessage_ == null) { - optionalForeignMessage_ = new global::Conformance.ForeignMessage(); - } - OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage); - } - if (other.OptionalNestedEnum != 0) { - OptionalNestedEnum = other.OptionalNestedEnum; - } - if (other.OptionalForeignEnum != 0) { - OptionalForeignEnum = other.OptionalForeignEnum; - } - if (other.OptionalStringPiece.Length != 0) { - OptionalStringPiece = other.OptionalStringPiece; - } - if (other.OptionalCord.Length != 0) { - OptionalCord = other.OptionalCord; - } - if (other.recursiveMessage_ != null) { - if (recursiveMessage_ == null) { - recursiveMessage_ = new global::Conformance.TestAllTypes(); - } - RecursiveMessage.MergeFrom(other.RecursiveMessage); - } - repeatedInt32_.Add(other.repeatedInt32_); - repeatedInt64_.Add(other.repeatedInt64_); - repeatedUint32_.Add(other.repeatedUint32_); - repeatedUint64_.Add(other.repeatedUint64_); - repeatedSint32_.Add(other.repeatedSint32_); - repeatedSint64_.Add(other.repeatedSint64_); - repeatedFixed32_.Add(other.repeatedFixed32_); - repeatedFixed64_.Add(other.repeatedFixed64_); - repeatedSfixed32_.Add(other.repeatedSfixed32_); - repeatedSfixed64_.Add(other.repeatedSfixed64_); - repeatedFloat_.Add(other.repeatedFloat_); - repeatedDouble_.Add(other.repeatedDouble_); - repeatedBool_.Add(other.repeatedBool_); - repeatedString_.Add(other.repeatedString_); - repeatedBytes_.Add(other.repeatedBytes_); - repeatedNestedMessage_.Add(other.repeatedNestedMessage_); - repeatedForeignMessage_.Add(other.repeatedForeignMessage_); - repeatedNestedEnum_.Add(other.repeatedNestedEnum_); - repeatedForeignEnum_.Add(other.repeatedForeignEnum_); - repeatedStringPiece_.Add(other.repeatedStringPiece_); - repeatedCord_.Add(other.repeatedCord_); - mapInt32Int32_.Add(other.mapInt32Int32_); - mapInt64Int64_.Add(other.mapInt64Int64_); - mapUint32Uint32_.Add(other.mapUint32Uint32_); - mapUint64Uint64_.Add(other.mapUint64Uint64_); - mapSint32Sint32_.Add(other.mapSint32Sint32_); - mapSint64Sint64_.Add(other.mapSint64Sint64_); - mapFixed32Fixed32_.Add(other.mapFixed32Fixed32_); - mapFixed64Fixed64_.Add(other.mapFixed64Fixed64_); - mapSfixed32Sfixed32_.Add(other.mapSfixed32Sfixed32_); - mapSfixed64Sfixed64_.Add(other.mapSfixed64Sfixed64_); - mapInt32Float_.Add(other.mapInt32Float_); - mapInt32Double_.Add(other.mapInt32Double_); - mapBoolBool_.Add(other.mapBoolBool_); - mapStringString_.Add(other.mapStringString_); - mapStringBytes_.Add(other.mapStringBytes_); - mapStringNestedMessage_.Add(other.mapStringNestedMessage_); - mapStringForeignMessage_.Add(other.mapStringForeignMessage_); - mapStringNestedEnum_.Add(other.mapStringNestedEnum_); - mapStringForeignEnum_.Add(other.mapStringForeignEnum_); - if (other.optionalBoolWrapper_ != null) { - if (optionalBoolWrapper_ == null || other.OptionalBoolWrapper != false) { - OptionalBoolWrapper = other.OptionalBoolWrapper; - } - } - if (other.optionalInt32Wrapper_ != null) { - if (optionalInt32Wrapper_ == null || other.OptionalInt32Wrapper != 0) { - OptionalInt32Wrapper = other.OptionalInt32Wrapper; - } - } - if (other.optionalInt64Wrapper_ != null) { - if (optionalInt64Wrapper_ == null || other.OptionalInt64Wrapper != 0L) { - OptionalInt64Wrapper = other.OptionalInt64Wrapper; - } - } - if (other.optionalUint32Wrapper_ != null) { - if (optionalUint32Wrapper_ == null || other.OptionalUint32Wrapper != 0) { - OptionalUint32Wrapper = other.OptionalUint32Wrapper; - } - } - if (other.optionalUint64Wrapper_ != null) { - if (optionalUint64Wrapper_ == null || other.OptionalUint64Wrapper != 0UL) { - OptionalUint64Wrapper = other.OptionalUint64Wrapper; - } - } - if (other.optionalFloatWrapper_ != null) { - if (optionalFloatWrapper_ == null || other.OptionalFloatWrapper != 0F) { - OptionalFloatWrapper = other.OptionalFloatWrapper; - } - } - if (other.optionalDoubleWrapper_ != null) { - if (optionalDoubleWrapper_ == null || other.OptionalDoubleWrapper != 0D) { - OptionalDoubleWrapper = other.OptionalDoubleWrapper; - } - } - if (other.optionalStringWrapper_ != null) { - if (optionalStringWrapper_ == null || other.OptionalStringWrapper != "") { - OptionalStringWrapper = other.OptionalStringWrapper; - } - } - if (other.optionalBytesWrapper_ != null) { - if (optionalBytesWrapper_ == null || other.OptionalBytesWrapper != pb::ByteString.Empty) { - OptionalBytesWrapper = other.OptionalBytesWrapper; - } - } - repeatedBoolWrapper_.Add(other.repeatedBoolWrapper_); - repeatedInt32Wrapper_.Add(other.repeatedInt32Wrapper_); - repeatedInt64Wrapper_.Add(other.repeatedInt64Wrapper_); - repeatedUint32Wrapper_.Add(other.repeatedUint32Wrapper_); - repeatedUint64Wrapper_.Add(other.repeatedUint64Wrapper_); - repeatedFloatWrapper_.Add(other.repeatedFloatWrapper_); - repeatedDoubleWrapper_.Add(other.repeatedDoubleWrapper_); - repeatedStringWrapper_.Add(other.repeatedStringWrapper_); - repeatedBytesWrapper_.Add(other.repeatedBytesWrapper_); - if (other.optionalDuration_ != null) { - if (optionalDuration_ == null) { - optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - OptionalDuration.MergeFrom(other.OptionalDuration); - } - if (other.optionalTimestamp_ != null) { - if (optionalTimestamp_ == null) { - optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - OptionalTimestamp.MergeFrom(other.OptionalTimestamp); - } - if (other.optionalFieldMask_ != null) { - if (optionalFieldMask_ == null) { - optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); - } - OptionalFieldMask.MergeFrom(other.OptionalFieldMask); - } - if (other.optionalStruct_ != null) { - if (optionalStruct_ == null) { - optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - OptionalStruct.MergeFrom(other.OptionalStruct); - } - if (other.optionalAny_ != null) { - if (optionalAny_ == null) { - optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any(); - } - OptionalAny.MergeFrom(other.OptionalAny); - } - if (other.optionalValue_ != null) { - if (optionalValue_ == null) { - optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value(); - } - OptionalValue.MergeFrom(other.OptionalValue); - } - repeatedDuration_.Add(other.repeatedDuration_); - repeatedTimestamp_.Add(other.repeatedTimestamp_); - repeatedFieldmask_.Add(other.repeatedFieldmask_); - repeatedStruct_.Add(other.repeatedStruct_); - repeatedAny_.Add(other.repeatedAny_); - repeatedValue_.Add(other.repeatedValue_); - if (other.Fieldname1 != 0) { - Fieldname1 = other.Fieldname1; - } - if (other.FieldName2 != 0) { - FieldName2 = other.FieldName2; - } - if (other.FieldName3 != 0) { - FieldName3 = other.FieldName3; - } - if (other.FieldName4 != 0) { - FieldName4 = other.FieldName4; - } - if (other.Field0Name5 != 0) { - Field0Name5 = other.Field0Name5; - } - if (other.Field0Name6 != 0) { - Field0Name6 = other.Field0Name6; - } - if (other.FieldName7 != 0) { - FieldName7 = other.FieldName7; - } - if (other.FieldName8 != 0) { - FieldName8 = other.FieldName8; - } - if (other.FieldName9 != 0) { - FieldName9 = other.FieldName9; - } - if (other.FieldName10 != 0) { - FieldName10 = other.FieldName10; - } - if (other.FIELDNAME11 != 0) { - FIELDNAME11 = other.FIELDNAME11; - } - if (other.FIELDName12 != 0) { - FIELDName12 = other.FIELDName12; - } - switch (other.OneofFieldCase) { - case OneofFieldOneofCase.OneofUint32: - OneofUint32 = other.OneofUint32; - break; - case OneofFieldOneofCase.OneofNestedMessage: - OneofNestedMessage = other.OneofNestedMessage; - break; - case OneofFieldOneofCase.OneofString: - OneofString = other.OneofString; - break; - case OneofFieldOneofCase.OneofBytes: - OneofBytes = other.OneofBytes; - break; - } - - } - - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - OptionalInt32 = input.ReadInt32(); - break; - } - case 16: { - OptionalInt64 = input.ReadInt64(); - break; - } - case 24: { - OptionalUint32 = input.ReadUInt32(); - break; - } - case 32: { - OptionalUint64 = input.ReadUInt64(); - break; - } - case 40: { - OptionalSint32 = input.ReadSInt32(); - break; - } - case 48: { - OptionalSint64 = input.ReadSInt64(); - break; - } - case 61: { - OptionalFixed32 = input.ReadFixed32(); - break; - } - case 65: { - OptionalFixed64 = input.ReadFixed64(); - break; - } - case 77: { - OptionalSfixed32 = input.ReadSFixed32(); - break; - } - case 81: { - OptionalSfixed64 = input.ReadSFixed64(); - break; - } - case 93: { - OptionalFloat = input.ReadFloat(); - break; - } - case 97: { - OptionalDouble = input.ReadDouble(); - break; - } - case 104: { - OptionalBool = input.ReadBool(); - break; - } - case 114: { - OptionalString = input.ReadString(); - break; - } - case 122: { - OptionalBytes = input.ReadBytes(); - break; - } - case 146: { - if (optionalNestedMessage_ == null) { - optionalNestedMessage_ = new global::Conformance.TestAllTypes.Types.NestedMessage(); - } - input.ReadMessage(optionalNestedMessage_); - break; - } - case 154: { - if (optionalForeignMessage_ == null) { - optionalForeignMessage_ = new global::Conformance.ForeignMessage(); - } - input.ReadMessage(optionalForeignMessage_); - break; - } - case 168: { - optionalNestedEnum_ = (global::Conformance.TestAllTypes.Types.NestedEnum) input.ReadEnum(); - break; - } - case 176: { - optionalForeignEnum_ = (global::Conformance.ForeignEnum) input.ReadEnum(); - break; - } - case 194: { - OptionalStringPiece = input.ReadString(); - break; - } - case 202: { - OptionalCord = input.ReadString(); - break; - } - case 218: { - if (recursiveMessage_ == null) { - recursiveMessage_ = new global::Conformance.TestAllTypes(); - } - input.ReadMessage(recursiveMessage_); - break; - } - case 250: - case 248: { - repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec); - break; - } - case 258: - case 256: { - repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec); - break; - } - case 266: - case 264: { - repeatedUint32_.AddEntriesFrom(input, _repeated_repeatedUint32_codec); - break; - } - case 274: - case 272: { - repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec); - break; - } - case 282: - case 280: { - repeatedSint32_.AddEntriesFrom(input, _repeated_repeatedSint32_codec); - break; - } - case 290: - case 288: { - repeatedSint64_.AddEntriesFrom(input, _repeated_repeatedSint64_codec); - break; - } - case 298: - case 301: { - repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec); - break; - } - case 306: - case 305: { - repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec); - break; - } - case 314: - case 317: { - repeatedSfixed32_.AddEntriesFrom(input, _repeated_repeatedSfixed32_codec); - break; - } - case 322: - case 321: { - repeatedSfixed64_.AddEntriesFrom(input, _repeated_repeatedSfixed64_codec); - break; - } - case 330: - case 333: { - repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec); - break; - } - case 338: - case 337: { - repeatedDouble_.AddEntriesFrom(input, _repeated_repeatedDouble_codec); - break; - } - case 346: - case 344: { - repeatedBool_.AddEntriesFrom(input, _repeated_repeatedBool_codec); - break; - } - case 354: { - repeatedString_.AddEntriesFrom(input, _repeated_repeatedString_codec); - break; - } - case 362: { - repeatedBytes_.AddEntriesFrom(input, _repeated_repeatedBytes_codec); - break; - } - case 386: { - repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec); - break; - } - case 394: { - repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec); - break; - } - case 410: - case 408: { - repeatedNestedEnum_.AddEntriesFrom(input, _repeated_repeatedNestedEnum_codec); - break; - } - case 418: - case 416: { - repeatedForeignEnum_.AddEntriesFrom(input, _repeated_repeatedForeignEnum_codec); - break; - } - case 434: { - repeatedStringPiece_.AddEntriesFrom(input, _repeated_repeatedStringPiece_codec); - break; - } - case 442: { - repeatedCord_.AddEntriesFrom(input, _repeated_repeatedCord_codec); - break; - } - case 450: { - mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec); - break; - } - case 458: { - mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec); - break; - } - case 466: { - mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec); - break; - } - case 474: { - mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec); - break; - } - case 482: { - mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec); - break; - } - case 490: { - mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec); - break; - } - case 498: { - mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec); - break; - } - case 506: { - mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec); - break; - } - case 514: { - mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec); - break; - } - case 522: { - mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec); - break; - } - case 530: { - mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec); - break; - } - case 538: { - mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec); - break; - } - case 546: { - mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec); - break; - } - case 554: { - mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec); - break; - } - case 562: { - mapStringBytes_.AddEntriesFrom(input, _map_mapStringBytes_codec); - break; - } - case 570: { - mapStringNestedMessage_.AddEntriesFrom(input, _map_mapStringNestedMessage_codec); - break; - } - case 578: { - mapStringForeignMessage_.AddEntriesFrom(input, _map_mapStringForeignMessage_codec); - break; - } - case 586: { - mapStringNestedEnum_.AddEntriesFrom(input, _map_mapStringNestedEnum_codec); - break; - } - case 594: { - mapStringForeignEnum_.AddEntriesFrom(input, _map_mapStringForeignEnum_codec); - break; - } - case 888: { - OneofUint32 = input.ReadUInt32(); - break; - } - case 898: { - global::Conformance.TestAllTypes.Types.NestedMessage subBuilder = new global::Conformance.TestAllTypes.Types.NestedMessage(); - if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { - subBuilder.MergeFrom(OneofNestedMessage); - } - input.ReadMessage(subBuilder); - OneofNestedMessage = subBuilder; - break; - } - case 906: { - OneofString = input.ReadString(); - break; - } - case 914: { - OneofBytes = input.ReadBytes(); - break; - } - case 1610: { - bool? value = _single_optionalBoolWrapper_codec.Read(input); - if (optionalBoolWrapper_ == null || value != false) { - OptionalBoolWrapper = value; - } - break; - } - case 1618: { - int? value = _single_optionalInt32Wrapper_codec.Read(input); - if (optionalInt32Wrapper_ == null || value != 0) { - OptionalInt32Wrapper = value; - } - break; - } - case 1626: { - long? value = _single_optionalInt64Wrapper_codec.Read(input); - if (optionalInt64Wrapper_ == null || value != 0L) { - OptionalInt64Wrapper = value; - } - break; - } - case 1634: { - uint? value = _single_optionalUint32Wrapper_codec.Read(input); - if (optionalUint32Wrapper_ == null || value != 0) { - OptionalUint32Wrapper = value; - } - break; - } - case 1642: { - ulong? value = _single_optionalUint64Wrapper_codec.Read(input); - if (optionalUint64Wrapper_ == null || value != 0UL) { - OptionalUint64Wrapper = value; - } - break; - } - case 1650: { - float? value = _single_optionalFloatWrapper_codec.Read(input); - if (optionalFloatWrapper_ == null || value != 0F) { - OptionalFloatWrapper = value; - } - break; - } - case 1658: { - double? value = _single_optionalDoubleWrapper_codec.Read(input); - if (optionalDoubleWrapper_ == null || value != 0D) { - OptionalDoubleWrapper = value; - } - break; - } - case 1666: { - string value = _single_optionalStringWrapper_codec.Read(input); - if (optionalStringWrapper_ == null || value != "") { - OptionalStringWrapper = value; - } - break; - } - case 1674: { - pb::ByteString value = _single_optionalBytesWrapper_codec.Read(input); - if (optionalBytesWrapper_ == null || value != pb::ByteString.Empty) { - OptionalBytesWrapper = value; - } - break; - } - case 1690: { - repeatedBoolWrapper_.AddEntriesFrom(input, _repeated_repeatedBoolWrapper_codec); - break; - } - case 1698: { - repeatedInt32Wrapper_.AddEntriesFrom(input, _repeated_repeatedInt32Wrapper_codec); - break; - } - case 1706: { - repeatedInt64Wrapper_.AddEntriesFrom(input, _repeated_repeatedInt64Wrapper_codec); - break; - } - case 1714: { - repeatedUint32Wrapper_.AddEntriesFrom(input, _repeated_repeatedUint32Wrapper_codec); - break; - } - case 1722: { - repeatedUint64Wrapper_.AddEntriesFrom(input, _repeated_repeatedUint64Wrapper_codec); - break; - } - case 1730: { - repeatedFloatWrapper_.AddEntriesFrom(input, _repeated_repeatedFloatWrapper_codec); - break; - } - case 1738: { - repeatedDoubleWrapper_.AddEntriesFrom(input, _repeated_repeatedDoubleWrapper_codec); - break; - } - case 1746: { - repeatedStringWrapper_.AddEntriesFrom(input, _repeated_repeatedStringWrapper_codec); - break; - } - case 1754: { - repeatedBytesWrapper_.AddEntriesFrom(input, _repeated_repeatedBytesWrapper_codec); - break; - } - case 2410: { - if (optionalDuration_ == null) { - optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration(); - } - input.ReadMessage(optionalDuration_); - break; - } - case 2418: { - if (optionalTimestamp_ == null) { - optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); - } - input.ReadMessage(optionalTimestamp_); - break; - } - case 2426: { - if (optionalFieldMask_ == null) { - optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); - } - input.ReadMessage(optionalFieldMask_); - break; - } - case 2434: { - if (optionalStruct_ == null) { - optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct(); - } - input.ReadMessage(optionalStruct_); - break; - } - case 2442: { - if (optionalAny_ == null) { - optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any(); - } - input.ReadMessage(optionalAny_); - break; - } - case 2450: { - if (optionalValue_ == null) { - optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value(); - } - input.ReadMessage(optionalValue_); - break; - } - case 2490: { - repeatedDuration_.AddEntriesFrom(input, _repeated_repeatedDuration_codec); - break; - } - case 2498: { - repeatedTimestamp_.AddEntriesFrom(input, _repeated_repeatedTimestamp_codec); - break; - } - case 2506: { - repeatedFieldmask_.AddEntriesFrom(input, _repeated_repeatedFieldmask_codec); - break; - } - case 2522: { - repeatedAny_.AddEntriesFrom(input, _repeated_repeatedAny_codec); - break; - } - case 2530: { - repeatedValue_.AddEntriesFrom(input, _repeated_repeatedValue_codec); - break; - } - case 2594: { - repeatedStruct_.AddEntriesFrom(input, _repeated_repeatedStruct_codec); - break; - } - case 3208: { - Fieldname1 = input.ReadInt32(); - break; - } - case 3216: { - FieldName2 = input.ReadInt32(); - break; - } - case 3224: { - FieldName3 = input.ReadInt32(); - break; - } - case 3232: { - FieldName4 = input.ReadInt32(); - break; - } - case 3240: { - Field0Name5 = input.ReadInt32(); - break; - } - case 3248: { - Field0Name6 = input.ReadInt32(); - break; - } - case 3256: { - FieldName7 = input.ReadInt32(); - break; - } - case 3264: { - FieldName8 = input.ReadInt32(); - break; - } - case 3272: { - FieldName9 = input.ReadInt32(); - break; - } - case 3280: { - FieldName10 = input.ReadInt32(); - break; - } - case 3288: { - FIELDNAME11 = input.ReadInt32(); - break; - } - case 3296: { - FIELDName12 = input.ReadInt32(); - break; - } - } - } - } - - #region Nested types - /// Container for nested types declared in the TestAllTypes message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public static partial class Types { - public enum NestedEnum { - [pbr::OriginalName("FOO")] Foo = 0, - [pbr::OriginalName("BAR")] Bar = 1, - [pbr::OriginalName("BAZ")] Baz = 2, - /// - /// Intentionally negative. - /// - [pbr::OriginalName("NEG")] Neg = -1, - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class NestedMessage : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); - public static pb::MessageParser Parser { get { return _parser; } } - - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.TestAllTypes.Descriptor.NestedTypes[0]; } - } - - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - public NestedMessage() { - OnConstruction(); - } - - partial void OnConstruction(); - - public NestedMessage(NestedMessage other) : this() { - a_ = other.a_; - Corecursive = other.corecursive_ != null ? other.Corecursive.Clone() : null; - } - - public NestedMessage Clone() { - return new NestedMessage(this); - } - - /// Field number for the "a" field. - public const int AFieldNumber = 1; - private int a_; - public int A { - get { return a_; } - set { - a_ = value; - } - } - - /// Field number for the "corecursive" field. - public const int CorecursiveFieldNumber = 2; - private global::Conformance.TestAllTypes corecursive_; - public global::Conformance.TestAllTypes Corecursive { - get { return corecursive_; } - set { - corecursive_ = value; - } - } - - public override bool Equals(object other) { - return Equals(other as NestedMessage); - } - - public bool Equals(NestedMessage other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (A != other.A) return false; - if (!object.Equals(Corecursive, other.Corecursive)) return false; - return true; - } - - public override int GetHashCode() { - int hash = 1; - if (A != 0) hash ^= A.GetHashCode(); - if (corecursive_ != null) hash ^= Corecursive.GetHashCode(); - return hash; - } - - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - public void WriteTo(pb::CodedOutputStream output) { - if (A != 0) { - output.WriteRawTag(8); - output.WriteInt32(A); - } - if (corecursive_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Corecursive); - } - } - - public int CalculateSize() { - int size = 0; - if (A != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(A); - } - if (corecursive_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Corecursive); - } - return size; - } - - public void MergeFrom(NestedMessage other) { - if (other == null) { - return; - } - if (other.A != 0) { - A = other.A; - } - if (other.corecursive_ != null) { - if (corecursive_ == null) { - corecursive_ = new global::Conformance.TestAllTypes(); - } - Corecursive.MergeFrom(other.Corecursive); - } - } - - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - A = input.ReadInt32(); - break; - } - case 18: { - if (corecursive_ == null) { - corecursive_ = new global::Conformance.TestAllTypes(); - } - input.ReadMessage(corecursive_); - break; - } - } - } - } - - } - - } - #endregion - - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class ForeignMessage : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ForeignMessage()); - public static pb::MessageParser Parser { get { return _parser; } } - - public static pbr::MessageDescriptor Descriptor { - get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[3]; } - } - - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - public ForeignMessage() { - OnConstruction(); - } - - partial void OnConstruction(); - - public ForeignMessage(ForeignMessage other) : this() { - c_ = other.c_; - } - - public ForeignMessage Clone() { - return new ForeignMessage(this); - } - - /// Field number for the "c" field. - public const int CFieldNumber = 1; - private int c_; - public int C { - get { return c_; } - set { - c_ = value; - } - } - - public override bool Equals(object other) { - return Equals(other as ForeignMessage); - } - - public bool Equals(ForeignMessage other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (C != other.C) return false; - return true; - } - - public override int GetHashCode() { - int hash = 1; - if (C != 0) hash ^= C.GetHashCode(); - return hash; - } - - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - public void WriteTo(pb::CodedOutputStream output) { - if (C != 0) { - output.WriteRawTag(8); - output.WriteInt32(C); - } - } - - public int CalculateSize() { - int size = 0; - if (C != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(C); - } - return size; - } - - public void MergeFrom(ForeignMessage other) { - if (other == null) { - return; - } - if (other.C != 0) { - C = other.C; - } - } - - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - C = input.ReadInt32(); - break; - } - } - } - } - - } - #endregion } diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj index 82f728d192..b654c0b2cf 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj @@ -1,61 +1,14 @@ - - - + + - Debug - AnyCPU - {0607D1B8-80D6-4B35-9857-1263C1B32B94} + netcoreapp1.0 Exe - Properties - Google.Protobuf.Conformance - Google.Protobuf.Conformance - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 + False + - - - + + - - - - - - - - - - - {6908bdce-d925-43f3-94ac-a531e6df2591} - Google.Protobuf - - - - - \ No newline at end of file + + diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs index 19827c4844..00ee64f8a5 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Conformance/Program.cs @@ -48,7 +48,7 @@ namespace Google.Protobuf.Conformance // This way we get the binary streams instead of readers/writers. var input = new BinaryReader(Console.OpenStandardInput()); var output = new BinaryWriter(Console.OpenStandardOutput()); - var typeRegistry = TypeRegistry.FromMessages(TestAllTypes.Descriptor); + var typeRegistry = TypeRegistry.FromMessages(ProtobufTestMessages.Proto3.TestAllTypes.Descriptor); int count = 0; while (RunTest(input, output, typeRegistry)) @@ -81,17 +81,17 @@ namespace Google.Protobuf.Conformance private static ConformanceResponse PerformRequest(ConformanceRequest request, TypeRegistry typeRegistry) { - TestAllTypes message; + ProtobufTestMessages.Proto3.TestAllTypes message; try { switch (request.PayloadCase) { case ConformanceRequest.PayloadOneofCase.JsonPayload: var parser = new JsonParser(new JsonParser.Settings(20, typeRegistry)); - message = parser.Parse(request.JsonPayload); + message = parser.Parse(request.JsonPayload); break; case ConformanceRequest.PayloadOneofCase.ProtobufPayload: - message = TestAllTypes.Parser.ParseFrom(request.ProtobufPayload); + message = ProtobufTestMessages.Proto3.TestAllTypes.Parser.ParseFrom(request.ProtobufPayload); break; default: throw new Exception("Unsupported request payload: " + request.PayloadCase); diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj b/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj index 67acf66d4b..4eda641ad6 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj @@ -1,68 +1,13 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {D7282E99-2DC3-405B-946F-177DB2FD2AE2} + netcoreapp1.0 Exe - Properties - Google.Protobuf.JsonDump - Google.Protobuf.JsonDump - v4.5 - 512 - - - - - true - full - false - bin\Debug - obj\Debug\ - DEBUG;TRACE - prompt - 4 - true - Off - false - - - pdbonly - true - bin\Release - obj\Release\ - TRACE - prompt - 4 - true - Off - false + False + - - + - - - - - - - {6908BDCE-D925-43F3-94AC-A531E6DF2591} - Google.Protobuf - - - - - - - - \ No newline at end of file + + diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Program.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Program.cs index e8a6073e2b..296b2f3f1e 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Program.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Program.cs @@ -1,72 +1,73 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; - -namespace Google.Protobuf.ProtoDump -{ - /// - /// Small utility to load a binary message and dump it in JSON format. - /// - internal class Program - { - private static int Main(string[] args) - { - if (args.Length != 2) - { - Console.Error.WriteLine("Usage: Google.Protobuf.JsonDump "); - Console.Error.WriteLine("The descriptor type name is the fully-qualified message name,"); - Console.Error.WriteLine("including assembly e.g. ProjectNamespace.Message,Company.Project"); - return 1; - } - Type type = Type.GetType(args[0]); - if (type == null) - { - Console.Error.WriteLine("Unable to load type {0}.", args[0]); - return 1; - } - if (!typeof(IMessage).IsAssignableFrom(type)) - { - Console.Error.WriteLine("Type {0} doesn't implement IMessage.", args[0]); - return 1; - } - IMessage message = (IMessage) Activator.CreateInstance(type); - using (var input = File.OpenRead(args[1])) - { - message.MergeFrom(input); - } - Console.WriteLine(message); - return 0; - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using System.Reflection; + +namespace Google.Protobuf.ProtoDump +{ + /// + /// Small utility to load a binary message and dump it in JSON format. + /// + internal class Program + { + private static int Main(string[] args) + { + if (args.Length != 2) + { + Console.Error.WriteLine("Usage: Google.Protobuf.JsonDump "); + Console.Error.WriteLine("The descriptor type name is the fully-qualified message name,"); + Console.Error.WriteLine("including assembly e.g. ProjectNamespace.Message,Company.Project"); + return 1; + } + Type type = Type.GetType(args[0]); + if (type == null) + { + Console.Error.WriteLine("Unable to load type {0}.", args[0]); + return 1; + } + if (!typeof(IMessage).GetTypeInfo().IsAssignableFrom(type)) + { + Console.Error.WriteLine("Type {0} doesn't implement IMessage.", args[0]); + return 1; + } + IMessage message = (IMessage) Activator.CreateInstance(type); + using (var input = File.OpenRead(args[1])) + { + message.MergeFrom(input); + } + Console.WriteLine(message); + return 0; + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs deleted file mode 100644 index 0a29d2d472..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("ProtoDump")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ProtoDump")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/app.config b/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/app.config deleted file mode 100644 index 51278a4563..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.JsonDump/app.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/ByteStringTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/ByteStringTest.cs old mode 100644 new mode 100755 index 8935b7829d..afdd491f36 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/ByteStringTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/ByteStringTest.cs @@ -1,171 +1,237 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Text; -using NUnit.Framework; - -namespace Google.Protobuf -{ - public class ByteStringTest - { - [Test] - public void Equality() - { - ByteString b1 = ByteString.CopyFrom(1, 2, 3); - ByteString b2 = ByteString.CopyFrom(1, 2, 3); - ByteString b3 = ByteString.CopyFrom(1, 2, 4); - ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4); - EqualityTester.AssertEquality(b1, b1); - EqualityTester.AssertEquality(b1, b2); - EqualityTester.AssertInequality(b1, b3); - EqualityTester.AssertInequality(b1, b4); - EqualityTester.AssertInequality(b1, null); -#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1) - Assert.IsTrue(b1 == b1); - Assert.IsTrue(b1 == b2); - Assert.IsFalse(b1 == b3); - Assert.IsFalse(b1 == b4); - Assert.IsFalse(b1 == null); - Assert.IsTrue((ByteString) null == null); - Assert.IsFalse(b1 != b1); - Assert.IsFalse(b1 != b2); -#pragma warning disable 1718 - Assert.IsTrue(b1 != b3); - Assert.IsTrue(b1 != b4); - Assert.IsTrue(b1 != null); - Assert.IsFalse((ByteString) null != null); - } - - [Test] - public void EmptyByteStringHasZeroSize() - { - Assert.AreEqual(0, ByteString.Empty.Length); - } - - [Test] - public void CopyFromStringWithExplicitEncoding() - { - ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); - Assert.AreEqual(4, bs.Length); - Assert.AreEqual(65, bs[0]); - Assert.AreEqual(0, bs[1]); - Assert.AreEqual(66, bs[2]); - Assert.AreEqual(0, bs[3]); - } - - [Test] - public void IsEmptyWhenEmpty() - { - Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); - } - - [Test] - public void IsEmptyWhenNotEmpty() - { - Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); - } - - [Test] - public void CopyFromByteArrayCopiesContents() - { - byte[] data = new byte[1]; - data[0] = 10; - ByteString bs = ByteString.CopyFrom(data); - Assert.AreEqual(10, bs[0]); - data[0] = 5; - Assert.AreEqual(10, bs[0]); - } - - [Test] - public void ToByteArrayCopiesContents() - { - ByteString bs = ByteString.CopyFromUtf8("Hello"); - byte[] data = bs.ToByteArray(); - Assert.AreEqual((byte)'H', data[0]); - Assert.AreEqual((byte)'H', bs[0]); - data[0] = 0; - Assert.AreEqual(0, data[0]); - Assert.AreEqual((byte)'H', bs[0]); - } - - [Test] - public void CopyFromUtf8UsesUtf8() - { - ByteString bs = ByteString.CopyFromUtf8("\u20ac"); - Assert.AreEqual(3, bs.Length); - Assert.AreEqual(0xe2, bs[0]); - Assert.AreEqual(0x82, bs[1]); - Assert.AreEqual(0xac, bs[2]); - } - - [Test] - public void CopyFromPortion() - { - byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; - ByteString bs = ByteString.CopyFrom(data, 2, 3); - Assert.AreEqual(3, bs.Length); - Assert.AreEqual(2, bs[0]); - Assert.AreEqual(3, bs[1]); - } - - [Test] - public void ToStringUtf8() - { - ByteString bs = ByteString.CopyFromUtf8("\u20ac"); - Assert.AreEqual("\u20ac", bs.ToStringUtf8()); - } - - [Test] - public void ToStringWithExplicitEncoding() - { - ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode); - Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode)); - } - - [Test] - public void FromBase64_WithText() - { - byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; - string base64 = Convert.ToBase64String(data); - ByteString bs = ByteString.FromBase64(base64); - Assert.AreEqual(data, bs.ToByteArray()); - } - - [Test] - public void FromBase64_Empty() - { - // Optimization which also fixes issue 61. - Assert.AreSame(ByteString.Empty, ByteString.FromBase64("")); - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Text; +using NUnit.Framework; +using System.IO; +#if !NET35 +using System.Threading.Tasks; +#endif + +namespace Google.Protobuf +{ + public class ByteStringTest + { + [Test] + public void Equality() + { + ByteString b1 = ByteString.CopyFrom(1, 2, 3); + ByteString b2 = ByteString.CopyFrom(1, 2, 3); + ByteString b3 = ByteString.CopyFrom(1, 2, 4); + ByteString b4 = ByteString.CopyFrom(1, 2, 3, 4); + EqualityTester.AssertEquality(b1, b1); + EqualityTester.AssertEquality(b1, b2); + EqualityTester.AssertInequality(b1, b3); + EqualityTester.AssertInequality(b1, b4); + EqualityTester.AssertInequality(b1, null); +#pragma warning disable 1718 // Deliberately calling ==(b1, b1) and !=(b1, b1) + Assert.IsTrue(b1 == b1); + Assert.IsTrue(b1 == b2); + Assert.IsFalse(b1 == b3); + Assert.IsFalse(b1 == b4); + Assert.IsFalse(b1 == null); + Assert.IsTrue((ByteString) null == null); + Assert.IsFalse(b1 != b1); + Assert.IsFalse(b1 != b2); +#pragma warning disable 1718 + Assert.IsTrue(b1 != b3); + Assert.IsTrue(b1 != b4); + Assert.IsTrue(b1 != null); + Assert.IsFalse((ByteString) null != null); + } + + [Test] + public void EmptyByteStringHasZeroSize() + { + Assert.AreEqual(0, ByteString.Empty.Length); + } + + [Test] + public void CopyFromStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); + Assert.AreEqual(4, bs.Length); + Assert.AreEqual(65, bs[0]); + Assert.AreEqual(0, bs[1]); + Assert.AreEqual(66, bs[2]); + Assert.AreEqual(0, bs[3]); + } + + [Test] + public void IsEmptyWhenEmpty() + { + Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); + } + + [Test] + public void IsEmptyWhenNotEmpty() + { + Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); + } + + [Test] + public void CopyFromByteArrayCopiesContents() + { + byte[] data = new byte[1]; + data[0] = 10; + ByteString bs = ByteString.CopyFrom(data); + Assert.AreEqual(10, bs[0]); + data[0] = 5; + Assert.AreEqual(10, bs[0]); + } + + [Test] + public void ToByteArrayCopiesContents() + { + ByteString bs = ByteString.CopyFromUtf8("Hello"); + byte[] data = bs.ToByteArray(); + Assert.AreEqual((byte)'H', data[0]); + Assert.AreEqual((byte)'H', bs[0]); + data[0] = 0; + Assert.AreEqual(0, data[0]); + Assert.AreEqual((byte)'H', bs[0]); + } + + [Test] + public void CopyFromUtf8UsesUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(0xe2, bs[0]); + Assert.AreEqual(0x82, bs[1]); + Assert.AreEqual(0xac, bs[2]); + } + + [Test] + public void CopyFromPortion() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + ByteString bs = ByteString.CopyFrom(data, 2, 3); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(2, bs[0]); + Assert.AreEqual(3, bs[1]); + } + + [Test] + public void ToStringUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual("\u20ac", bs.ToStringUtf8()); + } + + [Test] + public void ToStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode); + Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode)); + } + + [Test] + public void FromBase64_WithText() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + string base64 = Convert.ToBase64String(data); + ByteString bs = ByteString.FromBase64(base64); + Assert.AreEqual(data, bs.ToByteArray()); + } + + [Test] + public void FromBase64_Empty() + { + // Optimization which also fixes issue 61. + Assert.AreSame(ByteString.Empty, ByteString.FromBase64("")); + } + + [Test] + public void FromStream_Seekable() + { + var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 }); + // Consume the first byte, just to test that it's "from current position" + stream.ReadByte(); + var actual = ByteString.FromStream(stream); + ByteString expected = ByteString.CopyFrom(2, 3, 4, 5); + Assert.AreEqual(expected, actual, $"{expected.ToBase64()} != {actual.ToBase64()}"); + } + + [Test] + public void FromStream_NotSeekable() + { + var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 }); + // Consume the first byte, just to test that it's "from current position" + stream.ReadByte(); + // Wrap the original stream in LimitedInputStream, which has CanSeek=false + var limitedStream = new LimitedInputStream(stream, 3); + var actual = ByteString.FromStream(limitedStream); + ByteString expected = ByteString.CopyFrom(2, 3, 4); + Assert.AreEqual(expected, actual, $"{expected.ToBase64()} != {actual.ToBase64()}"); + } + +#if !NET35 + [Test] + public async Task FromStreamAsync_Seekable() + { + var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 }); + // Consume the first byte, just to test that it's "from current position" + stream.ReadByte(); + var actual = await ByteString.FromStreamAsync(stream); + ByteString expected = ByteString.CopyFrom(2, 3, 4, 5); + Assert.AreEqual(expected, actual, $"{expected.ToBase64()} != {actual.ToBase64()}"); + } + + [Test] + public async Task FromStreamAsync_NotSeekable() + { + var stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 }); + // Consume the first byte, just to test that it's "from current position" + stream.ReadByte(); + // Wrap the original stream in LimitedInputStream, which has CanSeek=false + var limitedStream = new LimitedInputStream(stream, 3); + var actual = await ByteString.FromStreamAsync(limitedStream); + ByteString expected = ByteString.CopyFrom(2, 3, 4); + Assert.AreEqual(expected, actual, $"{expected.ToBase64()} != {actual.ToBase64()}"); + } +#endif + + [Test] + public void GetHashCode_Regression() + { + // We used to have an awful hash algorithm where only the last four + // bytes were relevant. This is a regression test for + // https://github.com/google/protobuf/issues/2511 + + ByteString b1 = ByteString.CopyFrom(100, 1, 2, 3, 4); + ByteString b2 = ByteString.CopyFrom(200, 1, 2, 3, 4); + Assert.AreNotEqual(b1.GetHashCode(), b2.GetHashCode()); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs index d628ecceb6..e719d2a090 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs @@ -1,598 +1,605 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; -using Google.Protobuf.TestProtos; -using NUnit.Framework; - -namespace Google.Protobuf -{ - public class CodedInputStreamTest - { - /// - /// Helper to construct a byte array from a bunch of bytes. The inputs are - /// actually ints so that I can use hex notation and not get stupid errors - /// about precision. - /// - private static byte[] Bytes(params int[] bytesAsInts) - { - byte[] bytes = new byte[bytesAsInts.Length]; - for (int i = 0; i < bytesAsInts.Length; i++) - { - bytes[i] = (byte) bytesAsInts[i]; - } - return bytes; - } - - /// - /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() - /// - private static void AssertReadVarint(byte[] data, ulong value) - { - CodedInputStream input = new CodedInputStream(data); - Assert.AreEqual((uint) value, input.ReadRawVarint32()); - - input = new CodedInputStream(data); - Assert.AreEqual(value, input.ReadRawVarint64()); - Assert.IsTrue(input.IsAtEnd); - - // Try different block sizes. - for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) - { - input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); - Assert.AreEqual((uint) value, input.ReadRawVarint32()); - - input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); - Assert.AreEqual(value, input.ReadRawVarint64()); - Assert.IsTrue(input.IsAtEnd); - } - - // Try reading directly from a MemoryStream. We want to verify that it - // doesn't read past the end of the input, so write an extra byte - this - // lets us test the position at the end. - MemoryStream memoryStream = new MemoryStream(); - memoryStream.Write(data, 0, data.Length); - memoryStream.WriteByte(0); - memoryStream.Position = 0; - Assert.AreEqual((uint) value, CodedInputStream.ReadRawVarint32(memoryStream)); - Assert.AreEqual(data.Length, memoryStream.Position); - } - - /// - /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and - /// expects them to fail with an InvalidProtocolBufferException whose - /// description matches the given one. - /// - private static void AssertReadVarintFailure(InvalidProtocolBufferException expected, byte[] data) - { - CodedInputStream input = new CodedInputStream(data); - var exception = Assert.Throws(() => input.ReadRawVarint32()); - Assert.AreEqual(expected.Message, exception.Message); - - input = new CodedInputStream(data); - exception = Assert.Throws(() => input.ReadRawVarint64()); - Assert.AreEqual(expected.Message, exception.Message); - - // Make sure we get the same error when reading directly from a Stream. - exception = Assert.Throws(() => CodedInputStream.ReadRawVarint32(new MemoryStream(data))); - Assert.AreEqual(expected.Message, exception.Message); - } - - [Test] - public void ReadVarint() - { - AssertReadVarint(Bytes(0x00), 0); - AssertReadVarint(Bytes(0x01), 1); - AssertReadVarint(Bytes(0x7f), 127); - // 14882 - AssertReadVarint(Bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7)); - // 2961488830 - AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b), - (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | - (0x0bL << 28)); - - // 64-bit - // 7256456126 - AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b), - (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | - (0x1bL << 28)); - // 41256202580718336 - AssertReadVarint(Bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49), - (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | - (0x43L << 28) | (0x49L << 35) | (0x24L << 42) | (0x49L << 49)); - // 11964378330978735131 - AssertReadVarint(Bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01), - (0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | - (0x3bUL << 28) | (0x56UL << 35) | (0x00UL << 42) | - (0x05UL << 49) | (0x26UL << 56) | (0x01UL << 63)); - - // Failures - AssertReadVarintFailure( - InvalidProtocolBufferException.MalformedVarint(), - Bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - 0x00)); - AssertReadVarintFailure( - InvalidProtocolBufferException.TruncatedMessage(), - Bytes(0x80)); - } - - /// - /// Parses the given bytes using ReadRawLittleEndian32() and checks - /// that the result matches the given value. - /// - private static void AssertReadLittleEndian32(byte[] data, uint value) - { - CodedInputStream input = new CodedInputStream(data); - Assert.AreEqual(value, input.ReadRawLittleEndian32()); - Assert.IsTrue(input.IsAtEnd); - - // Try different block sizes. - for (int blockSize = 1; blockSize <= 16; blockSize *= 2) - { - input = new CodedInputStream( - new SmallBlockInputStream(data, blockSize)); - Assert.AreEqual(value, input.ReadRawLittleEndian32()); - Assert.IsTrue(input.IsAtEnd); - } - } - - /// - /// Parses the given bytes using ReadRawLittleEndian64() and checks - /// that the result matches the given value. - /// - private static void AssertReadLittleEndian64(byte[] data, ulong value) - { - CodedInputStream input = new CodedInputStream(data); - Assert.AreEqual(value, input.ReadRawLittleEndian64()); - Assert.IsTrue(input.IsAtEnd); - - // Try different block sizes. - for (int blockSize = 1; blockSize <= 16; blockSize *= 2) - { - input = new CodedInputStream( - new SmallBlockInputStream(data, blockSize)); - Assert.AreEqual(value, input.ReadRawLittleEndian64()); - Assert.IsTrue(input.IsAtEnd); - } - } - - [Test] - public void ReadLittleEndian() - { - AssertReadLittleEndian32(Bytes(0x78, 0x56, 0x34, 0x12), 0x12345678); - AssertReadLittleEndian32(Bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0); - - AssertReadLittleEndian64(Bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12), - 0x123456789abcdef0L); - AssertReadLittleEndian64( - Bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678UL); - } - - [Test] - public void DecodeZigZag32() - { - Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(0)); - Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(1)); - Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(2)); - Assert.AreEqual(-2, CodedInputStream.DecodeZigZag32(3)); - Assert.AreEqual(0x3FFFFFFF, CodedInputStream.DecodeZigZag32(0x7FFFFFFE)); - Assert.AreEqual(unchecked((int) 0xC0000000), CodedInputStream.DecodeZigZag32(0x7FFFFFFF)); - Assert.AreEqual(0x7FFFFFFF, CodedInputStream.DecodeZigZag32(0xFFFFFFFE)); - Assert.AreEqual(unchecked((int) 0x80000000), CodedInputStream.DecodeZigZag32(0xFFFFFFFF)); - } - - [Test] - public void DecodeZigZag64() - { - Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0)); - Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1)); - Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2)); - Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3)); - Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL)); - Assert.AreEqual(unchecked((long) 0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL)); - Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL)); - Assert.AreEqual(unchecked((long) 0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL)); - Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL)); - Assert.AreEqual(unchecked((long) 0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL)); - } - - [Test] - public void ReadWholeMessage_VaryingBlockSizes() - { - TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); - - byte[] rawBytes = message.ToByteArray(); - Assert.AreEqual(rawBytes.Length, message.CalculateSize()); - TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(rawBytes); - Assert.AreEqual(message, message2); - - // Try different block sizes. - for (int blockSize = 1; blockSize < 256; blockSize *= 2) - { - message2 = TestAllTypes.Parser.ParseFrom(new SmallBlockInputStream(rawBytes, blockSize)); - Assert.AreEqual(message, message2); - } - } - - [Test] - public void ReadHugeBlob() - { - // Allocate and initialize a 1MB blob. - byte[] blob = new byte[1 << 20]; - for (int i = 0; i < blob.Length; i++) - { - blob[i] = (byte) i; - } - - // Make a message containing it. - var message = new TestAllTypes { SingleBytes = ByteString.CopyFrom(blob) }; - - // Serialize and parse it. Make sure to parse from an InputStream, not - // directly from a ByteString, so that CodedInputStream uses buffered - // reading. - TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(message.ToByteString()); - - Assert.AreEqual(message, message2); - } - - [Test] - public void ReadMaliciouslyLargeBlob() - { - MemoryStream ms = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(ms); - - uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); - output.WriteRawVarint32(tag); - output.WriteRawVarint32(0x7FFFFFFF); - output.WriteRawBytes(new byte[32]); // Pad with a few random bytes. - output.Flush(); - ms.Position = 0; - - CodedInputStream input = new CodedInputStream(ms); - Assert.AreEqual(tag, input.ReadTag()); - - Assert.Throws(() => input.ReadBytes()); - } - - internal static TestRecursiveMessage MakeRecursiveMessage(int depth) - { - if (depth == 0) - { - return new TestRecursiveMessage { I = 5 }; - } - else - { - return new TestRecursiveMessage { A = MakeRecursiveMessage(depth - 1) }; - } - } - - internal static void AssertMessageDepth(TestRecursiveMessage message, int depth) - { - if (depth == 0) - { - Assert.IsNull(message.A); - Assert.AreEqual(5, message.I); - } - else - { - Assert.IsNotNull(message.A); - AssertMessageDepth(message.A, depth - 1); - } - } - - [Test] - public void MaliciousRecursion() - { - ByteString data64 = MakeRecursiveMessage(64).ToByteString(); - ByteString data65 = MakeRecursiveMessage(65).ToByteString(); - - AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64); - - Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(data65)); - - CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63); - Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(input)); - } - - [Test] - public void SizeLimit() - { - // Have to use a Stream rather than ByteString.CreateCodedInput as SizeLimit doesn't - // apply to the latter case. - MemoryStream ms = new MemoryStream(SampleMessages.CreateFullTestAllTypes().ToByteArray()); - CodedInputStream input = CodedInputStream.CreateWithLimits(ms, 16, 100); - Assert.Throws(() => TestAllTypes.Parser.ParseFrom(input)); - } - - /// - /// Tests that if we read an string that contains invalid UTF-8, no exception - /// is thrown. Instead, the invalid bytes are replaced with the Unicode - /// "replacement character" U+FFFD. - /// - [Test] - public void ReadInvalidUtf8() - { - MemoryStream ms = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(ms); - - uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); - output.WriteRawVarint32(tag); - output.WriteRawVarint32(1); - output.WriteRawBytes(new byte[] {0x80}); - output.Flush(); - ms.Position = 0; - - CodedInputStream input = new CodedInputStream(ms); - - Assert.AreEqual(tag, input.ReadTag()); - string text = input.ReadString(); - Assert.AreEqual('\ufffd', text[0]); - } - - /// - /// A stream which limits the number of bytes it reads at a time. - /// We use this to make sure that CodedInputStream doesn't screw up when - /// reading in small blocks. - /// - private sealed class SmallBlockInputStream : MemoryStream - { - private readonly int blockSize; - - public SmallBlockInputStream(byte[] data, int blockSize) - : base(data) - { - this.blockSize = blockSize; - } - - public override int Read(byte[] buffer, int offset, int count) - { - return base.Read(buffer, offset, Math.Min(count, blockSize)); - } - } - - [Test] - public void TestNegativeEnum() - { - byte[] bytes = { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 }; - CodedInputStream input = new CodedInputStream(bytes); - Assert.AreEqual((int)SampleEnum.NegativeValue, input.ReadEnum()); - Assert.IsTrue(input.IsAtEnd); - } - - //Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily - [Test] - public void TestSlowPathAvoidance() - { - using (var ms = new MemoryStream()) - { - CodedOutputStream output = new CodedOutputStream(ms); - output.WriteTag(1, WireFormat.WireType.LengthDelimited); - output.WriteBytes(ByteString.CopyFrom(new byte[100])); - output.WriteTag(2, WireFormat.WireType.LengthDelimited); - output.WriteBytes(ByteString.CopyFrom(new byte[100])); - output.Flush(); - - ms.Position = 0; - CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0); - - uint tag = input.ReadTag(); - Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag)); - Assert.AreEqual(100, input.ReadBytes().Length); - - tag = input.ReadTag(); - Assert.AreEqual(2, WireFormat.GetTagFieldNumber(tag)); - Assert.AreEqual(100, input.ReadBytes().Length); - } - } - - [Test] - public void Tag0Throws() - { - var input = new CodedInputStream(new byte[] { 0 }); - Assert.Throws(() => input.ReadTag()); - } - - [Test] - public void SkipGroup() - { - // Create an output stream with a group in: - // Field 1: string "field 1" - // Field 2: group containing: - // Field 1: fixed int32 value 100 - // Field 2: string "ignore me" - // Field 3: nested group containing - // Field 1: fixed int64 value 1000 - // Field 3: string "field 3" - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - output.WriteTag(1, WireFormat.WireType.LengthDelimited); - output.WriteString("field 1"); - - // The outer group... - output.WriteTag(2, WireFormat.WireType.StartGroup); - output.WriteTag(1, WireFormat.WireType.Fixed32); - output.WriteFixed32(100); - output.WriteTag(2, WireFormat.WireType.LengthDelimited); - output.WriteString("ignore me"); - // The nested group... - output.WriteTag(3, WireFormat.WireType.StartGroup); - output.WriteTag(1, WireFormat.WireType.Fixed64); - output.WriteFixed64(1000); - // Note: Not sure the field number is relevant for end group... - output.WriteTag(3, WireFormat.WireType.EndGroup); - - // End the outer group - output.WriteTag(2, WireFormat.WireType.EndGroup); - - output.WriteTag(3, WireFormat.WireType.LengthDelimited); - output.WriteString("field 3"); - output.Flush(); - stream.Position = 0; - - // Now act like a generated client - var input = new CodedInputStream(stream); - Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); - Assert.AreEqual("field 1", input.ReadString()); - Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); - input.SkipLastField(); // Should consume the whole group, including the nested one. - Assert.AreEqual(WireFormat.MakeTag(3, WireFormat.WireType.LengthDelimited), input.ReadTag()); - Assert.AreEqual("field 3", input.ReadString()); - } - - [Test] - public void SkipGroup_WrongEndGroupTag() - { - // Create an output stream with: - // Field 1: string "field 1" - // Start group 2 - // Field 3: fixed int32 - // End group 4 (should give an error) - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - output.WriteTag(1, WireFormat.WireType.LengthDelimited); - output.WriteString("field 1"); - - // The outer group... - output.WriteTag(2, WireFormat.WireType.StartGroup); - output.WriteTag(3, WireFormat.WireType.Fixed32); - output.WriteFixed32(100); - output.WriteTag(4, WireFormat.WireType.EndGroup); - output.Flush(); - stream.Position = 0; - - // Now act like a generated client - var input = new CodedInputStream(stream); - Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); - Assert.AreEqual("field 1", input.ReadString()); - Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); - Assert.Throws(input.SkipLastField); - } - - [Test] - public void RogueEndGroupTag() - { - // If we have an end-group tag without a leading start-group tag, generated - // code will just call SkipLastField... so that should fail. - - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - output.WriteTag(1, WireFormat.WireType.EndGroup); - output.Flush(); - stream.Position = 0; - - var input = new CodedInputStream(stream); - Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.EndGroup), input.ReadTag()); - Assert.Throws(input.SkipLastField); - } - - [Test] - public void EndOfStreamReachedWhileSkippingGroup() - { - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - output.WriteTag(1, WireFormat.WireType.StartGroup); - output.WriteTag(2, WireFormat.WireType.StartGroup); - output.WriteTag(2, WireFormat.WireType.EndGroup); - - output.Flush(); - stream.Position = 0; - - // Now act like a generated client - var input = new CodedInputStream(stream); - input.ReadTag(); - Assert.Throws(input.SkipLastField); - } - - [Test] - public void RecursionLimitAppliedWhileSkippingGroup() - { - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) - { - output.WriteTag(1, WireFormat.WireType.StartGroup); - } - for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) - { - output.WriteTag(1, WireFormat.WireType.EndGroup); - } - output.Flush(); - stream.Position = 0; - - // Now act like a generated client - var input = new CodedInputStream(stream); - Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.StartGroup), input.ReadTag()); - Assert.Throws(input.SkipLastField); - } - - [Test] - public void Construction_Invalid() - { - Assert.Throws(() => new CodedInputStream((byte[]) null)); - Assert.Throws(() => new CodedInputStream(null, 0, 0)); - Assert.Throws(() => new CodedInputStream((Stream) null)); - Assert.Throws(() => new CodedInputStream(new byte[10], 100, 0)); - Assert.Throws(() => new CodedInputStream(new byte[10], 5, 10)); - } - - [Test] - public void CreateWithLimits_InvalidLimits() - { - var stream = new MemoryStream(); - Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 0, 1)); - Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 1, 0)); - } - - [Test] - public void Dispose_DisposesUnderlyingStream() - { - var memoryStream = new MemoryStream(); - Assert.IsTrue(memoryStream.CanRead); - using (var cis = new CodedInputStream(memoryStream)) - { - } - Assert.IsFalse(memoryStream.CanRead); // Disposed - } - - [Test] - public void Dispose_WithLeaveOpen() - { - var memoryStream = new MemoryStream(); - Assert.IsTrue(memoryStream.CanRead); - using (var cis = new CodedInputStream(memoryStream, true)) - { - } - Assert.IsTrue(memoryStream.CanRead); // We left the stream open - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class CodedInputStreamTest + { + /// + /// Helper to construct a byte array from a bunch of bytes. The inputs are + /// actually ints so that I can use hex notation and not get stupid errors + /// about precision. + /// + private static byte[] Bytes(params int[] bytesAsInts) + { + byte[] bytes = new byte[bytesAsInts.Length]; + for (int i = 0; i < bytesAsInts.Length; i++) + { + bytes[i] = (byte) bytesAsInts[i]; + } + return bytes; + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() + /// + private static void AssertReadVarint(byte[] data, ulong value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = new CodedInputStream(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + } + + // Try reading directly from a MemoryStream. We want to verify that it + // doesn't read past the end of the input, so write an extra byte - this + // lets us test the position at the end. + MemoryStream memoryStream = new MemoryStream(); + memoryStream.Write(data, 0, data.Length); + memoryStream.WriteByte(0); + memoryStream.Position = 0; + Assert.AreEqual((uint) value, CodedInputStream.ReadRawVarint32(memoryStream)); + Assert.AreEqual(data.Length, memoryStream.Position); + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and + /// expects them to fail with an InvalidProtocolBufferException whose + /// description matches the given one. + /// + private static void AssertReadVarintFailure(InvalidProtocolBufferException expected, byte[] data) + { + CodedInputStream input = new CodedInputStream(data); + var exception = Assert.Throws(() => input.ReadRawVarint32()); + Assert.AreEqual(expected.Message, exception.Message); + + input = new CodedInputStream(data); + exception = Assert.Throws(() => input.ReadRawVarint64()); + Assert.AreEqual(expected.Message, exception.Message); + + // Make sure we get the same error when reading directly from a Stream. + exception = Assert.Throws(() => CodedInputStream.ReadRawVarint32(new MemoryStream(data))); + Assert.AreEqual(expected.Message, exception.Message); + } + + [Test] + public void ReadVarint() + { + AssertReadVarint(Bytes(0x00), 0); + AssertReadVarint(Bytes(0x01), 1); + AssertReadVarint(Bytes(0x7f), 127); + // 14882 + AssertReadVarint(Bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertReadVarint(Bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49), + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43L << 28) | (0x49L << 35) | (0x24L << 42) | (0x49L << 49)); + // 11964378330978735131 + AssertReadVarint(Bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01), + (0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bUL << 28) | (0x56UL << 35) | (0x00UL << 42) | + (0x05UL << 49) | (0x26UL << 56) | (0x01UL << 63)); + + // Failures + AssertReadVarintFailure( + InvalidProtocolBufferException.MalformedVarint(), + Bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x00)); + AssertReadVarintFailure( + InvalidProtocolBufferException.TruncatedMessage(), + Bytes(0x80)); + } + + /// + /// Parses the given bytes using ReadRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian32(byte[] data, uint value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = new CodedInputStream( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + } + } + + /// + /// Parses the given bytes using ReadRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian64(byte[] data, ulong value) + { + CodedInputStream input = new CodedInputStream(data); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = new CodedInputStream( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + } + } + + [Test] + public void ReadLittleEndian() + { + AssertReadLittleEndian32(Bytes(0x78, 0x56, 0x34, 0x12), 0x12345678); + AssertReadLittleEndian32(Bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0); + + AssertReadLittleEndian64(Bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12), + 0x123456789abcdef0L); + AssertReadLittleEndian64( + Bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678UL); + } + + [Test] + public void DecodeZigZag32() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag32(3)); + Assert.AreEqual(0x3FFFFFFF, CodedInputStream.DecodeZigZag32(0x7FFFFFFE)); + Assert.AreEqual(unchecked((int) 0xC0000000), CodedInputStream.DecodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0x7FFFFFFF, CodedInputStream.DecodeZigZag32(0xFFFFFFFE)); + Assert.AreEqual(unchecked((int) 0x80000000), CodedInputStream.DecodeZigZag32(0xFFFFFFFF)); + } + + [Test] + public void DecodeZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3)); + Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL)); + Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL)); + Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL)); + } + + [Test] + public void ReadWholeMessage_VaryingBlockSizes() + { + TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); + + byte[] rawBytes = message.ToByteArray(); + Assert.AreEqual(rawBytes.Length, message.CalculateSize()); + TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(rawBytes); + Assert.AreEqual(message, message2); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + message2 = TestAllTypes.Parser.ParseFrom(new SmallBlockInputStream(rawBytes, blockSize)); + Assert.AreEqual(message, message2); + } + } + + [Test] + public void ReadHugeBlob() + { + // Allocate and initialize a 1MB blob. + byte[] blob = new byte[1 << 20]; + for (int i = 0; i < blob.Length; i++) + { + blob[i] = (byte) i; + } + + // Make a message containing it. + var message = new TestAllTypes { SingleBytes = ByteString.CopyFrom(blob) }; + + // Serialize and parse it. Make sure to parse from an InputStream, not + // directly from a ByteString, so that CodedInputStream uses buffered + // reading. + TestAllTypes message2 = TestAllTypes.Parser.ParseFrom(message.ToByteString()); + + Assert.AreEqual(message, message2); + } + + [Test] + public void ReadMaliciouslyLargeBlob() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(0x7FFFFFFF); + output.WriteRawBytes(new byte[32]); // Pad with a few random bytes. + output.Flush(); + ms.Position = 0; + + CodedInputStream input = new CodedInputStream(ms); + Assert.AreEqual(tag, input.ReadTag()); + + Assert.Throws(() => input.ReadBytes()); + } + + internal static TestRecursiveMessage MakeRecursiveMessage(int depth) + { + if (depth == 0) + { + return new TestRecursiveMessage { I = 5 }; + } + else + { + return new TestRecursiveMessage { A = MakeRecursiveMessage(depth - 1) }; + } + } + + internal static void AssertMessageDepth(TestRecursiveMessage message, int depth) + { + if (depth == 0) + { + Assert.IsNull(message.A); + Assert.AreEqual(5, message.I); + } + else + { + Assert.IsNotNull(message.A); + AssertMessageDepth(message.A, depth - 1); + } + } + + [Test] + public void MaliciousRecursion() + { + ByteString data64 = MakeRecursiveMessage(64).ToByteString(); + ByteString data65 = MakeRecursiveMessage(65).ToByteString(); + + AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64); + + Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(data65)); + + CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63); + Assert.Throws(() => TestRecursiveMessage.Parser.ParseFrom(input)); + } + + [Test] + public void SizeLimit() + { + // Have to use a Stream rather than ByteString.CreateCodedInput as SizeLimit doesn't + // apply to the latter case. + MemoryStream ms = new MemoryStream(SampleMessages.CreateFullTestAllTypes().ToByteArray()); + CodedInputStream input = CodedInputStream.CreateWithLimits(ms, 16, 100); + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(input)); + } + + /// + /// Tests that if we read an string that contains invalid UTF-8, no exception + /// is thrown. Instead, the invalid bytes are replaced with the Unicode + /// "replacement character" U+FFFD. + /// + [Test] + public void ReadInvalidUtf8() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(1); + output.WriteRawBytes(new byte[] {0x80}); + output.Flush(); + ms.Position = 0; + + CodedInputStream input = new CodedInputStream(ms); + + Assert.AreEqual(tag, input.ReadTag()); + string text = input.ReadString(); + Assert.AreEqual('\ufffd', text[0]); + } + + /// + /// A stream which limits the number of bytes it reads at a time. + /// We use this to make sure that CodedInputStream doesn't screw up when + /// reading in small blocks. + /// + private sealed class SmallBlockInputStream : MemoryStream + { + private readonly int blockSize; + + public SmallBlockInputStream(byte[] data, int blockSize) + : base(data) + { + this.blockSize = blockSize; + } + + public override int Read(byte[] buffer, int offset, int count) + { + return base.Read(buffer, offset, Math.Min(count, blockSize)); + } + } + + [Test] + public void TestNegativeEnum() + { + byte[] bytes = { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 }; + CodedInputStream input = new CodedInputStream(bytes); + Assert.AreEqual((int)SampleEnum.NegativeValue, input.ReadEnum()); + Assert.IsTrue(input.IsAtEnd); + } + + //Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily + [Test] + public void TestSlowPathAvoidance() + { + using (var ms = new MemoryStream()) + { + CodedOutputStream output = new CodedOutputStream(ms); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteBytes(ByteString.CopyFrom(new byte[100])); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteBytes(ByteString.CopyFrom(new byte[100])); + output.Flush(); + + ms.Position = 0; + CodedInputStream input = new CodedInputStream(ms, new byte[ms.Length / 2], 0, 0, false); + + uint tag = input.ReadTag(); + Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag)); + Assert.AreEqual(100, input.ReadBytes().Length); + + tag = input.ReadTag(); + Assert.AreEqual(2, WireFormat.GetTagFieldNumber(tag)); + Assert.AreEqual(100, input.ReadBytes().Length); + } + } + + [Test] + public void Tag0Throws() + { + var input = new CodedInputStream(new byte[] { 0 }); + Assert.Throws(() => input.ReadTag()); + } + + [Test] + public void SkipGroup() + { + // Create an output stream with a group in: + // Field 1: string "field 1" + // Field 2: group containing: + // Field 1: fixed int32 value 100 + // Field 2: string "ignore me" + // Field 3: nested group containing + // Field 1: fixed int64 value 1000 + // Field 3: string "field 3" + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString("field 1"); + + // The outer group... + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(1, WireFormat.WireType.Fixed32); + output.WriteFixed32(100); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteString("ignore me"); + // The nested group... + output.WriteTag(3, WireFormat.WireType.StartGroup); + output.WriteTag(1, WireFormat.WireType.Fixed64); + output.WriteFixed64(1000); + // Note: Not sure the field number is relevant for end group... + output.WriteTag(3, WireFormat.WireType.EndGroup); + + // End the outer group + output.WriteTag(2, WireFormat.WireType.EndGroup); + + output.WriteTag(3, WireFormat.WireType.LengthDelimited); + output.WriteString("field 3"); + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 1", input.ReadString()); + Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); + input.SkipLastField(); // Should consume the whole group, including the nested one. + Assert.AreEqual(WireFormat.MakeTag(3, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 3", input.ReadString()); + } + + [Test] + public void SkipGroup_WrongEndGroupTag() + { + // Create an output stream with: + // Field 1: string "field 1" + // Start group 2 + // Field 3: fixed int32 + // End group 4 (should give an error) + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString("field 1"); + + // The outer group... + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(3, WireFormat.WireType.Fixed32); + output.WriteFixed32(100); + output.WriteTag(4, WireFormat.WireType.EndGroup); + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited), input.ReadTag()); + Assert.AreEqual("field 1", input.ReadString()); + Assert.AreEqual(WireFormat.MakeTag(2, WireFormat.WireType.StartGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void RogueEndGroupTag() + { + // If we have an end-group tag without a leading start-group tag, generated + // code will just call SkipLastField... so that should fail. + + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.EndGroup); + output.Flush(); + stream.Position = 0; + + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.EndGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void EndOfStreamReachedWhileSkippingGroup() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(1, WireFormat.WireType.StartGroup); + output.WriteTag(2, WireFormat.WireType.StartGroup); + output.WriteTag(2, WireFormat.WireType.EndGroup); + + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + input.ReadTag(); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void RecursionLimitAppliedWhileSkippingGroup() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) + { + output.WriteTag(1, WireFormat.WireType.StartGroup); + } + for (int i = 0; i < CodedInputStream.DefaultRecursionLimit + 1; i++) + { + output.WriteTag(1, WireFormat.WireType.EndGroup); + } + output.Flush(); + stream.Position = 0; + + // Now act like a generated client + var input = new CodedInputStream(stream); + Assert.AreEqual(WireFormat.MakeTag(1, WireFormat.WireType.StartGroup), input.ReadTag()); + Assert.Throws(input.SkipLastField); + } + + [Test] + public void Construction_Invalid() + { + Assert.Throws(() => new CodedInputStream((byte[]) null)); + Assert.Throws(() => new CodedInputStream(null, 0, 0)); + Assert.Throws(() => new CodedInputStream((Stream) null)); + Assert.Throws(() => new CodedInputStream(new byte[10], 100, 0)); + Assert.Throws(() => new CodedInputStream(new byte[10], 5, 10)); + } + + [Test] + public void CreateWithLimits_InvalidLimits() + { + var stream = new MemoryStream(); + Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 0, 1)); + Assert.Throws(() => CodedInputStream.CreateWithLimits(stream, 1, 0)); + } + + [Test] + public void Dispose_DisposesUnderlyingStream() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanRead); + using (var cis = new CodedInputStream(memoryStream)) + { + } + Assert.IsFalse(memoryStream.CanRead); // Disposed + } + + [Test] + public void Dispose_WithLeaveOpen() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanRead); + using (var cis = new CodedInputStream(memoryStream, true)) + { + } + Assert.IsTrue(memoryStream.CanRead); // We left the stream open + } + + [Test] + public void Dispose_FromByteArray() + { + var stream = new CodedInputStream(new byte[10]); + stream.Dispose(); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs index 83bcb17606..98cabd55ad 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/CodedOutputStreamTest.cs @@ -1,419 +1,426 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; -using Google.Protobuf.TestProtos; -using NUnit.Framework; - -namespace Google.Protobuf -{ - public class CodedOutputStreamTest - { - /// - /// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and - /// checks that the result matches the given bytes - /// - private static void AssertWriteVarint(byte[] data, ulong value) - { - // Only do 32-bit write if the value fits in 32 bits. - if ((value >> 32) == 0) - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(rawOutput); - output.WriteRawVarint32((uint) value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - // Also try computing size. - Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value)); - } - - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(rawOutput); - output.WriteRawVarint64(value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - - // Also try computing size. - Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value)); - } - - // Try different buffer sizes. - for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) - { - // Only do 32-bit write if the value fits in 32 bits. - if ((value >> 32) == 0) - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = - new CodedOutputStream(rawOutput, bufferSize); - output.WriteRawVarint32((uint) value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - } - - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize); - output.WriteRawVarint64(value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - } - } - } - - /// - /// Tests WriteRawVarint32() and WriteRawVarint64() - /// - [Test] - public void WriteVarint() - { - AssertWriteVarint(new byte[] {0x00}, 0); - AssertWriteVarint(new byte[] {0x01}, 1); - AssertWriteVarint(new byte[] {0x7f}, 127); - // 14882 - AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7)); - // 2961488830 - AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b}, - (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | - (0x0bL << 28)); - - // 64-bit - // 7256456126 - AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b}, - (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | - (0x1bL << 28)); - // 41256202580718336 - AssertWriteVarint( - new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49}, - (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | - (0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49)); - // 11964378330978735131 - AssertWriteVarint( - new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01}, - unchecked((ulong) - ((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | - (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) | - (0x05L << 49) | (0x26L << 56) | (0x01L << 63)))); - } - - /// - /// Parses the given bytes using WriteRawLittleEndian32() and checks - /// that the result matches the given value. - /// - private static void AssertWriteLittleEndian32(byte[] data, uint value) - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(rawOutput); - output.WriteRawLittleEndian32(value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - - // Try different buffer sizes. - for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) - { - rawOutput = new MemoryStream(); - output = new CodedOutputStream(rawOutput, bufferSize); - output.WriteRawLittleEndian32(value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - } - } - - /// - /// Parses the given bytes using WriteRawLittleEndian64() and checks - /// that the result matches the given value. - /// - private static void AssertWriteLittleEndian64(byte[] data, ulong value) - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(rawOutput); - output.WriteRawLittleEndian64(value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - - // Try different block sizes. - for (int blockSize = 1; blockSize <= 16; blockSize *= 2) - { - rawOutput = new MemoryStream(); - output = new CodedOutputStream(rawOutput, blockSize); - output.WriteRawLittleEndian64(value); - output.Flush(); - Assert.AreEqual(data, rawOutput.ToArray()); - } - } - - /// - /// Tests writeRawLittleEndian32() and writeRawLittleEndian64(). - /// - [Test] - public void WriteLittleEndian() - { - AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678); - AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0); - - AssertWriteLittleEndian64( - new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12}, - 0x123456789abcdef0L); - AssertWriteLittleEndian64( - new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a}, - 0x9abcdef012345678UL); - } - - [Test] - public void WriteWholeMessage_VaryingBlockSizes() - { - TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); - - byte[] rawBytes = message.ToByteArray(); - - // Try different block sizes. - for (int blockSize = 1; blockSize < 256; blockSize *= 2) - { - MemoryStream rawOutput = new MemoryStream(); - CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize); - message.WriteTo(output); - output.Flush(); - Assert.AreEqual(rawBytes, rawOutput.ToArray()); - } - } - - [Test] - public void EncodeZigZag32() - { - Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag32(0)); - Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag32(-1)); - Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag32(1)); - Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag32(-2)); - Assert.AreEqual(0x7FFFFFFEu, CodedOutputStream.EncodeZigZag32(0x3FFFFFFF)); - Assert.AreEqual(0x7FFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0xC0000000))); - Assert.AreEqual(0xFFFFFFFEu, CodedOutputStream.EncodeZigZag32(0x7FFFFFFF)); - Assert.AreEqual(0xFFFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0x80000000))); - } - - [Test] - public void EncodeZigZag64() - { - Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag64(0)); - Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag64(-1)); - Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag64(1)); - Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag64(-2)); - Assert.AreEqual(0x000000007FFFFFFEuL, - CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL))); - Assert.AreEqual(0x000000007FFFFFFFuL, - CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL))); - Assert.AreEqual(0x00000000FFFFFFFEuL, - CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL))); - Assert.AreEqual(0x00000000FFFFFFFFuL, - CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL))); - Assert.AreEqual(0xFFFFFFFFFFFFFFFEL, - CodedOutputStream.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL))); - Assert.AreEqual(0xFFFFFFFFFFFFFFFFL, - CodedOutputStream.EncodeZigZag64(unchecked((long) 0x8000000000000000UL))); - } - - [Test] - public void RoundTripZigZag32() - { - // Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1) - // were chosen semi-randomly via keyboard bashing. - Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(0))); - Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(1))); - Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-1))); - Assert.AreEqual(14927, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(14927))); - Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-3612))); - } - - [Test] - public void RoundTripZigZag64() - { - Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0))); - Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1))); - Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1))); - Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927))); - Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612))); - - Assert.AreEqual(856912304801416L, - CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L))); - Assert.AreEqual(-75123905439571256L, - CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L))); - } - - [Test] - public void TestNegativeEnumNoTag() - { - Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2)); - Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue)); - - byte[] bytes = new byte[10]; - CodedOutputStream output = new CodedOutputStream(bytes); - output.WriteEnum((int) SampleEnum.NegativeValue); - - Assert.AreEqual(0, output.SpaceLeft); - Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); - } - - [Test] - public void TestCodedInputOutputPosition() - { - byte[] content = new byte[110]; - for (int i = 0; i < content.Length; i++) - content[i] = (byte)i; - - byte[] child = new byte[120]; - { - MemoryStream ms = new MemoryStream(child); - CodedOutputStream cout = new CodedOutputStream(ms, 20); - // Field 11: numeric value: 500 - cout.WriteTag(11, WireFormat.WireType.Varint); - Assert.AreEqual(1, cout.Position); - cout.WriteInt32(500); - Assert.AreEqual(3, cout.Position); - //Field 12: length delimited 120 bytes - cout.WriteTag(12, WireFormat.WireType.LengthDelimited); - Assert.AreEqual(4, cout.Position); - cout.WriteBytes(ByteString.CopyFrom(content)); - Assert.AreEqual(115, cout.Position); - // Field 13: fixed numeric value: 501 - cout.WriteTag(13, WireFormat.WireType.Fixed32); - Assert.AreEqual(116, cout.Position); - cout.WriteSFixed32(501); - Assert.AreEqual(120, cout.Position); - cout.Flush(); - } - - byte[] bytes = new byte[130]; - { - CodedOutputStream cout = new CodedOutputStream(bytes); - // Field 1: numeric value: 500 - cout.WriteTag(1, WireFormat.WireType.Varint); - Assert.AreEqual(1, cout.Position); - cout.WriteInt32(500); - Assert.AreEqual(3, cout.Position); - //Field 2: length delimited 120 bytes - cout.WriteTag(2, WireFormat.WireType.LengthDelimited); - Assert.AreEqual(4, cout.Position); - cout.WriteBytes(ByteString.CopyFrom(child)); - Assert.AreEqual(125, cout.Position); - // Field 3: fixed numeric value: 500 - cout.WriteTag(3, WireFormat.WireType.Fixed32); - Assert.AreEqual(126, cout.Position); - cout.WriteSFixed32(501); - Assert.AreEqual(130, cout.Position); - cout.Flush(); - } - // Now test Input stream: - { - CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0); - Assert.AreEqual(0, cin.Position); - // Field 1: - uint tag = cin.ReadTag(); - Assert.AreEqual(1, tag >> 3); - Assert.AreEqual(1, cin.Position); - Assert.AreEqual(500, cin.ReadInt32()); - Assert.AreEqual(3, cin.Position); - //Field 2: - tag = cin.ReadTag(); - Assert.AreEqual(2, tag >> 3); - Assert.AreEqual(4, cin.Position); - int childlen = cin.ReadLength(); - Assert.AreEqual(120, childlen); - Assert.AreEqual(5, cin.Position); - int oldlimit = cin.PushLimit((int)childlen); - Assert.AreEqual(5, cin.Position); - // Now we are reading child message - { - // Field 11: numeric value: 500 - tag = cin.ReadTag(); - Assert.AreEqual(11, tag >> 3); - Assert.AreEqual(6, cin.Position); - Assert.AreEqual(500, cin.ReadInt32()); - Assert.AreEqual(8, cin.Position); - //Field 12: length delimited 120 bytes - tag = cin.ReadTag(); - Assert.AreEqual(12, tag >> 3); - Assert.AreEqual(9, cin.Position); - ByteString bstr = cin.ReadBytes(); - Assert.AreEqual(110, bstr.Length); - Assert.AreEqual((byte) 109, bstr[109]); - Assert.AreEqual(120, cin.Position); - // Field 13: fixed numeric value: 501 - tag = cin.ReadTag(); - Assert.AreEqual(13, tag >> 3); - // ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit - Assert.AreEqual(121, cin.Position); - Assert.AreEqual(501, cin.ReadSFixed32()); - Assert.AreEqual(125, cin.Position); - Assert.IsTrue(cin.IsAtEnd); - } - cin.PopLimit(oldlimit); - Assert.AreEqual(125, cin.Position); - // Field 3: fixed numeric value: 501 - tag = cin.ReadTag(); - Assert.AreEqual(3, tag >> 3); - Assert.AreEqual(126, cin.Position); - Assert.AreEqual(501, cin.ReadSFixed32()); - Assert.AreEqual(130, cin.Position); - Assert.IsTrue(cin.IsAtEnd); - } - } - - [Test] - public void Dispose_DisposesUnderlyingStream() - { - var memoryStream = new MemoryStream(); - Assert.IsTrue(memoryStream.CanWrite); - using (var cos = new CodedOutputStream(memoryStream)) - { - cos.WriteRawByte(0); - Assert.AreEqual(0, memoryStream.Position); // Not flushed yet - } - Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream - Assert.IsFalse(memoryStream.CanWrite); // Disposed - } - - [Test] - public void Dispose_WithLeaveOpen() - { - var memoryStream = new MemoryStream(); - Assert.IsTrue(memoryStream.CanWrite); - using (var cos = new CodedOutputStream(memoryStream, true)) - { - cos.WriteRawByte(0); - Assert.AreEqual(0, memoryStream.Position); // Not flushed yet - } - Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream - Assert.IsTrue(memoryStream.CanWrite); // We left the stream open - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class CodedOutputStreamTest + { + /// + /// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and + /// checks that the result matches the given bytes + /// + private static void AssertWriteVarint(byte[] data, ulong value) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawVarint32((uint) value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value)); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawVarint64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value)); + } + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = + new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawVarint32((uint) value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawVarint64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + } + + /// + /// Tests WriteRawVarint32() and WriteRawVarint64() + /// + [Test] + public void WriteVarint() + { + AssertWriteVarint(new byte[] {0x00}, 0); + AssertWriteVarint(new byte[] {0x01}, 1); + AssertWriteVarint(new byte[] {0x7f}, 127); + // 14882 + AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertWriteVarint( + new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49}, + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49)); + // 11964378330978735131 + AssertWriteVarint( + new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01}, + unchecked((ulong) + ((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) | + (0x05L << 49) | (0x26L << 56) | (0x01L << 63)))); + } + + /// + /// Parses the given bytes using WriteRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian32(byte[] data, uint value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawLittleEndian32(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + rawOutput = new MemoryStream(); + output = new CodedOutputStream(rawOutput, bufferSize); + output.WriteRawLittleEndian32(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Parses the given bytes using WriteRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian64(byte[] data, ulong value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput); + output.WriteRawLittleEndian64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + rawOutput = new MemoryStream(); + output = new CodedOutputStream(rawOutput, blockSize); + output.WriteRawLittleEndian64(value); + output.Flush(); + Assert.AreEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Tests writeRawLittleEndian32() and writeRawLittleEndian64(). + /// + [Test] + public void WriteLittleEndian() + { + AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678); + AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0); + + AssertWriteLittleEndian64( + new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12}, + 0x123456789abcdef0L); + AssertWriteLittleEndian64( + new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a}, + 0x9abcdef012345678UL); + } + + [Test] + public void WriteWholeMessage_VaryingBlockSizes() + { + TestAllTypes message = SampleMessages.CreateFullTestAllTypes(); + + byte[] rawBytes = message.ToByteArray(); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = new CodedOutputStream(rawOutput, blockSize); + message.WriteTo(output); + output.Flush(); + Assert.AreEqual(rawBytes, rawOutput.ToArray()); + } + } + + [Test] + public void EncodeZigZag32() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag32(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag32(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag32(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag32(-2)); + Assert.AreEqual(0x7FFFFFFEu, CodedOutputStream.EncodeZigZag32(0x3FFFFFFF)); + Assert.AreEqual(0x7FFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0xC0000000))); + Assert.AreEqual(0xFFFFFFFEu, CodedOutputStream.EncodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0xFFFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0x80000000))); + } + + [Test] + public void EncodeZigZag64() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag64(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag64(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag64(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag64(-2)); + Assert.AreEqual(0x000000007FFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL))); + Assert.AreEqual(0x000000007FFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL))); + Assert.AreEqual(0x00000000FFFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL))); + Assert.AreEqual(0x00000000FFFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFEL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFFL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x8000000000000000UL))); + } + + [Test] + public void RoundTripZigZag32() + { + // Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1) + // were chosen semi-randomly via keyboard bashing. + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-3612))); + } + + [Test] + public void RoundTripZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612))); + + Assert.AreEqual(856912304801416L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L))); + Assert.AreEqual(-75123905439571256L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L))); + } + + [Test] + public void TestNegativeEnumNoTag() + { + Assert.AreEqual(10, CodedOutputStream.ComputeInt32Size(-2)); + Assert.AreEqual(10, CodedOutputStream.ComputeEnumSize((int) SampleEnum.NegativeValue)); + + byte[] bytes = new byte[10]; + CodedOutputStream output = new CodedOutputStream(bytes); + output.WriteEnum((int) SampleEnum.NegativeValue); + + Assert.AreEqual(0, output.SpaceLeft); + Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [Test] + public void TestCodedInputOutputPosition() + { + byte[] content = new byte[110]; + for (int i = 0; i < content.Length; i++) + content[i] = (byte)i; + + byte[] child = new byte[120]; + { + MemoryStream ms = new MemoryStream(child); + CodedOutputStream cout = new CodedOutputStream(ms, 20); + // Field 11: numeric value: 500 + cout.WriteTag(11, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32(500); + Assert.AreEqual(3, cout.Position); + //Field 12: length delimited 120 bytes + cout.WriteTag(12, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytes(ByteString.CopyFrom(content)); + Assert.AreEqual(115, cout.Position); + // Field 13: fixed numeric value: 501 + cout.WriteTag(13, WireFormat.WireType.Fixed32); + Assert.AreEqual(116, cout.Position); + cout.WriteSFixed32(501); + Assert.AreEqual(120, cout.Position); + cout.Flush(); + } + + byte[] bytes = new byte[130]; + { + CodedOutputStream cout = new CodedOutputStream(bytes); + // Field 1: numeric value: 500 + cout.WriteTag(1, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32(500); + Assert.AreEqual(3, cout.Position); + //Field 2: length delimited 120 bytes + cout.WriteTag(2, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytes(ByteString.CopyFrom(child)); + Assert.AreEqual(125, cout.Position); + // Field 3: fixed numeric value: 500 + cout.WriteTag(3, WireFormat.WireType.Fixed32); + Assert.AreEqual(126, cout.Position); + cout.WriteSFixed32(501); + Assert.AreEqual(130, cout.Position); + cout.Flush(); + } + // Now test Input stream: + { + CodedInputStream cin = new CodedInputStream(new MemoryStream(bytes), new byte[50], 0, 0, false); + Assert.AreEqual(0, cin.Position); + // Field 1: + uint tag = cin.ReadTag(); + Assert.AreEqual(1, tag >> 3); + Assert.AreEqual(1, cin.Position); + Assert.AreEqual(500, cin.ReadInt32()); + Assert.AreEqual(3, cin.Position); + //Field 2: + tag = cin.ReadTag(); + Assert.AreEqual(2, tag >> 3); + Assert.AreEqual(4, cin.Position); + int childlen = cin.ReadLength(); + Assert.AreEqual(120, childlen); + Assert.AreEqual(5, cin.Position); + int oldlimit = cin.PushLimit((int)childlen); + Assert.AreEqual(5, cin.Position); + // Now we are reading child message + { + // Field 11: numeric value: 500 + tag = cin.ReadTag(); + Assert.AreEqual(11, tag >> 3); + Assert.AreEqual(6, cin.Position); + Assert.AreEqual(500, cin.ReadInt32()); + Assert.AreEqual(8, cin.Position); + //Field 12: length delimited 120 bytes + tag = cin.ReadTag(); + Assert.AreEqual(12, tag >> 3); + Assert.AreEqual(9, cin.Position); + ByteString bstr = cin.ReadBytes(); + Assert.AreEqual(110, bstr.Length); + Assert.AreEqual((byte) 109, bstr[109]); + Assert.AreEqual(120, cin.Position); + // Field 13: fixed numeric value: 501 + tag = cin.ReadTag(); + Assert.AreEqual(13, tag >> 3); + // ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit + Assert.AreEqual(121, cin.Position); + Assert.AreEqual(501, cin.ReadSFixed32()); + Assert.AreEqual(125, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + cin.PopLimit(oldlimit); + Assert.AreEqual(125, cin.Position); + // Field 3: fixed numeric value: 501 + tag = cin.ReadTag(); + Assert.AreEqual(3, tag >> 3); + Assert.AreEqual(126, cin.Position); + Assert.AreEqual(501, cin.ReadSFixed32()); + Assert.AreEqual(130, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + } + + [Test] + public void Dispose_DisposesUnderlyingStream() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanWrite); + using (var cos = new CodedOutputStream(memoryStream)) + { + cos.WriteRawByte(0); + Assert.AreEqual(0, memoryStream.Position); // Not flushed yet + } + Assert.AreEqual(1, memoryStream.ToArray().Length); // Flushed data from CodedOutputStream to MemoryStream + Assert.IsFalse(memoryStream.CanWrite); // Disposed + } + + [Test] + public void Dispose_WithLeaveOpen() + { + var memoryStream = new MemoryStream(); + Assert.IsTrue(memoryStream.CanWrite); + using (var cos = new CodedOutputStream(memoryStream, true)) + { + cos.WriteRawByte(0); + Assert.AreEqual(0, memoryStream.Position); // Not flushed yet + } + Assert.AreEqual(1, memoryStream.Position); // Flushed data from CodedOutputStream to MemoryStream + Assert.IsTrue(memoryStream.CanWrite); // We left the stream open + } + + [Test] + public void Dispose_FromByteArray() + { + var stream = new CodedOutputStream(new byte[10]); + stream.Dispose(); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs index 9c8459073c..68b4de45f6 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs @@ -498,6 +498,14 @@ namespace Google.Protobuf.Collections Assert.Throws(() => keys.Contains(null)); } + [Test] + public void KeysCopyTo() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var keys = map.Keys.ToArray(); // Uses CopyTo internally + CollectionAssert.AreEquivalent(new[] { "foo", "x" }, keys); + } + [Test] public void ValuesContains() { @@ -510,6 +518,14 @@ namespace Google.Protobuf.Collections Assert.IsFalse(values.Contains(null)); } + [Test] + public void ValuesCopyTo() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + var values = map.Values.ToArray(); // Uses CopyTo internally + CollectionAssert.AreEquivalent(new[] { "bar", "y" }, values); + } + [Test] public void ToString_StringToString() { @@ -524,6 +540,22 @@ namespace Google.Protobuf.Collections Assert.Throws(() => map.ToString()); } +#if !NET35 + [Test] + public void IDictionaryKeys_Equals_IReadOnlyDictionaryKeys() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + CollectionAssert.AreEquivalent(((IDictionary)map).Keys, ((IReadOnlyDictionary)map).Keys); + } + + [Test] + public void IDictionaryValues_Equals_IReadOnlyDictionaryValues() + { + var map = new MapField { { "foo", "bar" }, { "x", "y" } }; + CollectionAssert.AreEquivalent(((IDictionary)map).Values, ((IReadOnlyDictionary)map).Values); + } +#endif + private static KeyValuePair NewKeyValuePair(TKey key, TValue value) { return new KeyValuePair(key, value); diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs index 8ed54cfb48..6852f75f8e 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs @@ -75,10 +75,96 @@ namespace Google.Protobuf.Collections } [Test] - public void Add_RepeatedField() + public void AddRange_SlowPath() + { + var list = new RepeatedField(); + list.AddRange(new[] { "foo", "bar" }.Select(x => x)); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_SlowPath_NullsProhibited_ReferenceType() + { + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new[] { "foo", null }.Select(x => x))); + } + + [Test] + public void AddRange_SlowPath_NullsProhibited_NullableValueType() + { + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new[] { 20, (int?)null }.Select(x => x))); + } + + [Test] + public void AddRange_Optimized_NonNullableValueType() + { + var list = new RepeatedField(); + list.AddRange(new List { 20, 30 }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual(20, list[0]); + Assert.AreEqual(30, list[1]); + } + + [Test] + public void AddRange_Optimized_ReferenceType() + { + var list = new RepeatedField(); + list.AddRange(new List { "foo", "bar" }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual("foo", list[0]); + Assert.AreEqual("bar", list[1]); + } + + [Test] + public void AddRange_Optimized_NullableValueType() + { + var list = new RepeatedField(); + list.AddRange(new List { 20, 30 }); + Assert.AreEqual(2, list.Count); + Assert.AreEqual((int?) 20, list[0]); + Assert.AreEqual((int?) 30, list[1]); + } + + [Test] + public void AddRange_Optimized_NullsProhibited_ReferenceType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new List { "foo", null })); + } + + [Test] + public void AddRange_Optimized_NullsProhibited_NullableValueType() + { + // We don't just trust that a collection with a nullable element type doesn't contain nulls + var list = new RepeatedField(); + // It's okay for this to throw ArgumentNullException if necessary. + // It's not ideal, but not awful. + Assert.Catch(() => list.AddRange(new List { 20, null })); + } + + [Test] + public void AddRange_AlreadyNotEmpty() + { + var list = new RepeatedField { 1, 2, 3 }; + list.AddRange(new List { 4, 5, 6 }); + CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list); + } + + [Test] + public void AddRange_RepeatedField() { var list = new RepeatedField { "original" }; - list.Add(new RepeatedField { "foo", "bar" }); + list.AddRange(new RepeatedField { "foo", "bar" }); Assert.AreEqual(3, list.Count); Assert.AreEqual("original", list[0]); Assert.AreEqual("foo", list[1]); diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs new file mode 100755 index 0000000000..48c0725fa6 --- /dev/null +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/StreamExtensionsTest.cs @@ -0,0 +1,67 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +#if NET35 +using System; +using System.IO; +using NUnit.Framework; +using Google.Protobuf.Compatibility; + +namespace Google.Protobuf.Test.Compatibility +{ + public class StreamExtensionsTest + { + [Test] + public void CopyToNullArgument() + { + var memoryStream = new MemoryStream(); + Assert.Throws(() => memoryStream.CopyTo(null)); + } + + [Test] + public void CopyToTest() + { + byte[] bytesToStream = new byte[] { 0x31, 0x08, 0xFF, 0x00 }; + Stream source = new MemoryStream(bytesToStream); + Stream destination = new MemoryStream((int)source.Length); + source.CopyTo(destination); + destination.Seek(0, SeekOrigin.Begin); + + Assert.AreEqual(0x31, destination.ReadByte()); + Assert.AreEqual(0x08, destination.ReadByte()); + Assert.AreEqual(0xFF, destination.ReadByte()); + Assert.AreEqual(0x00, destination.ReadByte()); + Assert.AreEqual(-1, destination.ReadByte()); + } + } +} +#endif diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs old mode 100644 new mode 100755 index f0c8d3bcc6..abbe3c955f --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs @@ -34,6 +34,7 @@ using System; using System.Collections.Generic; using System.Reflection; +#if !NET35 namespace Google.Protobuf.Compatibility { public class TypeExtensionsTest @@ -50,24 +51,6 @@ namespace Google.Protobuf.Compatibility { } - [Test] - [TestCase(typeof(int), true)] - [TestCase(typeof(int?), true)] - [TestCase(typeof(Nullable<>), true)] - [TestCase(typeof(WireFormat.WireType), true)] - [TestCase(typeof(string), false)] - [TestCase(typeof(object), false)] - [TestCase(typeof(Enum), false)] - [TestCase(typeof(ValueType), false)] - [TestCase(typeof(TypeExtensionsTest), false)] - [TestCase(typeof(Action), false)] - [TestCase(typeof(Action<>), false)] - [TestCase(typeof(IDisposable), false)] - public void IsValueType(Type type, bool expected) - { - Assert.AreEqual(expected, TypeExtensions.IsValueType(type)); - } - [Test] [TestCase(typeof(object), typeof(string), true)] [TestCase(typeof(object), typeof(int), true)] @@ -131,3 +114,4 @@ namespace Google.Protobuf.Compatibility } } } +#endif diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs index 8dfad8b331..34d5b9f98c 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/DeprecatedMemberTest.cs @@ -1,55 +1,55 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Reflection; -using Google.Protobuf.TestProtos; -using NUnit.Framework; - -namespace Google.Protobuf -{ - public class DeprecatedMemberTest - { - private static void AssertIsDeprecated(MemberInfo member) - { - Assert.NotNull(member); - Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); - } - - [Test] - public void TestDepreatedPrimitiveValue() - { - AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32")); - } - - } -} +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Reflection; +using Google.Protobuf.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class DeprecatedMemberTest + { + private static void AssertIsDeprecated(MemberInfo member) + { + Assert.NotNull(member); + Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); + } + + [Test] + public void TestDepreatedPrimitiveValue() + { + AssertIsDeprecated(typeof(TestDeprecatedFields).GetProperty("DeprecatedInt32")); + } + + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs old mode 100644 new mode 100755 index c616470e81..77641163c0 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs @@ -32,6 +32,7 @@ using System.Collections.Generic; using System.IO; +using System.Reflection; using Google.Protobuf.TestProtos; using NUnit.Framework; @@ -157,15 +158,18 @@ namespace Google.Protobuf { // WriteTagAndValue ignores default values var stream = new MemoryStream(); - var codedOutput = new CodedOutputStream(stream); + CodedOutputStream codedOutput; +#if !NET35 + codedOutput = new CodedOutputStream(stream); codec.WriteTagAndValue(codedOutput, codec.DefaultValue); codedOutput.Flush(); Assert.AreEqual(0, stream.Position); Assert.AreEqual(0, codec.CalculateSizeWithTag(codec.DefaultValue)); - if (typeof(T).IsValueType) + if (typeof(T).GetTypeInfo().IsValueType) { Assert.AreEqual(default(T), codec.DefaultValue); } +#endif // The plain ValueWriter/ValueReader delegates don't. if (codec.DefaultValue != null) // This part isn't appropriate for message types. diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs index b029551c0b..8b153d691f 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.cs @@ -1,723 +1,723 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2015 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; -using Google.Protobuf.TestProtos; -using NUnit.Framework; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Google.Protobuf.WellKnownTypes; - -namespace Google.Protobuf -{ - /// - /// Tests around the generated TestAllTypes message. - /// - public class GeneratedMessageTest - { - [Test] - public void EmptyMessageFieldDistinctFromMissingMessageField() - { - // This demonstrates what we're really interested in... - var message1 = new TestAllTypes { SingleForeignMessage = new ForeignMessage() }; - var message2 = new TestAllTypes(); // SingleForeignMessage is null - EqualityTester.AssertInequality(message1, message2); - } - - [Test] - public void DefaultValues() - { - // Single fields - var message = new TestAllTypes(); - Assert.AreEqual(false, message.SingleBool); - Assert.AreEqual(ByteString.Empty, message.SingleBytes); - Assert.AreEqual(0.0, message.SingleDouble); - Assert.AreEqual(0, message.SingleFixed32); - Assert.AreEqual(0L, message.SingleFixed64); - Assert.AreEqual(0.0f, message.SingleFloat); - Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum); - Assert.IsNull(message.SingleForeignMessage); - Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum); - Assert.IsNull(message.SingleImportMessage); - Assert.AreEqual(0, message.SingleInt32); - Assert.AreEqual(0L, message.SingleInt64); - Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum); - Assert.IsNull(message.SingleNestedMessage); - Assert.IsNull(message.SinglePublicImportMessage); - Assert.AreEqual(0, message.SingleSfixed32); - Assert.AreEqual(0L, message.SingleSfixed64); - Assert.AreEqual(0, message.SingleSint32); - Assert.AreEqual(0L, message.SingleSint64); - Assert.AreEqual("", message.SingleString); - Assert.AreEqual(0U, message.SingleUint32); - Assert.AreEqual(0UL, message.SingleUint64); - - // Repeated fields - Assert.AreEqual(0, message.RepeatedBool.Count); - Assert.AreEqual(0, message.RepeatedBytes.Count); - Assert.AreEqual(0, message.RepeatedDouble.Count); - Assert.AreEqual(0, message.RepeatedFixed32.Count); - Assert.AreEqual(0, message.RepeatedFixed64.Count); - Assert.AreEqual(0, message.RepeatedFloat.Count); - Assert.AreEqual(0, message.RepeatedForeignEnum.Count); - Assert.AreEqual(0, message.RepeatedForeignMessage.Count); - Assert.AreEqual(0, message.RepeatedImportEnum.Count); - Assert.AreEqual(0, message.RepeatedImportMessage.Count); - Assert.AreEqual(0, message.RepeatedNestedEnum.Count); - Assert.AreEqual(0, message.RepeatedNestedMessage.Count); - Assert.AreEqual(0, message.RepeatedPublicImportMessage.Count); - Assert.AreEqual(0, message.RepeatedSfixed32.Count); - Assert.AreEqual(0, message.RepeatedSfixed64.Count); - Assert.AreEqual(0, message.RepeatedSint32.Count); - Assert.AreEqual(0, message.RepeatedSint64.Count); - Assert.AreEqual(0, message.RepeatedString.Count); - Assert.AreEqual(0, message.RepeatedUint32.Count); - Assert.AreEqual(0, message.RepeatedUint64.Count); - - // Oneof fields - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); - Assert.AreEqual(0, message.OneofUint32); - Assert.AreEqual("", message.OneofString); - Assert.AreEqual(ByteString.Empty, message.OneofBytes); - Assert.IsNull(message.OneofNestedMessage); - } - - [Test] - public void NullStringAndBytesRejected() - { - var message = new TestAllTypes(); - Assert.Throws(() => message.SingleString = null); - Assert.Throws(() => message.OneofString = null); - Assert.Throws(() => message.SingleBytes = null); - Assert.Throws(() => message.OneofBytes = null); - } - - [Test] - public void RoundTrip_Empty() - { - var message = new TestAllTypes(); - // Without setting any values, there's nothing to write. - byte[] bytes = message.ToByteArray(); - Assert.AreEqual(0, bytes.Length); - TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); - Assert.AreEqual(message, parsed); - } - - [Test] - public void RoundTrip_SingleValues() - { - var message = new TestAllTypes - { - SingleBool = true, - SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), - SingleDouble = 23.5, - SingleFixed32 = 23, - SingleFixed64 = 1234567890123, - SingleFloat = 12.25f, - SingleForeignEnum = ForeignEnum.ForeignBar, - SingleForeignMessage = new ForeignMessage { C = 10 }, - SingleImportEnum = ImportEnum.ImportBaz, - SingleImportMessage = new ImportMessage { D = 20 }, - SingleInt32 = 100, - SingleInt64 = 3210987654321, - SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, - SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 }, - SinglePublicImportMessage = new PublicImportMessage { E = 54 }, - SingleSfixed32 = -123, - SingleSfixed64 = -12345678901234, - SingleSint32 = -456, - SingleSint64 = -12345678901235, - SingleString = "test", - SingleUint32 = uint.MaxValue, - SingleUint64 = ulong.MaxValue - }; - - byte[] bytes = message.ToByteArray(); - TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); - Assert.AreEqual(message, parsed); - } - - [Test] - public void RoundTrip_RepeatedValues() - { - var message = new TestAllTypes - { - RepeatedBool = { true, false }, - RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, - RepeatedDouble = { -12.25, 23.5 }, - RepeatedFixed32 = { uint.MaxValue, 23 }, - RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, - RepeatedFloat = { 100f, 12.25f }, - RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar }, - RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } }, - RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified }, - RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } }, - RepeatedInt32 = { 100, 200 }, - RepeatedInt64 = { 3210987654321, long.MaxValue }, - RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, - RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } }, - RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } }, - RepeatedSfixed32 = { -123, 123 }, - RepeatedSfixed64 = { -12345678901234, 12345678901234 }, - RepeatedSint32 = { -456, 100 }, - RepeatedSint64 = { -12345678901235, 123 }, - RepeatedString = { "foo", "bar" }, - RepeatedUint32 = { uint.MaxValue, uint.MinValue }, - RepeatedUint64 = { ulong.MaxValue, uint.MinValue } - }; - - byte[] bytes = message.ToByteArray(); - TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); - Assert.AreEqual(message, parsed); - } - - // Note that not every map within map_unittest_proto3 is used. They all go through very - // similar code paths. The fact that all maps are present is validation that we have codecs - // for every type. - [Test] - public void RoundTrip_Maps() - { - var message = new TestMap - { - MapBoolBool = { - { false, true }, - { true, false } - }, - MapInt32Bytes = { - { 5, ByteString.CopyFrom(6, 7, 8) }, - { 25, ByteString.CopyFrom(1, 2, 3, 4, 5) }, - { 10, ByteString.Empty } - }, - MapInt32ForeignMessage = { - { 0, new ForeignMessage { C = 10 } }, - { 5, new ForeignMessage() }, - }, - MapInt32Enum = { - { 1, MapEnum.Bar }, - { 2000, MapEnum.Foo } - } - }; - - byte[] bytes = message.ToByteArray(); - TestMap parsed = TestMap.Parser.ParseFrom(bytes); - Assert.AreEqual(message, parsed); - } - - [Test] - public void MapWithEmptyEntry() - { - var message = new TestMap - { - MapInt32Bytes = { { 0, ByteString.Empty } } - }; - - byte[] bytes = message.ToByteArray(); - Assert.AreEqual(2, bytes.Length); // Tag for field entry (1 byte), length of entry (0; 1 byte) - - var parsed = TestMap.Parser.ParseFrom(bytes); - Assert.AreEqual(1, parsed.MapInt32Bytes.Count); - Assert.AreEqual(ByteString.Empty, parsed.MapInt32Bytes[0]); - } - - [Test] - public void MapWithOnlyValue() - { - // Hand-craft the stream to contain a single entry with just a value. - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); - var nestedMessage = new ForeignMessage { C = 20 }; - // Size of the entry (tag, size written by WriteMessage, data written by WriteMessage) - output.WriteLength(2 + nestedMessage.CalculateSize()); - output.WriteTag(2, WireFormat.WireType.LengthDelimited); - output.WriteMessage(nestedMessage); - output.Flush(); - - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - Assert.AreEqual(nestedMessage, parsed.MapInt32ForeignMessage[0]); - } - - [Test] - public void MapWithOnlyKey_PrimitiveValue() - { - // Hand-craft the stream to contain a single entry with just a key. - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - output.WriteTag(TestMap.MapInt32DoubleFieldNumber, WireFormat.WireType.LengthDelimited); - int key = 10; - output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key); - output.Flush(); - - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - Assert.AreEqual(0.0, parsed.MapInt32Double[key]); - } - - [Test] - public void MapWithOnlyKey_MessageValue() - { - // Hand-craft the stream to contain a single entry with just a key. - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); - int key = 10; - output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key); - output.Flush(); - - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - Assert.AreEqual(new ForeignMessage(), parsed.MapInt32ForeignMessage[key]); - } - - [Test] - public void MapIgnoresExtraFieldsWithinEntryMessages() - { - // Hand-craft the stream to contain a single entry with three fields - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - - output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); - - var key = 10; // Field 1 - var value = 20; // Field 2 - var extra = 30; // Field 3 - - // Each field can be represented in a single byte, with a single byte tag. - // Total message size: 6 bytes. - output.WriteLength(6); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key); - output.WriteTag(2, WireFormat.WireType.Varint); - output.WriteInt32(value); - output.WriteTag(3, WireFormat.WireType.Varint); - output.WriteInt32(extra); - output.Flush(); - - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - Assert.AreEqual(value, parsed.MapInt32Int32[key]); - } - - [Test] - public void MapFieldOrderIsIrrelevant() - { - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - - output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); - - var key = 10; - var value = 20; - - // Each field can be represented in a single byte, with a single byte tag. - // Total message size: 4 bytes. - output.WriteLength(4); - output.WriteTag(2, WireFormat.WireType.Varint); - output.WriteInt32(value); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key); - output.Flush(); - - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - Assert.AreEqual(value, parsed.MapInt32Int32[key]); - } - - [Test] - public void MapNonContiguousEntries() - { - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - - // Message structure: - // Entry for MapInt32Int32 - // Entry for MapStringString - // Entry for MapInt32Int32 - - // First entry - var key1 = 10; - var value1 = 20; - output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); - output.WriteLength(4); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key1); - output.WriteTag(2, WireFormat.WireType.Varint); - output.WriteInt32(value1); - - // Second entry - var key2 = "a"; - var value2 = "b"; - output.WriteTag(TestMap.MapStringStringFieldNumber, WireFormat.WireType.LengthDelimited); - output.WriteLength(6); // 3 bytes per entry: tag, size, character - output.WriteTag(1, WireFormat.WireType.LengthDelimited); - output.WriteString(key2); - output.WriteTag(2, WireFormat.WireType.LengthDelimited); - output.WriteString(value2); - - // Third entry - var key3 = 15; - var value3 = 25; - output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); - output.WriteLength(4); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key3); - output.WriteTag(2, WireFormat.WireType.Varint); - output.WriteInt32(value3); - - output.Flush(); - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - var expected = new TestMap - { - MapInt32Int32 = { { key1, value1 }, { key3, value3 } }, - MapStringString = { { key2, value2 } } - }; - Assert.AreEqual(expected, parsed); - } - - [Test] - public void DuplicateKeys_LastEntryWins() - { - var memoryStream = new MemoryStream(); - var output = new CodedOutputStream(memoryStream); - - var key = 10; - var value1 = 20; - var value2 = 30; - - // First entry - output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); - output.WriteLength(4); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key); - output.WriteTag(2, WireFormat.WireType.Varint); - output.WriteInt32(value1); - - // Second entry - same key, different value - output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); - output.WriteLength(4); - output.WriteTag(1, WireFormat.WireType.Varint); - output.WriteInt32(key); - output.WriteTag(2, WireFormat.WireType.Varint); - output.WriteInt32(value2); - output.Flush(); - - var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); - Assert.AreEqual(value2, parsed.MapInt32Int32[key]); - } - - [Test] - public void CloneSingleNonMessageValues() - { - var original = new TestAllTypes - { - SingleBool = true, - SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), - SingleDouble = 23.5, - SingleFixed32 = 23, - SingleFixed64 = 1234567890123, - SingleFloat = 12.25f, - SingleInt32 = 100, - SingleInt64 = 3210987654321, - SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, - SingleSfixed32 = -123, - SingleSfixed64 = -12345678901234, - SingleSint32 = -456, - SingleSint64 = -12345678901235, - SingleString = "test", - SingleUint32 = uint.MaxValue, - SingleUint64 = ulong.MaxValue - }; - var clone = original.Clone(); - Assert.AreNotSame(original, clone); - Assert.AreEqual(original, clone); - // Just as a single example - clone.SingleInt32 = 150; - Assert.AreNotEqual(original, clone); - } - - [Test] - public void CloneRepeatedNonMessageValues() - { - var original = new TestAllTypes - { - RepeatedBool = { true, false }, - RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, - RepeatedDouble = { -12.25, 23.5 }, - RepeatedFixed32 = { uint.MaxValue, 23 }, - RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, - RepeatedFloat = { 100f, 12.25f }, - RepeatedInt32 = { 100, 200 }, - RepeatedInt64 = { 3210987654321, long.MaxValue }, - RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, - RepeatedSfixed32 = { -123, 123 }, - RepeatedSfixed64 = { -12345678901234, 12345678901234 }, - RepeatedSint32 = { -456, 100 }, - RepeatedSint64 = { -12345678901235, 123 }, - RepeatedString = { "foo", "bar" }, - RepeatedUint32 = { uint.MaxValue, uint.MinValue }, - RepeatedUint64 = { ulong.MaxValue, uint.MinValue } - }; - - var clone = original.Clone(); - Assert.AreNotSame(original, clone); - Assert.AreEqual(original, clone); - // Just as a single example - clone.RepeatedDouble.Add(25.5); - Assert.AreNotEqual(original, clone); - } - - [Test] - public void CloneSingleMessageField() - { - var original = new TestAllTypes - { - SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } - }; - - var clone = original.Clone(); - Assert.AreNotSame(original, clone); - Assert.AreNotSame(original.SingleNestedMessage, clone.SingleNestedMessage); - Assert.AreEqual(original, clone); - - clone.SingleNestedMessage.Bb = 30; - Assert.AreNotEqual(original, clone); - } - - [Test] - public void CloneRepeatedMessageField() - { - var original = new TestAllTypes - { - RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 20 } } - }; - - var clone = original.Clone(); - Assert.AreNotSame(original, clone); - Assert.AreNotSame(original.RepeatedNestedMessage, clone.RepeatedNestedMessage); - Assert.AreNotSame(original.RepeatedNestedMessage[0], clone.RepeatedNestedMessage[0]); - Assert.AreEqual(original, clone); - - clone.RepeatedNestedMessage[0].Bb = 30; - Assert.AreNotEqual(original, clone); - } - - [Test] - public void CloneOneofField() - { - var original = new TestAllTypes - { - OneofNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } - }; - - var clone = original.Clone(); - Assert.AreNotSame(original, clone); - Assert.AreEqual(original, clone); - - // We should have cloned the message - original.OneofNestedMessage.Bb = 30; - Assert.AreNotEqual(original, clone); - } - - [Test] - public void OneofProperties() - { - // Switch the oneof case between each of the different options, and check everything behaves - // as expected in each case. - var message = new TestAllTypes(); - Assert.AreEqual("", message.OneofString); - Assert.AreEqual(0, message.OneofUint32); - Assert.AreEqual(ByteString.Empty, message.OneofBytes); - Assert.IsNull(message.OneofNestedMessage); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); - - message.OneofString = "sample"; - Assert.AreEqual("sample", message.OneofString); - Assert.AreEqual(0, message.OneofUint32); - Assert.AreEqual(ByteString.Empty, message.OneofBytes); - Assert.IsNull(message.OneofNestedMessage); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); - - var bytes = ByteString.CopyFrom(1, 2, 3); - message.OneofBytes = bytes; - Assert.AreEqual("", message.OneofString); - Assert.AreEqual(0, message.OneofUint32); - Assert.AreEqual(bytes, message.OneofBytes); - Assert.IsNull(message.OneofNestedMessage); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase); - - message.OneofUint32 = 20; - Assert.AreEqual("", message.OneofString); - Assert.AreEqual(20, message.OneofUint32); - Assert.AreEqual(ByteString.Empty, message.OneofBytes); - Assert.IsNull(message.OneofNestedMessage); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase); - - var nestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 25 }; - message.OneofNestedMessage = nestedMessage; - Assert.AreEqual("", message.OneofString); - Assert.AreEqual(0, message.OneofUint32); - Assert.AreEqual(ByteString.Empty, message.OneofBytes); - Assert.AreEqual(nestedMessage, message.OneofNestedMessage); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase); - - message.ClearOneofField(); - Assert.AreEqual("", message.OneofString); - Assert.AreEqual(0, message.OneofUint32); - Assert.AreEqual(ByteString.Empty, message.OneofBytes); - Assert.IsNull(message.OneofNestedMessage); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); - } - - [Test] - public void Oneof_DefaultValuesNotEqual() - { - var message1 = new TestAllTypes { OneofString = "" }; - var message2 = new TestAllTypes { OneofUint32 = 0 }; - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message1.OneofFieldCase); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); - Assert.AreNotEqual(message1, message2); - } - - [Test] - public void OneofSerialization_NonDefaultValue() - { - var message = new TestAllTypes(); - message.OneofString = "this would take a bit of space"; - message.OneofUint32 = 10; - var bytes = message.ToByteArray(); - Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - no string! - - var message2 = TestAllTypes.Parser.ParseFrom(bytes); - Assert.AreEqual(message, message2); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); - } - - [Test] - public void OneofSerialization_DefaultValue() - { - var message = new TestAllTypes(); - message.OneofString = "this would take a bit of space"; - message.OneofUint32 = 0; // This is the default value for UInt32; normally wouldn't be serialized - var bytes = message.ToByteArray(); - Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - it's still serialized - - var message2 = TestAllTypes.Parser.ParseFrom(bytes); - Assert.AreEqual(message, message2); - Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); - } - - [Test] - public void IgnoreUnknownFields_RealDataStillRead() - { - var message = SampleMessages.CreateFullTestAllTypes(); - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - var unusedFieldNumber = 23456; - Assert.IsFalse(TestAllTypes.Descriptor.Fields.InDeclarationOrder().Select(x => x.FieldNumber).Contains(unusedFieldNumber)); - output.WriteTag(unusedFieldNumber, WireFormat.WireType.LengthDelimited); - output.WriteString("ignore me"); - message.WriteTo(output); - output.Flush(); - - stream.Position = 0; - var parsed = TestAllTypes.Parser.ParseFrom(stream); - Assert.AreEqual(message, parsed); - } - - [Test] - public void IgnoreUnknownFields_AllTypes() - { - // Simple way of ensuring we can skip all kinds of fields. - var data = SampleMessages.CreateFullTestAllTypes().ToByteArray(); - var empty = Empty.Parser.ParseFrom(data); - Assert.AreEqual(new Empty(), empty); - } - - // This was originally seen as a conformance test failure. - [Test] - public void TruncatedMessageFieldThrows() - { - // 130, 3 is the message tag - // 1 is the data length - but there's no data. - var data = new byte[] { 130, 3, 1 }; - Assert.Throws(() => TestAllTypes.Parser.ParseFrom(data)); - } - - /// - /// Demonstrates current behaviour with an extraneous end group tag - see issue 688 - /// for details; we may want to change this. - /// - [Test] - public void ExtraEndGroupThrows() - { - var message = SampleMessages.CreateFullTestAllTypes(); - var stream = new MemoryStream(); - var output = new CodedOutputStream(stream); - - output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32); - output.WriteFixed32(123); - output.WriteTag(100, WireFormat.WireType.EndGroup); - - output.Flush(); - - stream.Position = 0; - Assert.Throws(() => TestAllTypes.Parser.ParseFrom(stream)); - } - - [Test] - public void CustomDiagnosticMessage_DirectToStringCall() - { - var message = new ForeignMessage { C = 31 }; - Assert.AreEqual("{ \"c\": 31, \"@cInHex\": \"1f\" }", message.ToString()); - Assert.AreEqual("{ \"c\": 31 }", JsonFormatter.Default.Format(message)); - } - - [Test] - public void CustomDiagnosticMessage_Nested() - { - var message = new TestAllTypes { SingleForeignMessage = new ForeignMessage { C = 16 } }; - Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16, \"@cInHex\": \"10\" } }", message.ToString()); - Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16 } }", JsonFormatter.Default.Format(message)); - } - - [Test] - public void CustomDiagnosticMessage_DirectToTextWriterCall() - { - var message = new ForeignMessage { C = 31 }; - var writer = new StringWriter(); - JsonFormatter.Default.Format(message, writer); - Assert.AreEqual("{ \"c\": 31 }", writer.ToString()); - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; +using Google.Protobuf.TestProtos; +using NUnit.Framework; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Google.Protobuf.WellKnownTypes; + +namespace Google.Protobuf +{ + /// + /// Tests around the generated TestAllTypes message. + /// + public class GeneratedMessageTest + { + [Test] + public void EmptyMessageFieldDistinctFromMissingMessageField() + { + // This demonstrates what we're really interested in... + var message1 = new TestAllTypes { SingleForeignMessage = new ForeignMessage() }; + var message2 = new TestAllTypes(); // SingleForeignMessage is null + EqualityTester.AssertInequality(message1, message2); + } + + [Test] + public void DefaultValues() + { + // Single fields + var message = new TestAllTypes(); + Assert.AreEqual(false, message.SingleBool); + Assert.AreEqual(ByteString.Empty, message.SingleBytes); + Assert.AreEqual(0.0, message.SingleDouble); + Assert.AreEqual(0, message.SingleFixed32); + Assert.AreEqual(0L, message.SingleFixed64); + Assert.AreEqual(0.0f, message.SingleFloat); + Assert.AreEqual(ForeignEnum.ForeignUnspecified, message.SingleForeignEnum); + Assert.IsNull(message.SingleForeignMessage); + Assert.AreEqual(ImportEnum.Unspecified, message.SingleImportEnum); + Assert.IsNull(message.SingleImportMessage); + Assert.AreEqual(0, message.SingleInt32); + Assert.AreEqual(0L, message.SingleInt64); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.Unspecified, message.SingleNestedEnum); + Assert.IsNull(message.SingleNestedMessage); + Assert.IsNull(message.SinglePublicImportMessage); + Assert.AreEqual(0, message.SingleSfixed32); + Assert.AreEqual(0L, message.SingleSfixed64); + Assert.AreEqual(0, message.SingleSint32); + Assert.AreEqual(0L, message.SingleSint64); + Assert.AreEqual("", message.SingleString); + Assert.AreEqual(0U, message.SingleUint32); + Assert.AreEqual(0UL, message.SingleUint64); + + // Repeated fields + Assert.AreEqual(0, message.RepeatedBool.Count); + Assert.AreEqual(0, message.RepeatedBytes.Count); + Assert.AreEqual(0, message.RepeatedDouble.Count); + Assert.AreEqual(0, message.RepeatedFixed32.Count); + Assert.AreEqual(0, message.RepeatedFixed64.Count); + Assert.AreEqual(0, message.RepeatedFloat.Count); + Assert.AreEqual(0, message.RepeatedForeignEnum.Count); + Assert.AreEqual(0, message.RepeatedForeignMessage.Count); + Assert.AreEqual(0, message.RepeatedImportEnum.Count); + Assert.AreEqual(0, message.RepeatedImportMessage.Count); + Assert.AreEqual(0, message.RepeatedNestedEnum.Count); + Assert.AreEqual(0, message.RepeatedNestedMessage.Count); + Assert.AreEqual(0, message.RepeatedPublicImportMessage.Count); + Assert.AreEqual(0, message.RepeatedSfixed32.Count); + Assert.AreEqual(0, message.RepeatedSfixed64.Count); + Assert.AreEqual(0, message.RepeatedSint32.Count); + Assert.AreEqual(0, message.RepeatedSint64.Count); + Assert.AreEqual(0, message.RepeatedString.Count); + Assert.AreEqual(0, message.RepeatedUint32.Count); + Assert.AreEqual(0, message.RepeatedUint64.Count); + + // Oneof fields + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + } + + [Test] + public void NullStringAndBytesRejected() + { + var message = new TestAllTypes(); + Assert.Throws(() => message.SingleString = null); + Assert.Throws(() => message.OneofString = null); + Assert.Throws(() => message.SingleBytes = null); + Assert.Throws(() => message.OneofBytes = null); + } + + [Test] + public void RoundTrip_Empty() + { + var message = new TestAllTypes(); + // Without setting any values, there's nothing to write. + byte[] bytes = message.ToByteArray(); + Assert.AreEqual(0, bytes.Length); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void RoundTrip_SingleValues() + { + var message = new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleForeignEnum = ForeignEnum.ForeignBar, + SingleForeignMessage = new ForeignMessage { C = 10 }, + SingleImportEnum = ImportEnum.ImportBaz, + SingleImportMessage = new ImportMessage { D = 20 }, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 35 }, + SinglePublicImportMessage = new PublicImportMessage { E = 54 }, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = uint.MaxValue, + SingleUint64 = ulong.MaxValue + }; + + byte[] bytes = message.ToByteArray(); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void RoundTrip_RepeatedValues() + { + var message = new TestAllTypes + { + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { uint.MaxValue, 23 }, + RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedForeignEnum = { ForeignEnum.ForeignFoo, ForeignEnum.ForeignBar }, + RepeatedForeignMessage = { new ForeignMessage(), new ForeignMessage { C = 10 } }, + RepeatedImportEnum = { ImportEnum.ImportBaz, ImportEnum.Unspecified }, + RepeatedImportMessage = { new ImportMessage { D = 20 }, new ImportMessage { D = 25 } }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, long.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 35 }, new TestAllTypes.Types.NestedMessage { Bb = 10 } }, + RepeatedPublicImportMessage = { new PublicImportMessage { E = 54 }, new PublicImportMessage { E = -1 } }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { uint.MaxValue, uint.MinValue }, + RepeatedUint64 = { ulong.MaxValue, uint.MinValue } + }; + + byte[] bytes = message.ToByteArray(); + TestAllTypes parsed = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + // Note that not every map within map_unittest_proto3 is used. They all go through very + // similar code paths. The fact that all maps are present is validation that we have codecs + // for every type. + [Test] + public void RoundTrip_Maps() + { + var message = new TestMap + { + MapBoolBool = { + { false, true }, + { true, false } + }, + MapInt32Bytes = { + { 5, ByteString.CopyFrom(6, 7, 8) }, + { 25, ByteString.CopyFrom(1, 2, 3, 4, 5) }, + { 10, ByteString.Empty } + }, + MapInt32ForeignMessage = { + { 0, new ForeignMessage { C = 10 } }, + { 5, new ForeignMessage() }, + }, + MapInt32Enum = { + { 1, MapEnum.Bar }, + { 2000, MapEnum.Foo } + } + }; + + byte[] bytes = message.ToByteArray(); + TestMap parsed = TestMap.Parser.ParseFrom(bytes); + Assert.AreEqual(message, parsed); + } + + [Test] + public void MapWithEmptyEntry() + { + var message = new TestMap + { + MapInt32Bytes = { { 0, ByteString.Empty } } + }; + + byte[] bytes = message.ToByteArray(); + Assert.AreEqual(2, bytes.Length); // Tag for field entry (1 byte), length of entry (0; 1 byte) + + var parsed = TestMap.Parser.ParseFrom(bytes); + Assert.AreEqual(1, parsed.MapInt32Bytes.Count); + Assert.AreEqual(ByteString.Empty, parsed.MapInt32Bytes[0]); + } + + [Test] + public void MapWithOnlyValue() + { + // Hand-craft the stream to contain a single entry with just a value. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); + var nestedMessage = new ForeignMessage { C = 20 }; + // Size of the entry (tag, size written by WriteMessage, data written by WriteMessage) + output.WriteLength(2 + nestedMessage.CalculateSize()); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteMessage(nestedMessage); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(nestedMessage, parsed.MapInt32ForeignMessage[0]); + } + + [Test] + public void MapWithOnlyKey_PrimitiveValue() + { + // Hand-craft the stream to contain a single entry with just a key. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32DoubleFieldNumber, WireFormat.WireType.LengthDelimited); + int key = 10; + output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(0.0, parsed.MapInt32Double[key]); + } + + [Test] + public void MapWithOnlyKey_MessageValue() + { + // Hand-craft the stream to contain a single entry with just a key. + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + output.WriteTag(TestMap.MapInt32ForeignMessageFieldNumber, WireFormat.WireType.LengthDelimited); + int key = 10; + output.WriteLength(1 + CodedOutputStream.ComputeInt32Size(key)); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(new ForeignMessage(), parsed.MapInt32ForeignMessage[key]); + } + + [Test] + public void MapIgnoresExtraFieldsWithinEntryMessages() + { + // Hand-craft the stream to contain a single entry with three fields + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + + var key = 10; // Field 1 + var value = 20; // Field 2 + var extra = 30; // Field 3 + + // Each field can be represented in a single byte, with a single byte tag. + // Total message size: 6 bytes. + output.WriteLength(6); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value); + output.WriteTag(3, WireFormat.WireType.Varint); + output.WriteInt32(extra); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value, parsed.MapInt32Int32[key]); + } + + [Test] + public void MapFieldOrderIsIrrelevant() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + + var key = 10; + var value = 20; + + // Each field can be represented in a single byte, with a single byte tag. + // Total message size: 4 bytes. + output.WriteLength(4); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value, parsed.MapInt32Int32[key]); + } + + [Test] + public void MapNonContiguousEntries() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + // Message structure: + // Entry for MapInt32Int32 + // Entry for MapStringString + // Entry for MapInt32Int32 + + // First entry + var key1 = 10; + var value1 = 20; + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key1); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value1); + + // Second entry + var key2 = "a"; + var value2 = "b"; + output.WriteTag(TestMap.MapStringStringFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(6); // 3 bytes per entry: tag, size, character + output.WriteTag(1, WireFormat.WireType.LengthDelimited); + output.WriteString(key2); + output.WriteTag(2, WireFormat.WireType.LengthDelimited); + output.WriteString(value2); + + // Third entry + var key3 = 15; + var value3 = 25; + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key3); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value3); + + output.Flush(); + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + var expected = new TestMap + { + MapInt32Int32 = { { key1, value1 }, { key3, value3 } }, + MapStringString = { { key2, value2 } } + }; + Assert.AreEqual(expected, parsed); + } + + [Test] + public void DuplicateKeys_LastEntryWins() + { + var memoryStream = new MemoryStream(); + var output = new CodedOutputStream(memoryStream); + + var key = 10; + var value1 = 20; + var value2 = 30; + + // First entry + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value1); + + // Second entry - same key, different value + output.WriteTag(TestMap.MapInt32Int32FieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteLength(4); + output.WriteTag(1, WireFormat.WireType.Varint); + output.WriteInt32(key); + output.WriteTag(2, WireFormat.WireType.Varint); + output.WriteInt32(value2); + output.Flush(); + + var parsed = TestMap.Parser.ParseFrom(memoryStream.ToArray()); + Assert.AreEqual(value2, parsed.MapInt32Int32[key]); + } + + [Test] + public void CloneSingleNonMessageValues() + { + var original = new TestAllTypes + { + SingleBool = true, + SingleBytes = ByteString.CopyFrom(1, 2, 3, 4), + SingleDouble = 23.5, + SingleFixed32 = 23, + SingleFixed64 = 1234567890123, + SingleFloat = 12.25f, + SingleInt32 = 100, + SingleInt64 = 3210987654321, + SingleNestedEnum = TestAllTypes.Types.NestedEnum.Foo, + SingleSfixed32 = -123, + SingleSfixed64 = -12345678901234, + SingleSint32 = -456, + SingleSint64 = -12345678901235, + SingleString = "test", + SingleUint32 = uint.MaxValue, + SingleUint64 = ulong.MaxValue + }; + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + // Just as a single example + clone.SingleInt32 = 150; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneRepeatedNonMessageValues() + { + var original = new TestAllTypes + { + RepeatedBool = { true, false }, + RepeatedBytes = { ByteString.CopyFrom(1, 2, 3, 4), ByteString.CopyFrom(5, 6) }, + RepeatedDouble = { -12.25, 23.5 }, + RepeatedFixed32 = { uint.MaxValue, 23 }, + RepeatedFixed64 = { ulong.MaxValue, 1234567890123 }, + RepeatedFloat = { 100f, 12.25f }, + RepeatedInt32 = { 100, 200 }, + RepeatedInt64 = { 3210987654321, long.MaxValue }, + RepeatedNestedEnum = { TestAllTypes.Types.NestedEnum.Foo, TestAllTypes.Types.NestedEnum.Neg }, + RepeatedSfixed32 = { -123, 123 }, + RepeatedSfixed64 = { -12345678901234, 12345678901234 }, + RepeatedSint32 = { -456, 100 }, + RepeatedSint64 = { -12345678901235, 123 }, + RepeatedString = { "foo", "bar" }, + RepeatedUint32 = { uint.MaxValue, uint.MinValue }, + RepeatedUint64 = { ulong.MaxValue, uint.MinValue } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + // Just as a single example + clone.RepeatedDouble.Add(25.5); + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneSingleMessageField() + { + var original = new TestAllTypes + { + SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreNotSame(original.SingleNestedMessage, clone.SingleNestedMessage); + Assert.AreEqual(original, clone); + + clone.SingleNestedMessage.Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneRepeatedMessageField() + { + var original = new TestAllTypes + { + RepeatedNestedMessage = { new TestAllTypes.Types.NestedMessage { Bb = 20 } } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreNotSame(original.RepeatedNestedMessage, clone.RepeatedNestedMessage); + Assert.AreNotSame(original.RepeatedNestedMessage[0], clone.RepeatedNestedMessage[0]); + Assert.AreEqual(original, clone); + + clone.RepeatedNestedMessage[0].Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void CloneOneofField() + { + var original = new TestAllTypes + { + OneofNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } + }; + + var clone = original.Clone(); + Assert.AreNotSame(original, clone); + Assert.AreEqual(original, clone); + + // We should have cloned the message + original.OneofNestedMessage.Bb = 30; + Assert.AreNotEqual(original, clone); + } + + [Test] + public void OneofProperties() + { + // Switch the oneof case between each of the different options, and check everything behaves + // as expected in each case. + var message = new TestAllTypes(); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + + message.OneofString = "sample"; + Assert.AreEqual("sample", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message.OneofFieldCase); + + var bytes = ByteString.CopyFrom(1, 2, 3); + message.OneofBytes = bytes; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(bytes, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofBytes, message.OneofFieldCase); + + message.OneofUint32 = 20; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(20, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message.OneofFieldCase); + + var nestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 25 }; + message.OneofNestedMessage = nestedMessage; + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.AreEqual(nestedMessage, message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofNestedMessage, message.OneofFieldCase); + + message.ClearOneofField(); + Assert.AreEqual("", message.OneofString); + Assert.AreEqual(0, message.OneofUint32); + Assert.AreEqual(ByteString.Empty, message.OneofBytes); + Assert.IsNull(message.OneofNestedMessage); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.None, message.OneofFieldCase); + } + + [Test] + public void Oneof_DefaultValuesNotEqual() + { + var message1 = new TestAllTypes { OneofString = "" }; + var message2 = new TestAllTypes { OneofUint32 = 0 }; + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofString, message1.OneofFieldCase); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + Assert.AreNotEqual(message1, message2); + } + + [Test] + public void OneofSerialization_NonDefaultValue() + { + var message = new TestAllTypes(); + message.OneofString = "this would take a bit of space"; + message.OneofUint32 = 10; + var bytes = message.ToByteArray(); + Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - no string! + + var message2 = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, message2); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + } + + [Test] + public void OneofSerialization_DefaultValue() + { + var message = new TestAllTypes(); + message.OneofString = "this would take a bit of space"; + message.OneofUint32 = 0; // This is the default value for UInt32; normally wouldn't be serialized + var bytes = message.ToByteArray(); + Assert.AreEqual(3, bytes.Length); // 2 bytes for the tag + 1 for the value - it's still serialized + + var message2 = TestAllTypes.Parser.ParseFrom(bytes); + Assert.AreEqual(message, message2); + Assert.AreEqual(TestAllTypes.OneofFieldOneofCase.OneofUint32, message2.OneofFieldCase); + } + + [Test] + public void IgnoreUnknownFields_RealDataStillRead() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + var unusedFieldNumber = 23456; + Assert.IsFalse(TestAllTypes.Descriptor.Fields.InDeclarationOrder().Select(x => x.FieldNumber).Contains(unusedFieldNumber)); + output.WriteTag(unusedFieldNumber, WireFormat.WireType.LengthDelimited); + output.WriteString("ignore me"); + message.WriteTo(output); + output.Flush(); + + stream.Position = 0; + var parsed = TestAllTypes.Parser.ParseFrom(stream); + Assert.AreEqual(message, parsed); + } + + [Test] + public void IgnoreUnknownFields_AllTypes() + { + // Simple way of ensuring we can skip all kinds of fields. + var data = SampleMessages.CreateFullTestAllTypes().ToByteArray(); + var empty = Empty.Parser.ParseFrom(data); + Assert.AreEqual(new Empty(), empty); + } + + // This was originally seen as a conformance test failure. + [Test] + public void TruncatedMessageFieldThrows() + { + // 130, 3 is the message tag + // 1 is the data length - but there's no data. + var data = new byte[] { 130, 3, 1 }; + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(data)); + } + + /// + /// Demonstrates current behaviour with an extraneous end group tag - see issue 688 + /// for details; we may want to change this. + /// + [Test] + public void ExtraEndGroupThrows() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + + output.WriteTag(TestAllTypes.SingleFixed32FieldNumber, WireFormat.WireType.Fixed32); + output.WriteFixed32(123); + output.WriteTag(100, WireFormat.WireType.EndGroup); + + output.Flush(); + + stream.Position = 0; + Assert.Throws(() => TestAllTypes.Parser.ParseFrom(stream)); + } + + [Test] + public void CustomDiagnosticMessage_DirectToStringCall() + { + var message = new ForeignMessage { C = 31 }; + Assert.AreEqual("{ \"c\": 31, \"@cInHex\": \"1f\" }", message.ToString()); + Assert.AreEqual("{ \"c\": 31 }", JsonFormatter.Default.Format(message)); + } + + [Test] + public void CustomDiagnosticMessage_Nested() + { + var message = new TestAllTypes { SingleForeignMessage = new ForeignMessage { C = 16 } }; + Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16, \"@cInHex\": \"10\" } }", message.ToString()); + Assert.AreEqual("{ \"singleForeignMessage\": { \"c\": 16 } }", JsonFormatter.Default.Format(message)); + } + + [Test] + public void CustomDiagnosticMessage_DirectToTextWriterCall() + { + var message = new ForeignMessage { C = 31 }; + var writer = new StringWriter(); + JsonFormatter.Default.Format(message, writer); + Assert.AreEqual("{ \"c\": 31 }", writer.ToString()); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj index 5d3de4a436..06d07b9f4a 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj @@ -1,143 +1,30 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {DD01ED24-3750-4567-9A23-1DB676A15610} - Library - Properties - Google.Protobuf - Google.Protobuf.Test - v4.5 - 512 - 3.5 - - - - + Exe + net451;netcoreapp1.0 + ../../keys/Google.Protobuf.snk + true + true + False - - true - full - false - bin\Debug - obj\Debug\ - DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) - prompt - 4 - true - Off - false + + + + + + + + + + + + + netcoreapp1.0 - - pdbonly - true - bin\Release - obj\Release\ - TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) - prompt - 4 - true - Off - false - - - pdbonly - true - bin\ReleaseSigned - obj\ReleaseSigned\ - TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) - prompt - 4 - true - Off - false - True - ..\..\keys\Google.Protobuf.snk - - - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll - True - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll - True - - - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - True - - - ..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll - True - - - ..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {6908BDCE-D925-43F3-94AC-A531E6DF2591} - Google.Protobuf - - - - - - - - - - - - \ No newline at end of file + + diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs index ddb23aa685..a38d6b08b5 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/IssuesTest.cs @@ -1,82 +1,82 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using Google.Protobuf.Reflection; -using UnitTest.Issues.TestProtos; -using NUnit.Framework; - - -namespace Google.Protobuf -{ - /// - /// Tests for issues which aren't easily compartmentalized into other unit tests. - /// - public class IssuesTest - { - // Issue 45 - [Test] - public void FieldCalledItem() - { - ItemField message = new ItemField { Item = 3 }; - FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); - Assert.NotNull(field); - Assert.AreEqual(3, (int)field.Accessor.GetValue(message)); - } - - [Test] - public void ReservedNames() - { - var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 }; - // Underscores aren't reflected in the JSON. - Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString()); - } - - [Test] - public void JsonNameParseTest() - { - var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor)); - var parser = new JsonParser(settings); - - // It is safe to use either original field name or explicitly specified json_name - Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }, - parser.Parse("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }")); - } - - [Test] - public void JsonNameFormatTest() - { - var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }; - Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }", - JsonFormatter.Default.Format(message)); - } - } -} +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; +using UnitTest.Issues.TestProtos; +using NUnit.Framework; + + +namespace Google.Protobuf +{ + /// + /// Tests for issues which aren't easily compartmentalized into other unit tests. + /// + public class IssuesTest + { + // Issue 45 + [Test] + public void FieldCalledItem() + { + ItemField message = new ItemField { Item = 3 }; + FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); + Assert.NotNull(field); + Assert.AreEqual(3, (int)field.Accessor.GetValue(message)); + } + + [Test] + public void ReservedNames() + { + var message = new ReservedNames { Types_ = 10, Descriptor_ = 20 }; + // Underscores aren't reflected in the JSON. + Assert.AreEqual("{ \"types\": 10, \"descriptor\": 20 }", message.ToString()); + } + + [Test] + public void JsonNameParseTest() + { + var settings = new JsonParser.Settings(10, TypeRegistry.FromFiles(UnittestIssuesReflection.Descriptor)); + var parser = new JsonParser(settings); + + // It is safe to use either original field name or explicitly specified json_name + Assert.AreEqual(new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }, + parser.Parse("{ \"name\": \"test\", \"desc\": \"test2\", \"guid\": \"test3\" }")); + } + + [Test] + public void JsonNameFormatTest() + { + var message = new TestJsonName { Name = "test", Description = "test2", Guid = "test3" }; + Assert.AreEqual("{ \"name\": \"test\", \"desc\": \"test2\", \"exid\": \"test3\" }", + JsonFormatter.Default.Format(message)); + } + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs index 827a75956f..53ac3dc9be 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs @@ -38,6 +38,8 @@ using Google.Protobuf.WellKnownTypes; using Google.Protobuf.Reflection; using static Google.Protobuf.JsonParserTest; // For WrapInQuotes +using System.IO; +using Google.Protobuf.Collections; namespace Google.Protobuf { @@ -50,7 +52,7 @@ namespace Google.Protobuf [Test] public void DefaultValues_WhenOmitted() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(formatDefaultValues: false)); + var formatter = JsonFormatter.Default; AssertJson("{ }", formatter.Format(new ForeignMessage())); AssertJson("{ }", formatter.Format(new TestAllTypes())); @@ -60,10 +62,39 @@ namespace Google.Protobuf [Test] public void DefaultValues_WhenIncluded() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(formatDefaultValues: true)); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true)); AssertJson("{ 'c': 0 }", formatter.Format(new ForeignMessage())); } + [Test] + public void EnumAllowAlias() + { + var message = new TestEnumAllowAlias + { + Value = TestEnumWithDupValue.Foo2, + }; + var actualText = JsonFormatter.Default.Format(message); + var expectedText = "{ 'value': 'FOO1' }"; + AssertJson(expectedText, actualText); + } + + [Test] + public void EnumAsInt() + { + var message = new TestAllTypes + { + SingleForeignEnum = ForeignEnum.ForeignBar, + RepeatedForeignEnum = { ForeignEnum.ForeignBaz, (ForeignEnum) 100, ForeignEnum.ForeignFoo } + }; + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatEnumsAsIntegers(true)); + var actualText = formatter.Format(message); + var expectedText = "{ " + + "'singleForeignEnum': 5, " + + "'repeatedForeignEnum': [ 6, 100, 4 ]" + + " }"; + AssertJson(expectedText, actualText); + } + [Test] public void AllSingleFields() { @@ -227,10 +258,16 @@ namespace Google.Protobuf [Test] [TestCase("foo_bar", "fooBar")] [TestCase("bananaBanana", "bananaBanana")] - [TestCase("BANANABanana", "bananaBanana")] - public void ToCamelCase(string original, string expected) + [TestCase("BANANABanana", "BANANABanana")] + [TestCase("simple", "simple")] + [TestCase("ACTION_AND_ADVENTURE", "ACTIONANDADVENTURE")] + [TestCase("action_and_adventure", "actionAndAdventure")] + [TestCase("kFoo", "kFoo")] + [TestCase("HTTPServer", "HTTPServer")] + [TestCase("CLIENT", "CLIENT")] + public void ToJsonName(string original, string expected) { - Assert.AreEqual(expected, JsonFormatter.ToCamelCase(original)); + Assert.AreEqual(expected, JsonFormatter.ToJsonName(original)); } [Test] @@ -246,9 +283,9 @@ namespace Google.Protobuf } // We should get the same result both with and without "format default values". - var formatter = new JsonFormatter(new JsonFormatter.Settings(false)); + var formatter = JsonFormatter.Default; AssertJson(expectedJson, formatter.Format(message)); - formatter = new JsonFormatter(new JsonFormatter.Settings(true)); + formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true)); AssertJson(expectedJson, formatter.Format(message)); } @@ -280,7 +317,7 @@ namespace Google.Protobuf { // The actual JSON here is very large because there are lots of fields. Just test a couple of them. var message = new TestWellKnownTypes { Int32Field = 10 }; - var formatter = new JsonFormatter(new JsonFormatter.Settings(true)); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true)); var actualJson = formatter.Format(message); Assert.IsTrue(actualJson.Contains("\"int64Field\": null")); Assert.IsFalse(actualJson.Contains("\"int32Field\": null")); @@ -289,7 +326,7 @@ namespace Google.Protobuf [Test] public void OutputIsInNumericFieldOrder_NoDefaults() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(false)); + var formatter = JsonFormatter.Default; var message = new TestJsonFieldOrdering { PlainString = "p1", PlainInt32 = 2 }; AssertJson("{ 'plainString': 'p1', 'plainInt32': 2 }", formatter.Format(message)); message = new TestJsonFieldOrdering { O1Int32 = 5, O2String = "o2", PlainInt32 = 10, PlainString = "plain" }; @@ -301,7 +338,7 @@ namespace Google.Protobuf [Test] public void OutputIsInNumericFieldOrder_WithDefaults() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(true)); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithFormatDefaultValues(true)); var message = new TestJsonFieldOrdering(); AssertJson("{ 'plainString': '', 'plainInt32': 0 }", formatter.Format(message)); message = new TestJsonFieldOrdering { O1Int32 = 5, O2String = "o2", PlainInt32 = 10, PlainString = "plain" }; @@ -465,7 +502,7 @@ namespace Google.Protobuf [Test] public void AnyWellKnownType() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(Timestamp.Descriptor))); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(Timestamp.Descriptor))); var timestamp = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp(); var any = Any.Pack(timestamp); AssertJson("{ '@type': 'type.googleapis.com/google.protobuf.Timestamp', 'value': '1673-06-19T12:34:56Z' }", formatter.Format(any)); @@ -474,7 +511,7 @@ namespace Google.Protobuf [Test] public void AnyMessageType() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor))); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(TestAllTypes.Descriptor))); var message = new TestAllTypes { SingleInt32 = 10, SingleNestedMessage = new TestAllTypes.Types.NestedMessage { Bb = 20 } }; var any = Any.Pack(message); AssertJson("{ '@type': 'type.googleapis.com/protobuf_unittest.TestAllTypes', 'singleInt32': 10, 'singleNestedMessage': { 'bb': 20 } }", formatter.Format(any)); @@ -483,7 +520,7 @@ namespace Google.Protobuf [Test] public void AnyMessageType_CustomPrefix() { - var formatter = new JsonFormatter(new JsonFormatter.Settings(false, TypeRegistry.FromMessages(TestAllTypes.Descriptor))); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(TypeRegistry.FromMessages(TestAllTypes.Descriptor))); var message = new TestAllTypes { SingleInt32 = 10 }; var any = Any.Pack(message, "foo.bar/baz"); AssertJson("{ '@type': 'foo.bar/baz/protobuf_unittest.TestAllTypes', 'singleInt32': 10 }", formatter.Format(any)); @@ -493,7 +530,7 @@ namespace Google.Protobuf public void AnyNested() { var registry = TypeRegistry.FromMessages(TestWellKnownTypes.Descriptor, TestAllTypes.Descriptor); - var formatter = new JsonFormatter(new JsonFormatter.Settings(false, registry)); + var formatter = new JsonFormatter(JsonFormatter.Settings.Default.WithTypeRegistry(registry)); // Nest an Any as the value of an Any. var doubleNestedMessage = new TestAllTypes { SingleInt32 = 20 }; @@ -512,6 +549,67 @@ namespace Google.Protobuf Assert.Throws(() => JsonFormatter.Default.Format(any)); } + [Test] + [TestCase(typeof(BoolValue), true, "true")] + [TestCase(typeof(Int32Value), 32, "32")] + [TestCase(typeof(Int64Value), 32L, "\"32\"")] + [TestCase(typeof(UInt32Value), 32U, "32")] + [TestCase(typeof(UInt64Value), 32UL, "\"32\"")] + [TestCase(typeof(StringValue), "foo", "\"foo\"")] + [TestCase(typeof(FloatValue), 1.5f, "1.5")] + [TestCase(typeof(DoubleValue), 1.5d, "1.5")] + public void Wrappers_Standalone(System.Type wrapperType, object value, string expectedJson) + { + IMessage populated = (IMessage)Activator.CreateInstance(wrapperType); + populated.Descriptor.Fields[WrappersReflection.WrapperValueFieldNumber].Accessor.SetValue(populated, value); + Assert.AreEqual(expectedJson, JsonFormatter.Default.Format(populated)); + } + + // Sanity tests for WriteValue. Not particularly comprehensive, as it's all covered above already, + // as FormatMessage uses WriteValue. + + [TestCase(null, "null")] + [TestCase(1, "1")] + [TestCase(1L, "'1'")] + [TestCase(0.5f, "0.5")] + [TestCase(0.5d, "0.5")] + [TestCase("text", "'text'")] + [TestCase("x\ny", @"'x\ny'")] + [TestCase(ForeignEnum.ForeignBar, "'FOREIGN_BAR'")] + public void WriteValue_Constant(object value, string expectedJson) + { + AssertWriteValue(value, expectedJson); + } + + [Test] + public void WriteValue_Timestamp() + { + var value = new DateTime(1673, 6, 19, 12, 34, 56, DateTimeKind.Utc).ToTimestamp(); + AssertWriteValue(value, "'1673-06-19T12:34:56Z'"); + } + + [Test] + public void WriteValue_Message() + { + var value = new TestAllTypes { SingleInt32 = 100, SingleInt64 = 3210987654321L }; + AssertWriteValue(value, "{ 'singleInt32': 100, 'singleInt64': '3210987654321' }"); + } + + [Test] + public void WriteValue_List() + { + var value = new RepeatedField { 1, 2, 3 }; + AssertWriteValue(value, "[ 1, 2, 3 ]"); + } + + private static void AssertWriteValue(object value, string expectedJson) + { + var writer = new StringWriter(); + JsonFormatter.Default.WriteValue(writer, value); + string actual = writer.ToString(); + AssertJson(expectedJson, actual); + } + /// /// Checks that the actual JSON is the same as the expected JSON - but after replacing /// all apostrophes in the expected JSON with double quotes. This basically makes the tests easier diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonParserTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonParserTest.cs index c3ad851b8a..f595455aa1 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonParserTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/JsonParserTest.cs @@ -133,9 +133,12 @@ namespace Google.Protobuf } [Test] + [TestCase(typeof(BoolValue), "true", true)] [TestCase(typeof(Int32Value), "32", 32)] [TestCase(typeof(Int64Value), "32", 32L)] + [TestCase(typeof(Int64Value), "\"32\"", 32L)] [TestCase(typeof(UInt32Value), "32", 32U)] + [TestCase(typeof(UInt64Value), "\"32\"", 32UL)] [TestCase(typeof(UInt64Value), "32", 32UL)] [TestCase(typeof(StringValue), "\"foo\"", "foo")] [TestCase(typeof(FloatValue), "1.5", 1.5f)] diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Program.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Program.cs new file mode 100755 index 0000000000..954c02b5a2 --- /dev/null +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Program.cs @@ -0,0 +1,48 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using NUnitLite; +using System.Reflection; + +namespace Google.Protobuf.Test +{ + class Program + { + public static int Main(string[] args) + { + #if NET35 + return new AutoRun(typeof(Program).Assembly).Execute(args); + #else + return new AutoRun(typeof(Program).GetTypeInfo().Assembly).Execute(args); + #endif + } + } +} \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml deleted file mode 100644 index 6712a11783..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AppManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs deleted file mode 100644 index f50940e3a6..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("Google.Protobuf.Test")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Google.Protobuf.Test")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs new file mode 100644 index 0000000000..68b4d6af7c --- /dev/null +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/Reflection/CustomOptionsTest.cs @@ -0,0 +1,271 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Reflection; +using Google.Protobuf.WellKnownTypes; +using NUnit.Framework; +using System.IO; +using System.Linq; +using UnitTest.Issues.TestProtos; +using static Google.Protobuf.WireFormat; +using static UnitTest.Issues.TestProtos.ComplexOptionType2.Types; +using static UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types; +using static Google.Protobuf.Test.Reflection.CustomOptionNumber; + +namespace Google.Protobuf.Test.Reflection +{ + // Internal enum to allow us to use "using static" for convenience. + // These are the options defined in unittest_custom_options_proto3.proto + internal enum CustomOptionNumber + { + FileOpt1 = 7736974, + MessageOpt1 = 7739036, + FieldOpt1 = 7740936, + OneofOpt1 = 7740111, + EnumOpt1 = 7753576, + EnumValueOpt1 = 1560678, + ServiceOpt1 = 7887650, + MethodOpt1 = 7890860, + + // All message options... + BoolOpt = 7706090, + Int32Opt = 7705709, + Int64Opt = 7705542, + UInt32Opt = 7704880, + UInt64Opt = 7702367, + SInt32Opt = 7701568, + SInt64Opt = 7700863, + Fixed32Opt = 7700307, + Fixed64Opt = 7700194, + SFixed32Opt = 7698645, + SFixed64Opt = 7685475, + FloatOpt = 7675390, + DoubleOpt = 7673293, + StringOpt = 7673285, + BytesOpt = 7673238, + EnumOpt = 7673233, + MessageTypeOpt = 7665967, + + // Miscellaneous + ComplexOpt4 = 7633546, + ComplexOpt1 = 7646756, + ComplexOpt2 = 7636949, + ComplexOpt3 = 7636463, + + // Aggregates + AggregateFileOpt = 15478479, + AggregateMsgOpt = 15480088, + AggregateFieldOpt = 15481374, + AggregateEnumOpt = 15483218, + AggregateEnumValueOpt = 15486921, + AggregateServiceOpt = 15497145, + AggregateMethodOpt = 15512713, + } + + /// + /// The majority of the testing here is done via parsed descriptors. That's simpler to + /// achieve (and more important) than constructing a CodedInputStream manually. + /// + public class CustomOptionsTest + { + delegate bool OptionFetcher(int field, out T value); + + [Test] + public void EmptyOptionsIsShared() + { + var structOptions = Struct.Descriptor.CustomOptions; + var timestampOptions = Struct.Descriptor.CustomOptions; + Assert.AreSame(structOptions, timestampOptions); + } + + [Test] + public void SimpleIntegerTest() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(MakeTag(1, WireType.Varint)); + output.WriteInt32(1234567); + output.Flush(); + stream.Position = 0; + var input = new CodedInputStream(stream); + input.ReadTag(); + + var options = CustomOptions.Empty; + options = options.ReadOrSkipUnknownField(input); + + int intValue; + Assert.True(options.TryGetInt32(1, out intValue)); + Assert.AreEqual(1234567, intValue); + + string stringValue; + // No ByteString stored values + Assert.False(options.TryGetString(1, out stringValue)); + // Nothing stored for field 2 + Assert.False(options.TryGetInt32(2, out intValue)); + } + + [Test] + public void SimpleStringTest() + { + var stream = new MemoryStream(); + var output = new CodedOutputStream(stream); + output.WriteTag(MakeTag(1, WireType.LengthDelimited)); + output.WriteString("value"); + output.Flush(); + stream.Position = 0; + var input = new CodedInputStream(stream); + input.ReadTag(); + + var options = CustomOptions.Empty; + options = options.ReadOrSkipUnknownField(input); + + string stringValue; + Assert.True(options.TryGetString(1, out stringValue)); + Assert.AreEqual("value", stringValue); + + int intValue; + // No numeric stored values + Assert.False(options.TryGetInt32(1, out intValue)); + // Nothing stored for field 2 + Assert.False(options.TryGetString(2, out stringValue)); + } + + [Test] + public void ScalarOptions() + { + var options = CustomOptionOtherValues.Descriptor.CustomOptions; + AssertOption(-100, options.TryGetInt32, Int32Opt); + AssertOption(12.3456789f, options.TryGetFloat, FloatOpt); + AssertOption(1.234567890123456789d, options.TryGetDouble, DoubleOpt); + AssertOption("Hello, \"World\"", options.TryGetString, StringOpt); + AssertOption(ByteString.CopyFromUtf8("Hello\0World"), options.TryGetBytes, BytesOpt); + AssertOption((int) TestEnumType.TestOptionEnumType2, options.TryGetInt32, EnumOpt); + } + + [Test] + public void MessageOptions() + { + var options = VariousComplexOptions.Descriptor.CustomOptions; + AssertOption(new ComplexOptionType1 { Foo = 42, Foo4 = { 99, 88 } }, options.TryGetMessage, ComplexOpt1); + AssertOption(new ComplexOptionType2 + { + Baz = 987, Bar = new ComplexOptionType1 { Foo = 743 }, + Fred = new ComplexOptionType4 { Waldo = 321 }, + Barney = { new ComplexOptionType4 { Waldo = 101 }, new ComplexOptionType4 { Waldo = 212 } } + }, + options.TryGetMessage, ComplexOpt2); + AssertOption(new ComplexOptionType3 { Qux = 9 }, options.TryGetMessage, ComplexOpt3); + } + + [Test] + public void OptionLocations() + { + var fileOptions = UnittestCustomOptionsProto3Reflection.Descriptor.CustomOptions; + AssertOption(9876543210UL, fileOptions.TryGetUInt64, FileOpt1); + + var messageOptions = TestMessageWithCustomOptions.Descriptor.CustomOptions; + AssertOption(-56, messageOptions.TryGetInt32, MessageOpt1); + + var fieldOptions = TestMessageWithCustomOptions.Descriptor.Fields["field1"] .CustomOptions; + AssertOption(8765432109UL, fieldOptions.TryGetFixed64, FieldOpt1); + + var oneofOptions = TestMessageWithCustomOptions.Descriptor.Oneofs[0].CustomOptions; + AssertOption(-99, oneofOptions.TryGetInt32, OneofOpt1); + + var enumOptions = TestMessageWithCustomOptions.Descriptor.EnumTypes[0].CustomOptions; + AssertOption(-789, enumOptions.TryGetSFixed32, EnumOpt1); + + var enumValueOptions = TestMessageWithCustomOptions.Descriptor.EnumTypes[0].FindValueByNumber(2).CustomOptions; + AssertOption(123, enumValueOptions.TryGetInt32, EnumValueOpt1); + + var service = UnittestCustomOptionsProto3Reflection.Descriptor.Services + .Single(s => s.Name == "TestServiceWithCustomOptions"); + var serviceOptions = service.CustomOptions; + AssertOption(-9876543210, serviceOptions.TryGetSInt64, ServiceOpt1); + + var methodOptions = service.Methods[0].CustomOptions; + AssertOption((int) UnitTest.Issues.TestProtos.MethodOpt1.Val2, methodOptions.TryGetInt32, CustomOptionNumber.MethodOpt1); + } + + [Test] + public void MinValues() + { + var options = CustomOptionMinIntegerValues.Descriptor.CustomOptions; + AssertOption(false, options.TryGetBool, BoolOpt); + AssertOption(int.MinValue, options.TryGetInt32, Int32Opt); + AssertOption(long.MinValue, options.TryGetInt64, Int64Opt); + AssertOption(uint.MinValue, options.TryGetUInt32, UInt32Opt); + AssertOption(ulong.MinValue, options.TryGetUInt64, UInt64Opt); + AssertOption(int.MinValue, options.TryGetSInt32, SInt32Opt); + AssertOption(long.MinValue, options.TryGetSInt64, SInt64Opt); + AssertOption(uint.MinValue, options.TryGetUInt32, Fixed32Opt); + AssertOption(ulong.MinValue, options.TryGetUInt64, Fixed64Opt); + AssertOption(int.MinValue, options.TryGetInt32, SFixed32Opt); + AssertOption(long.MinValue, options.TryGetInt64, SFixed64Opt); + } + + [Test] + public void MaxValues() + { + var options = CustomOptionMaxIntegerValues.Descriptor.CustomOptions; + AssertOption(true, options.TryGetBool, BoolOpt); + AssertOption(int.MaxValue, options.TryGetInt32, Int32Opt); + AssertOption(long.MaxValue, options.TryGetInt64, Int64Opt); + AssertOption(uint.MaxValue, options.TryGetUInt32, UInt32Opt); + AssertOption(ulong.MaxValue, options.TryGetUInt64, UInt64Opt); + AssertOption(int.MaxValue, options.TryGetSInt32, SInt32Opt); + AssertOption(long.MaxValue, options.TryGetSInt64, SInt64Opt); + AssertOption(uint.MaxValue, options.TryGetFixed32, Fixed32Opt); + AssertOption(ulong.MaxValue, options.TryGetFixed64, Fixed64Opt); + AssertOption(int.MaxValue, options.TryGetSFixed32, SFixed32Opt); + AssertOption(long.MaxValue, options.TryGetSFixed64, SFixed64Opt); + } + + [Test] + public void AggregateOptions() + { + // Just two examples + var messageOptions = AggregateMessage.Descriptor.CustomOptions; + AssertOption(new Aggregate { I = 101, S = "MessageAnnotation" }, messageOptions.TryGetMessage, AggregateMsgOpt); + + var fieldOptions = AggregateMessage.Descriptor.Fields["fieldname"].CustomOptions; + AssertOption(new Aggregate { S = "FieldAnnotation" }, fieldOptions.TryGetMessage, AggregateFieldOpt); + } + + private void AssertOption(T expected, OptionFetcher fetcher, CustomOptionNumber field) + { + T actual; + Assert.IsTrue(fetcher((int) field, out actual)); + Assert.AreEqual(expected, actual); + } + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs index fd75b19f42..248f5fa913 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestCornerCases.cs @@ -1,62 +1,62 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using UnitTest.Issues.TestProtos; -using NUnit.Framework; - -namespace Google.Protobuf -{ - public class TestCornerCases - { - [Test] - public void TestRoundTripNegativeEnums() - { - NegativeEnumMessage msg = new NegativeEnumMessage - { - Value = NegativeEnum.MinusOne, - Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }, - PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow } - }; - - Assert.AreEqual(58, msg.CalculateSize()); - - byte[] bytes = new byte[58]; - CodedOutputStream output = new CodedOutputStream(bytes); - - msg.WriteTo(output); - Assert.AreEqual(0, output.SpaceLeft); - - NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes); - Assert.AreEqual(msg, copy); - } - } -} +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using UnitTest.Issues.TestProtos; +using NUnit.Framework; + +namespace Google.Protobuf +{ + public class TestCornerCases + { + [Test] + public void TestRoundTripNegativeEnums() + { + NegativeEnumMessage msg = new NegativeEnumMessage + { + Value = NegativeEnum.MinusOne, + Values = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow }, + PackedValues = { NegativeEnum.Zero, NegativeEnum.MinusOne, NegativeEnum.FiveBelow } + }; + + Assert.AreEqual(58, msg.CalculateSize()); + + byte[] bytes = new byte[58]; + CodedOutputStream output = new CodedOutputStream(bytes); + + msg.WriteTo(output); + Assert.AreEqual(0, output.SpaceLeft); + + NegativeEnumMessage copy = NegativeEnumMessage.Parser.ParseFrom(bytes); + Assert.AreEqual(msg, copy); + } + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs index 3ba4a2b663..9c0518a399 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { /// Holder for reflection information generated from google/protobuf/map_unittest_proto3.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class MapUnittestProto3Reflection { #region Descriptor @@ -173,27 +172,31 @@ namespace Google.Protobuf.TestProtos { #region Messages /// - /// Tests maps. + /// Tests maps. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMap()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMap() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMap(TestMap other) : this() { mapInt32Int32_ = other.mapInt32Int32_.Clone(); mapInt64Int64_ = other.mapInt64Int64_.Clone(); @@ -214,6 +217,7 @@ namespace Google.Protobuf.TestProtos { mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMap Clone() { return new TestMap(this); } @@ -223,6 +227,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Int32 { get { return mapInt32Int32_; } } @@ -232,6 +237,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18); private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt64Int64 { get { return mapInt64Int64_; } } @@ -241,6 +247,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26); private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint32Uint32 { get { return mapUint32Uint32_; } } @@ -250,6 +257,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34); private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint64Uint64 { get { return mapUint64Uint64_; } } @@ -259,6 +267,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42); private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint32Sint32 { get { return mapSint32Sint32_; } } @@ -268,6 +277,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50); private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint64Sint64 { get { return mapSint64Sint64_; } } @@ -277,6 +287,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58); private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed32Fixed32 { get { return mapFixed32Fixed32_; } } @@ -286,6 +297,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66); private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed64Fixed64 { get { return mapFixed64Fixed64_; } } @@ -295,6 +307,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74); private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed32Sfixed32 { get { return mapSfixed32Sfixed32_; } } @@ -304,6 +317,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82); private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed64Sfixed64 { get { return mapSfixed64Sfixed64_; } } @@ -313,6 +327,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Float_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90); private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Float { get { return mapInt32Float_; } } @@ -322,6 +337,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Double_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98); private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Double { get { return mapInt32Double_; } } @@ -331,6 +347,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapBoolBool_codec = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106); private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapBoolBool { get { return mapBoolBool_; } } @@ -340,6 +357,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapStringString_codec = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 114); private readonly pbc::MapField mapStringString_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapStringString { get { return mapStringString_; } } @@ -349,6 +367,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Bytes_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForBytes(18), 122); private readonly pbc::MapField mapInt32Bytes_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Bytes { get { return mapInt32Bytes_; } } @@ -358,6 +377,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Enum_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 130); private readonly pbc::MapField mapInt32Enum_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Enum { get { return mapInt32Enum_; } } @@ -367,14 +387,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32ForeignMessage_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 138); private readonly pbc::MapField mapInt32ForeignMessage_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32ForeignMessage { get { return mapInt32ForeignMessage_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestMap); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestMap other) { if (ReferenceEquals(other, null)) { return false; @@ -402,6 +425,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= MapInt32Int32.GetHashCode(); @@ -424,10 +448,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); @@ -448,6 +474,7 @@ namespace Google.Protobuf.TestProtos { mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec); @@ -470,6 +497,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestMap other) { if (other == null) { return; @@ -493,6 +521,7 @@ namespace Google.Protobuf.TestProtos { mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -574,29 +603,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestMapSubmessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMapSubmessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMapSubmessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMapSubmessage(TestMapSubmessage other) : this() { TestMap = other.testMap_ != null ? other.TestMap.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMapSubmessage Clone() { return new TestMapSubmessage(this); } @@ -604,6 +638,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "test_map" field. public const int TestMapFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMap testMap_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestMap TestMap { get { return testMap_; } set { @@ -611,10 +646,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestMapSubmessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestMapSubmessage other) { if (ReferenceEquals(other, null)) { return false; @@ -626,16 +663,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (testMap_ != null) hash ^= TestMap.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (testMap_ != null) { output.WriteRawTag(10); @@ -643,6 +683,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (testMap_ != null) { @@ -651,6 +692,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestMapSubmessage other) { if (other == null) { return; @@ -663,6 +705,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -683,29 +726,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestMessageMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMessageMap()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMessageMap() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMessageMap(TestMessageMap other) : this() { mapInt32Message_ = other.mapInt32Message_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMessageMap Clone() { return new TestMessageMap(this); } @@ -715,14 +763,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Message_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.TestAllTypes.Parser), 10); private readonly pbc::MapField mapInt32Message_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Message { get { return mapInt32Message_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestMessageMap); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestMessageMap other) { if (ReferenceEquals(other, null)) { return false; @@ -734,26 +785,31 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= MapInt32Message.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { mapInt32Message_.WriteTo(output, _map_mapInt32Message_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += mapInt32Message_.CalculateSize(_map_mapInt32Message_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestMessageMap other) { if (other == null) { return; @@ -761,6 +817,7 @@ namespace Google.Protobuf.TestProtos { mapInt32Message_.Add(other.mapInt32Message_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -779,32 +836,37 @@ namespace Google.Protobuf.TestProtos { } /// - /// Two map fields share the same entry default instance. + /// Two map fields share the same entry default instance. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestSameTypeMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestSameTypeMap()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[3]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestSameTypeMap() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestSameTypeMap(TestSameTypeMap other) : this() { map1_ = other.map1_.Clone(); map2_ = other.map2_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestSameTypeMap Clone() { return new TestSameTypeMap(this); } @@ -814,6 +876,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_map1_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField map1_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Map1 { get { return map1_; } } @@ -823,14 +886,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_map2_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 18); private readonly pbc::MapField map2_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Map2 { get { return map2_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestSameTypeMap); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestSameTypeMap other) { if (ReferenceEquals(other, null)) { return false; @@ -843,6 +909,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Map1.GetHashCode(); @@ -850,15 +917,18 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { map1_.WriteTo(output, _map_map1_codec); map2_.WriteTo(output, _map_map2_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += map1_.CalculateSize(_map_map1_codec); @@ -866,6 +936,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestSameTypeMap other) { if (other == null) { return; @@ -874,6 +945,7 @@ namespace Google.Protobuf.TestProtos { map2_.Add(other.map2_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -895,25 +967,29 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestArenaMap : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestArenaMap()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[4]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestArenaMap() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestArenaMap(TestArenaMap other) : this() { mapInt32Int32_ = other.mapInt32Int32_.Clone(); mapInt64Int64_ = other.mapInt64Int64_.Clone(); @@ -932,6 +1008,7 @@ namespace Google.Protobuf.TestProtos { mapInt32ForeignMessage_ = other.mapInt32ForeignMessage_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestArenaMap Clone() { return new TestArenaMap(this); } @@ -941,6 +1018,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Int32 { get { return mapInt32Int32_; } } @@ -950,6 +1028,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 18); private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt64Int64 { get { return mapInt64Int64_; } } @@ -959,6 +1038,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 26); private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint32Uint32 { get { return mapUint32Uint32_; } } @@ -968,6 +1048,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 34); private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapUint64Uint64 { get { return mapUint64Uint64_; } } @@ -977,6 +1058,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 42); private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint32Sint32 { get { return mapSint32Sint32_; } } @@ -986,6 +1068,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 50); private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSint64Sint64 { get { return mapSint64Sint64_; } } @@ -995,6 +1078,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 58); private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed32Fixed32 { get { return mapFixed32Fixed32_; } } @@ -1004,6 +1088,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 66); private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapFixed64Fixed64 { get { return mapFixed64Fixed64_; } } @@ -1013,6 +1098,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 74); private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed32Sfixed32 { get { return mapSfixed32Sfixed32_; } } @@ -1022,6 +1108,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 82); private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapSfixed64Sfixed64 { get { return mapSfixed64Sfixed64_; } } @@ -1031,6 +1118,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Float_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 90); private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Float { get { return mapInt32Float_; } } @@ -1040,6 +1128,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Double_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 98); private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Double { get { return mapInt32Double_; } } @@ -1049,6 +1138,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapBoolBool_codec = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 106); private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapBoolBool { get { return mapBoolBool_; } } @@ -1058,6 +1148,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32Enum_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::Google.Protobuf.TestProtos.MapEnum) x), 114); private readonly pbc::MapField mapInt32Enum_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32Enum { get { return mapInt32Enum_; } } @@ -1067,14 +1158,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_mapInt32ForeignMessage_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.ForeignMessage.Parser), 122); private readonly pbc::MapField mapInt32ForeignMessage_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField MapInt32ForeignMessage { get { return mapInt32ForeignMessage_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestArenaMap); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestArenaMap other) { if (ReferenceEquals(other, null)) { return false; @@ -1100,6 +1194,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= MapInt32Int32.GetHashCode(); @@ -1120,10 +1215,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); @@ -1142,6 +1239,7 @@ namespace Google.Protobuf.TestProtos { mapInt32ForeignMessage_.WriteTo(output, _map_mapInt32ForeignMessage_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec); @@ -1162,6 +1260,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestArenaMap other) { if (other == null) { return; @@ -1183,6 +1282,7 @@ namespace Google.Protobuf.TestProtos { mapInt32ForeignMessage_.Add(other.mapInt32ForeignMessage_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1257,32 +1357,37 @@ namespace Google.Protobuf.TestProtos { } /// - /// Previously, message containing enum called Type cannot be used as value of - /// map field. + /// Previously, message containing enum called Type cannot be used as value of + /// map field. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class MessageContainingEnumCalledType : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageContainingEnumCalledType()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[5]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingEnumCalledType() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingEnumCalledType(MessageContainingEnumCalledType other) : this() { type_ = other.type_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingEnumCalledType Clone() { return new MessageContainingEnumCalledType(this); } @@ -1292,14 +1397,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_type_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.TestProtos.MessageContainingEnumCalledType.Parser), 10); private readonly pbc::MapField type_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Type { get { return type_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MessageContainingEnumCalledType); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MessageContainingEnumCalledType other) { if (ReferenceEquals(other, null)) { return false; @@ -1311,26 +1419,31 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Type.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { type_.WriteTo(output, _map_type_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += type_.CalculateSize(_map_type_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MessageContainingEnumCalledType other) { if (other == null) { return; @@ -1338,6 +1451,7 @@ namespace Google.Protobuf.TestProtos { type_.Add(other.type_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1355,7 +1469,7 @@ namespace Google.Protobuf.TestProtos { #region Nested types /// Container for nested types declared in the MessageContainingEnumCalledType message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { public enum Type { [pbr::OriginalName("TYPE_FOO")] Foo = 0, @@ -1367,31 +1481,36 @@ namespace Google.Protobuf.TestProtos { } /// - /// Previously, message cannot contain map field called "entry". + /// Previously, message cannot contain map field called "entry". /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class MessageContainingMapCalledEntry : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageContainingMapCalledEntry()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.MapUnittestProto3Reflection.Descriptor.MessageTypes[6]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingMapCalledEntry() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingMapCalledEntry(MessageContainingMapCalledEntry other) : this() { entry_ = other.entry_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageContainingMapCalledEntry Clone() { return new MessageContainingMapCalledEntry(this); } @@ -1401,14 +1520,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_entry_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 10); private readonly pbc::MapField entry_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Entry { get { return entry_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MessageContainingMapCalledEntry); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MessageContainingMapCalledEntry other) { if (ReferenceEquals(other, null)) { return false; @@ -1420,26 +1542,31 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Entry.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { entry_.WriteTo(output, _map_entry_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += entry_.CalculateSize(_map_entry_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MessageContainingMapCalledEntry other) { if (other == null) { return; @@ -1447,6 +1574,7 @@ namespace Google.Protobuf.TestProtos { entry_.Add(other.entry_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs new file mode 100644 index 0000000000..fbeb512ac7 --- /dev/null +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs @@ -0,0 +1,3688 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/protobuf/test_messages_proto3.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace ProtobufTestMessages.Proto3 { + + /// Holder for reflection information generated from google/protobuf/test_messages_proto3.proto + public static partial class TestMessagesProto3Reflection { + + #region Descriptor + /// File descriptor for google/protobuf/test_messages_proto3.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static TestMessagesProto3Reflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cipnb29nbGUvcHJvdG9idWYvdGVzdF9tZXNzYWdlc19wcm90bzMucHJvdG8S", + "HXByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zGhlnb29nbGUvcHJvdG9i", + "dWYvYW55LnByb3RvGh5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8a", + "IGdvb2dsZS9wcm90b2J1Zi9maWVsZF9tYXNrLnByb3RvGhxnb29nbGUvcHJv", + "dG9idWYvc3RydWN0LnByb3RvGh9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1w", + "LnByb3RvGh5nb29nbGUvcHJvdG9idWYvd3JhcHBlcnMucHJvdG8i+DkKDFRl", + "c3RBbGxUeXBlcxIWCg5vcHRpb25hbF9pbnQzMhgBIAEoBRIWCg5vcHRpb25h", + "bF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25hbF91aW50MzIYAyABKA0SFwoPb3B0", + "aW9uYWxfdWludDY0GAQgASgEEhcKD29wdGlvbmFsX3NpbnQzMhgFIAEoERIX", + "Cg9vcHRpb25hbF9zaW50NjQYBiABKBISGAoQb3B0aW9uYWxfZml4ZWQzMhgH", + "IAEoBxIYChBvcHRpb25hbF9maXhlZDY0GAggASgGEhkKEW9wdGlvbmFsX3Nm", + "aXhlZDMyGAkgASgPEhkKEW9wdGlvbmFsX3NmaXhlZDY0GAogASgQEhYKDm9w", + "dGlvbmFsX2Zsb2F0GAsgASgCEhcKD29wdGlvbmFsX2RvdWJsZRgMIAEoARIV", + "Cg1vcHRpb25hbF9ib29sGA0gASgIEhcKD29wdGlvbmFsX3N0cmluZxgOIAEo", + "CRIWCg5vcHRpb25hbF9ieXRlcxgPIAEoDBJaChdvcHRpb25hbF9uZXN0ZWRf", + "bWVzc2FnZRgSIAEoCzI5LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8z", + "LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEk8KGG9wdGlvbmFsX2ZvcmVp", + "Z25fbWVzc2FnZRgTIAEoCzItLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJv", + "dG8zLkZvcmVpZ25NZXNzYWdlElQKFG9wdGlvbmFsX25lc3RlZF9lbnVtGBUg", + "ASgOMjYucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5", + "cGVzLk5lc3RlZEVudW0SSQoVb3B0aW9uYWxfZm9yZWlnbl9lbnVtGBYgASgO", + "MioucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuRm9yZWlnbkVudW0S", + "IQoVb3B0aW9uYWxfc3RyaW5nX3BpZWNlGBggASgJQgIIAhIZCg1vcHRpb25h", + "bF9jb3JkGBkgASgJQgIIARJGChFyZWN1cnNpdmVfbWVzc2FnZRgbIAEoCzIr", + "LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zLlRlc3RBbGxUeXBlcxIW", + "Cg5yZXBlYXRlZF9pbnQzMhgfIAMoBRIWCg5yZXBlYXRlZF9pbnQ2NBggIAMo", + "AxIXCg9yZXBlYXRlZF91aW50MzIYISADKA0SFwoPcmVwZWF0ZWRfdWludDY0", + "GCIgAygEEhcKD3JlcGVhdGVkX3NpbnQzMhgjIAMoERIXCg9yZXBlYXRlZF9z", + "aW50NjQYJCADKBISGAoQcmVwZWF0ZWRfZml4ZWQzMhglIAMoBxIYChByZXBl", + "YXRlZF9maXhlZDY0GCYgAygGEhkKEXJlcGVhdGVkX3NmaXhlZDMyGCcgAygP", + "EhkKEXJlcGVhdGVkX3NmaXhlZDY0GCggAygQEhYKDnJlcGVhdGVkX2Zsb2F0", + "GCkgAygCEhcKD3JlcGVhdGVkX2RvdWJsZRgqIAMoARIVCg1yZXBlYXRlZF9i", + "b29sGCsgAygIEhcKD3JlcGVhdGVkX3N0cmluZxgsIAMoCRIWCg5yZXBlYXRl", + "ZF9ieXRlcxgtIAMoDBJaChdyZXBlYXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMo", + "CzI5LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zLlRlc3RBbGxUeXBl", + "cy5OZXN0ZWRNZXNzYWdlEk8KGHJlcGVhdGVkX2ZvcmVpZ25fbWVzc2FnZRgx", + "IAMoCzItLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zLkZvcmVpZ25N", + "ZXNzYWdlElQKFHJlcGVhdGVkX25lc3RlZF9lbnVtGDMgAygOMjYucHJvdG9i", + "dWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5cGVzLk5lc3RlZEVu", + "dW0SSQoVcmVwZWF0ZWRfZm9yZWlnbl9lbnVtGDQgAygOMioucHJvdG9idWZf", + "dGVzdF9tZXNzYWdlcy5wcm90bzMuRm9yZWlnbkVudW0SIQoVcmVwZWF0ZWRf", + "c3RyaW5nX3BpZWNlGDYgAygJQgIIAhIZCg1yZXBlYXRlZF9jb3JkGDcgAygJ", + "QgIIARJXCg9tYXBfaW50MzJfaW50MzIYOCADKAsyPi5wcm90b2J1Zl90ZXN0", + "X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwSW50MzJJbnQzMkVu", + "dHJ5ElcKD21hcF9pbnQ2NF9pbnQ2NBg5IAMoCzI+LnByb3RvYnVmX3Rlc3Rf", + "bWVzc2FnZXMucHJvdG8zLlRlc3RBbGxUeXBlcy5NYXBJbnQ2NEludDY0RW50", + "cnkSWwoRbWFwX3VpbnQzMl91aW50MzIYOiADKAsyQC5wcm90b2J1Zl90ZXN0", + "X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwVWludDMyVWludDMy", + "RW50cnkSWwoRbWFwX3VpbnQ2NF91aW50NjQYOyADKAsyQC5wcm90b2J1Zl90", + "ZXN0X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwVWludDY0VWlu", + "dDY0RW50cnkSWwoRbWFwX3NpbnQzMl9zaW50MzIYPCADKAsyQC5wcm90b2J1", + "Zl90ZXN0X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwU2ludDMy", + "U2ludDMyRW50cnkSWwoRbWFwX3NpbnQ2NF9zaW50NjQYPSADKAsyQC5wcm90", + "b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwU2lu", + "dDY0U2ludDY0RW50cnkSXwoTbWFwX2ZpeGVkMzJfZml4ZWQzMhg+IAMoCzJC", + "LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zLlRlc3RBbGxUeXBlcy5N", + "YXBGaXhlZDMyRml4ZWQzMkVudHJ5El8KE21hcF9maXhlZDY0X2ZpeGVkNjQY", + "PyADKAsyQi5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxs", + "VHlwZXMuTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRJjChVtYXBfc2ZpeGVkMzJf", + "c2ZpeGVkMzIYQCADKAsyRC5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3Rv", + "My5UZXN0QWxsVHlwZXMuTWFwU2ZpeGVkMzJTZml4ZWQzMkVudHJ5EmMKFW1h", + "cF9zZml4ZWQ2NF9zZml4ZWQ2NBhBIAMoCzJELnByb3RvYnVmX3Rlc3RfbWVz", + "c2FnZXMucHJvdG8zLlRlc3RBbGxUeXBlcy5NYXBTZml4ZWQ2NFNmaXhlZDY0", + "RW50cnkSVwoPbWFwX2ludDMyX2Zsb2F0GEIgAygLMj4ucHJvdG9idWZfdGVz", + "dF9tZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5cGVzLk1hcEludDMyRmxvYXRF", + "bnRyeRJZChBtYXBfaW50MzJfZG91YmxlGEMgAygLMj8ucHJvdG9idWZfdGVz", + "dF9tZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5cGVzLk1hcEludDMyRG91Ymxl", + "RW50cnkSUwoNbWFwX2Jvb2xfYm9vbBhEIAMoCzI8LnByb3RvYnVmX3Rlc3Rf", + "bWVzc2FnZXMucHJvdG8zLlRlc3RBbGxUeXBlcy5NYXBCb29sQm9vbEVudHJ5", + "ElsKEW1hcF9zdHJpbmdfc3RyaW5nGEUgAygLMkAucHJvdG9idWZfdGVzdF9t", + "ZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5cGVzLk1hcFN0cmluZ1N0cmluZ0Vu", + "dHJ5ElkKEG1hcF9zdHJpbmdfYnl0ZXMYRiADKAsyPy5wcm90b2J1Zl90ZXN0", + "X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwU3RyaW5nQnl0ZXNF", + "bnRyeRJqChltYXBfc3RyaW5nX25lc3RlZF9tZXNzYWdlGEcgAygLMkcucHJv", + "dG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5cGVzLk1hcFN0", + "cmluZ05lc3RlZE1lc3NhZ2VFbnRyeRJsChptYXBfc3RyaW5nX2ZvcmVpZ25f", + "bWVzc2FnZRhIIAMoCzJILnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8z", + "LlRlc3RBbGxUeXBlcy5NYXBTdHJpbmdGb3JlaWduTWVzc2FnZUVudHJ5EmQK", + "Fm1hcF9zdHJpbmdfbmVzdGVkX2VudW0YSSADKAsyRC5wcm90b2J1Zl90ZXN0", + "X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTWFwU3RyaW5nTmVzdGVk", + "RW51bUVudHJ5EmYKF21hcF9zdHJpbmdfZm9yZWlnbl9lbnVtGEogAygLMkUu", + "cHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuVGVzdEFsbFR5cGVzLk1h", + "cFN0cmluZ0ZvcmVpZ25FbnVtRW50cnkSFgoMb25lb2ZfdWludDMyGG8gASgN", + "SAASWQoUb25lb2ZfbmVzdGVkX21lc3NhZ2UYcCABKAsyOS5wcm90b2J1Zl90", + "ZXN0X21lc3NhZ2VzLnByb3RvMy5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2Fn", + "ZUgAEhYKDG9uZW9mX3N0cmluZxhxIAEoCUgAEhUKC29uZW9mX2J5dGVzGHIg", + "ASgMSAASFAoKb25lb2ZfYm9vbBhzIAEoCEgAEhYKDG9uZW9mX3VpbnQ2NBh0", + "IAEoBEgAEhUKC29uZW9mX2Zsb2F0GHUgASgCSAASFgoMb25lb2ZfZG91Ymxl", + "GHYgASgBSAASTAoKb25lb2ZfZW51bRh3IAEoDjI2LnByb3RvYnVmX3Rlc3Rf", + "bWVzc2FnZXMucHJvdG8zLlRlc3RBbGxUeXBlcy5OZXN0ZWRFbnVtSAASOgoV", + "b3B0aW9uYWxfYm9vbF93cmFwcGVyGMkBIAEoCzIaLmdvb2dsZS5wcm90b2J1", + "Zi5Cb29sVmFsdWUSPAoWb3B0aW9uYWxfaW50MzJfd3JhcHBlchjKASABKAsy", + "Gy5nb29nbGUucHJvdG9idWYuSW50MzJWYWx1ZRI8ChZvcHRpb25hbF9pbnQ2", + "NF93cmFwcGVyGMsBIAEoCzIbLmdvb2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVl", + "Ej4KF29wdGlvbmFsX3VpbnQzMl93cmFwcGVyGMwBIAEoCzIcLmdvb2dsZS5w", + "cm90b2J1Zi5VSW50MzJWYWx1ZRI+ChdvcHRpb25hbF91aW50NjRfd3JhcHBl", + "chjNASABKAsyHC5nb29nbGUucHJvdG9idWYuVUludDY0VmFsdWUSPAoWb3B0", + "aW9uYWxfZmxvYXRfd3JhcHBlchjOASABKAsyGy5nb29nbGUucHJvdG9idWYu", + "RmxvYXRWYWx1ZRI+ChdvcHRpb25hbF9kb3VibGVfd3JhcHBlchjPASABKAsy", + "HC5nb29nbGUucHJvdG9idWYuRG91YmxlVmFsdWUSPgoXb3B0aW9uYWxfc3Ry", + "aW5nX3dyYXBwZXIY0AEgASgLMhwuZ29vZ2xlLnByb3RvYnVmLlN0cmluZ1Zh", + "bHVlEjwKFm9wdGlvbmFsX2J5dGVzX3dyYXBwZXIY0QEgASgLMhsuZ29vZ2xl", + "LnByb3RvYnVmLkJ5dGVzVmFsdWUSOgoVcmVwZWF0ZWRfYm9vbF93cmFwcGVy", + "GNMBIAMoCzIaLmdvb2dsZS5wcm90b2J1Zi5Cb29sVmFsdWUSPAoWcmVwZWF0", + "ZWRfaW50MzJfd3JhcHBlchjUASADKAsyGy5nb29nbGUucHJvdG9idWYuSW50", + "MzJWYWx1ZRI8ChZyZXBlYXRlZF9pbnQ2NF93cmFwcGVyGNUBIAMoCzIbLmdv", + "b2dsZS5wcm90b2J1Zi5JbnQ2NFZhbHVlEj4KF3JlcGVhdGVkX3VpbnQzMl93", + "cmFwcGVyGNYBIAMoCzIcLmdvb2dsZS5wcm90b2J1Zi5VSW50MzJWYWx1ZRI+", + "ChdyZXBlYXRlZF91aW50NjRfd3JhcHBlchjXASADKAsyHC5nb29nbGUucHJv", + "dG9idWYuVUludDY0VmFsdWUSPAoWcmVwZWF0ZWRfZmxvYXRfd3JhcHBlchjY", + "ASADKAsyGy5nb29nbGUucHJvdG9idWYuRmxvYXRWYWx1ZRI+ChdyZXBlYXRl", + "ZF9kb3VibGVfd3JhcHBlchjZASADKAsyHC5nb29nbGUucHJvdG9idWYuRG91", + "YmxlVmFsdWUSPgoXcmVwZWF0ZWRfc3RyaW5nX3dyYXBwZXIY2gEgAygLMhwu", + "Z29vZ2xlLnByb3RvYnVmLlN0cmluZ1ZhbHVlEjwKFnJlcGVhdGVkX2J5dGVz", + "X3dyYXBwZXIY2wEgAygLMhsuZ29vZ2xlLnByb3RvYnVmLkJ5dGVzVmFsdWUS", + "NQoRb3B0aW9uYWxfZHVyYXRpb24YrQIgASgLMhkuZ29vZ2xlLnByb3RvYnVm", + "LkR1cmF0aW9uEjcKEm9wdGlvbmFsX3RpbWVzdGFtcBiuAiABKAsyGi5nb29n", + "bGUucHJvdG9idWYuVGltZXN0YW1wEjgKE29wdGlvbmFsX2ZpZWxkX21hc2sY", + "rwIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIxCg9vcHRpb25h", + "bF9zdHJ1Y3QYsAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBIrCgxv", + "cHRpb25hbF9hbnkYsQIgASgLMhQuZ29vZ2xlLnByb3RvYnVmLkFueRIvCg5v", + "cHRpb25hbF92YWx1ZRiyAiABKAsyFi5nb29nbGUucHJvdG9idWYuVmFsdWUS", + "NQoRcmVwZWF0ZWRfZHVyYXRpb24YtwIgAygLMhkuZ29vZ2xlLnByb3RvYnVm", + "LkR1cmF0aW9uEjcKEnJlcGVhdGVkX3RpbWVzdGFtcBi4AiADKAsyGi5nb29n", + "bGUucHJvdG9idWYuVGltZXN0YW1wEjcKEnJlcGVhdGVkX2ZpZWxkbWFzaxi5", + "AiADKAsyGi5nb29nbGUucHJvdG9idWYuRmllbGRNYXNrEjEKD3JlcGVhdGVk", + "X3N0cnVjdBjEAiADKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0EisKDHJl", + "cGVhdGVkX2FueRi7AiADKAsyFC5nb29nbGUucHJvdG9idWYuQW55Ei8KDnJl", + "cGVhdGVkX3ZhbHVlGLwCIAMoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1ZRIT", + "CgpmaWVsZG5hbWUxGJEDIAEoBRIUCgtmaWVsZF9uYW1lMhiSAyABKAUSFQoM", + "X2ZpZWxkX25hbWUzGJMDIAEoBRIWCg1maWVsZF9fbmFtZTRfGJQDIAEoBRIU", + "CgtmaWVsZDBuYW1lNRiVAyABKAUSFgoNZmllbGRfMF9uYW1lNhiWAyABKAUS", + "EwoKZmllbGROYW1lNxiXAyABKAUSEwoKRmllbGROYW1lOBiYAyABKAUSFAoL", + "ZmllbGRfTmFtZTkYmQMgASgFEhUKDEZpZWxkX05hbWUxMBiaAyABKAUSFQoM", + "RklFTERfTkFNRTExGJsDIAEoBRIVCgxGSUVMRF9uYW1lMTIYnAMgASgFEhcK", + "Dl9fZmllbGRfbmFtZTEzGJ0DIAEoBRIXCg5fX0ZpZWxkX25hbWUxNBieAyAB", + "KAUSFgoNZmllbGRfX25hbWUxNRifAyABKAUSFgoNZmllbGRfX05hbWUxNhig", + "AyABKAUSFwoOZmllbGRfbmFtZTE3X18YoQMgASgFEhcKDkZpZWxkX25hbWUx", + "OF9fGKIDIAEoBRpcCg1OZXN0ZWRNZXNzYWdlEgkKAWEYASABKAUSQAoLY29y", + "ZWN1cnNpdmUYAiABKAsyKy5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3Rv", + "My5UZXN0QWxsVHlwZXMaNAoSTWFwSW50MzJJbnQzMkVudHJ5EgsKA2tleRgB", + "IAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFwSW50NjRJbnQ2NEVudHJ5", + "EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoCOAEaNgoUTWFwVWludDMy", + "VWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZhbHVlGAIgASgNOgI4ARo2", + "ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkYASABKAQSDQoFdmFsdWUY", + "AiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVudHJ5EgsKA2tleRgBIAEo", + "ERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2ludDY0U2ludDY0RW50cnkS", + "CwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4ARo4ChZNYXBGaXhlZDMy", + "Rml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2YWx1ZRgCIAEoBzoCOAEa", + "OAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNrZXkYASABKAYSDQoFdmFs", + "dWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRILCgNr", + "ZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoKGE1hcFNmaXhlZDY0U2Zp", + "eGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFsdWUYAiABKBA6AjgBGjQK", + "Ek1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASABKAUSDQoFdmFsdWUYAiAB", + "KAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkSCwoDa2V5GAEgASgFEg0K", + "BXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9vbEVudHJ5EgsKA2tleRgB", + "IAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaNgoUTWFwU3RyaW5nU3RyaW5nRW50", + "cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARo1ChNNYXBTdHJp", + "bmdCeXRlc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoDDoCOAEa", + "eAobTWFwU3RyaW5nTmVzdGVkTWVzc2FnZUVudHJ5EgsKA2tleRgBIAEoCRJI", + "CgV2YWx1ZRgCIAEoCzI5LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8z", + "LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlOgI4ARptChxNYXBTdHJpbmdG", + "b3JlaWduTWVzc2FnZUVudHJ5EgsKA2tleRgBIAEoCRI8CgV2YWx1ZRgCIAEo", + "CzItLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zLkZvcmVpZ25NZXNz", + "YWdlOgI4ARpyChhNYXBTdHJpbmdOZXN0ZWRFbnVtRW50cnkSCwoDa2V5GAEg", + "ASgJEkUKBXZhbHVlGAIgASgOMjYucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5w", + "cm90bzMuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW06AjgBGmcKGU1hcFN0cmlu", + "Z0ZvcmVpZ25FbnVtRW50cnkSCwoDa2V5GAEgASgJEjkKBXZhbHVlGAIgASgO", + "MioucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzMuRm9yZWlnbkVudW06", + "AjgBIjkKCk5lc3RlZEVudW0SBwoDRk9PEAASBwoDQkFSEAESBwoDQkFaEAIS", + "EAoDTkVHEP///////////wFCDQoLb25lb2ZfZmllbGQiGwoORm9yZWlnbk1l", + "c3NhZ2USCQoBYxgBIAEoBSpACgtGb3JlaWduRW51bRIPCgtGT1JFSUdOX0ZP", + "TxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9CQVoQAkIvCihjb20u", + "Z29vZ2xlLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8zSAH4AQFiBnBy", + "b3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.WrappersReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto3.ForeignEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypes), global::ProtobufTestMessages.Proto3.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", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "OptionalBoolWrapper", "OptionalInt32Wrapper", "OptionalInt64Wrapper", "OptionalUint32Wrapper", "OptionalUint64Wrapper", "OptionalFloatWrapper", "OptionalDoubleWrapper", "OptionalStringWrapper", "OptionalBytesWrapper", "RepeatedBoolWrapper", "RepeatedInt32Wrapper", "RepeatedInt64Wrapper", "RepeatedUint32Wrapper", "RepeatedUint64Wrapper", "RepeatedFloatWrapper", "RepeatedDoubleWrapper", "RepeatedStringWrapper", "RepeatedBytesWrapper", "OptionalDuration", "OptionalTimestamp", "OptionalFieldMask", "OptionalStruct", "OptionalAny", "OptionalValue", "RepeatedDuration", "RepeatedTimestamp", "RepeatedFieldmask", "RepeatedStruct", "RepeatedAny", "RepeatedValue", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage), global::ProtobufTestMessages.Proto3.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::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto3.ForeignMessage), global::ProtobufTestMessages.Proto3.ForeignMessage.Parser, new[]{ "C" }, null, null, null) + })); + } + #endregion + + } + #region Enums + public enum ForeignEnum { + [pbr::OriginalName("FOREIGN_FOO")] ForeignFoo = 0, + [pbr::OriginalName("FOREIGN_BAR")] ForeignBar = 1, + [pbr::OriginalName("FOREIGN_BAZ")] ForeignBaz = 2, + } + + #endregion + + #region Messages + /// + /// This proto includes every type of field in both singular and repeated + /// forms. + /// + /// Also, crucially, all messages and enums in this file are eventually + /// submessages of this message. So for example, a fuzz test of TestAllTypes + /// could trigger bugs that occur in any message type in this file. We verify + /// this stays true in a unit test. + /// + public sealed partial class TestAllTypes : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAllTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto3.TestMessagesProto3Reflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestAllTypes() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestAllTypes(TestAllTypes other) : this() { + optionalInt32_ = other.optionalInt32_; + optionalInt64_ = other.optionalInt64_; + optionalUint32_ = other.optionalUint32_; + optionalUint64_ = other.optionalUint64_; + optionalSint32_ = other.optionalSint32_; + optionalSint64_ = other.optionalSint64_; + optionalFixed32_ = other.optionalFixed32_; + optionalFixed64_ = other.optionalFixed64_; + optionalSfixed32_ = other.optionalSfixed32_; + optionalSfixed64_ = other.optionalSfixed64_; + optionalFloat_ = other.optionalFloat_; + optionalDouble_ = other.optionalDouble_; + optionalBool_ = other.optionalBool_; + optionalString_ = other.optionalString_; + optionalBytes_ = other.optionalBytes_; + OptionalNestedMessage = other.optionalNestedMessage_ != null ? other.OptionalNestedMessage.Clone() : null; + OptionalForeignMessage = other.optionalForeignMessage_ != null ? other.OptionalForeignMessage.Clone() : null; + optionalNestedEnum_ = other.optionalNestedEnum_; + optionalForeignEnum_ = other.optionalForeignEnum_; + optionalStringPiece_ = other.optionalStringPiece_; + optionalCord_ = other.optionalCord_; + RecursiveMessage = other.recursiveMessage_ != null ? other.RecursiveMessage.Clone() : null; + repeatedInt32_ = other.repeatedInt32_.Clone(); + repeatedInt64_ = other.repeatedInt64_.Clone(); + repeatedUint32_ = other.repeatedUint32_.Clone(); + repeatedUint64_ = other.repeatedUint64_.Clone(); + repeatedSint32_ = other.repeatedSint32_.Clone(); + repeatedSint64_ = other.repeatedSint64_.Clone(); + repeatedFixed32_ = other.repeatedFixed32_.Clone(); + repeatedFixed64_ = other.repeatedFixed64_.Clone(); + repeatedSfixed32_ = other.repeatedSfixed32_.Clone(); + repeatedSfixed64_ = other.repeatedSfixed64_.Clone(); + repeatedFloat_ = other.repeatedFloat_.Clone(); + repeatedDouble_ = other.repeatedDouble_.Clone(); + repeatedBool_ = other.repeatedBool_.Clone(); + repeatedString_ = other.repeatedString_.Clone(); + repeatedBytes_ = other.repeatedBytes_.Clone(); + repeatedNestedMessage_ = other.repeatedNestedMessage_.Clone(); + repeatedForeignMessage_ = other.repeatedForeignMessage_.Clone(); + repeatedNestedEnum_ = other.repeatedNestedEnum_.Clone(); + repeatedForeignEnum_ = other.repeatedForeignEnum_.Clone(); + repeatedStringPiece_ = other.repeatedStringPiece_.Clone(); + repeatedCord_ = other.repeatedCord_.Clone(); + mapInt32Int32_ = other.mapInt32Int32_.Clone(); + mapInt64Int64_ = other.mapInt64Int64_.Clone(); + mapUint32Uint32_ = other.mapUint32Uint32_.Clone(); + mapUint64Uint64_ = other.mapUint64Uint64_.Clone(); + mapSint32Sint32_ = other.mapSint32Sint32_.Clone(); + mapSint64Sint64_ = other.mapSint64Sint64_.Clone(); + mapFixed32Fixed32_ = other.mapFixed32Fixed32_.Clone(); + mapFixed64Fixed64_ = other.mapFixed64Fixed64_.Clone(); + mapSfixed32Sfixed32_ = other.mapSfixed32Sfixed32_.Clone(); + mapSfixed64Sfixed64_ = other.mapSfixed64Sfixed64_.Clone(); + mapInt32Float_ = other.mapInt32Float_.Clone(); + mapInt32Double_ = other.mapInt32Double_.Clone(); + mapBoolBool_ = other.mapBoolBool_.Clone(); + mapStringString_ = other.mapStringString_.Clone(); + mapStringBytes_ = other.mapStringBytes_.Clone(); + mapStringNestedMessage_ = other.mapStringNestedMessage_.Clone(); + mapStringForeignMessage_ = other.mapStringForeignMessage_.Clone(); + mapStringNestedEnum_ = other.mapStringNestedEnum_.Clone(); + mapStringForeignEnum_ = other.mapStringForeignEnum_.Clone(); + OptionalBoolWrapper = other.OptionalBoolWrapper; + OptionalInt32Wrapper = other.OptionalInt32Wrapper; + OptionalInt64Wrapper = other.OptionalInt64Wrapper; + OptionalUint32Wrapper = other.OptionalUint32Wrapper; + OptionalUint64Wrapper = other.OptionalUint64Wrapper; + OptionalFloatWrapper = other.OptionalFloatWrapper; + OptionalDoubleWrapper = other.OptionalDoubleWrapper; + OptionalStringWrapper = other.OptionalStringWrapper; + OptionalBytesWrapper = other.OptionalBytesWrapper; + repeatedBoolWrapper_ = other.repeatedBoolWrapper_.Clone(); + repeatedInt32Wrapper_ = other.repeatedInt32Wrapper_.Clone(); + repeatedInt64Wrapper_ = other.repeatedInt64Wrapper_.Clone(); + repeatedUint32Wrapper_ = other.repeatedUint32Wrapper_.Clone(); + repeatedUint64Wrapper_ = other.repeatedUint64Wrapper_.Clone(); + repeatedFloatWrapper_ = other.repeatedFloatWrapper_.Clone(); + repeatedDoubleWrapper_ = other.repeatedDoubleWrapper_.Clone(); + repeatedStringWrapper_ = other.repeatedStringWrapper_.Clone(); + repeatedBytesWrapper_ = other.repeatedBytesWrapper_.Clone(); + OptionalDuration = other.optionalDuration_ != null ? other.OptionalDuration.Clone() : null; + OptionalTimestamp = other.optionalTimestamp_ != null ? other.OptionalTimestamp.Clone() : null; + OptionalFieldMask = other.optionalFieldMask_ != null ? other.OptionalFieldMask.Clone() : null; + OptionalStruct = other.optionalStruct_ != null ? other.OptionalStruct.Clone() : null; + OptionalAny = other.optionalAny_ != null ? other.OptionalAny.Clone() : null; + OptionalValue = other.optionalValue_ != null ? other.OptionalValue.Clone() : null; + repeatedDuration_ = other.repeatedDuration_.Clone(); + repeatedTimestamp_ = other.repeatedTimestamp_.Clone(); + repeatedFieldmask_ = other.repeatedFieldmask_.Clone(); + repeatedStruct_ = other.repeatedStruct_.Clone(); + repeatedAny_ = other.repeatedAny_.Clone(); + repeatedValue_ = other.repeatedValue_.Clone(); + fieldname1_ = other.fieldname1_; + fieldName2_ = other.fieldName2_; + FieldName3_ = other.FieldName3_; + fieldName4_ = other.fieldName4_; + field0Name5_ = other.field0Name5_; + field0Name6_ = other.field0Name6_; + fieldName7_ = other.fieldName7_; + fieldName8_ = other.fieldName8_; + fieldName9_ = other.fieldName9_; + fieldName10_ = other.fieldName10_; + fIELDNAME11_ = other.fIELDNAME11_; + fIELDName12_ = other.fIELDName12_; + FieldName13_ = other.FieldName13_; + FieldName14_ = other.FieldName14_; + fieldName15_ = other.fieldName15_; + fieldName16_ = other.fieldName16_; + fieldName17_ = other.fieldName17_; + fieldName18_ = other.fieldName18_; + switch (other.OneofFieldCase) { + case OneofFieldOneofCase.OneofUint32: + OneofUint32 = other.OneofUint32; + break; + case OneofFieldOneofCase.OneofNestedMessage: + OneofNestedMessage = other.OneofNestedMessage.Clone(); + break; + case OneofFieldOneofCase.OneofString: + OneofString = other.OneofString; + break; + case OneofFieldOneofCase.OneofBytes: + OneofBytes = other.OneofBytes; + break; + case OneofFieldOneofCase.OneofBool: + OneofBool = other.OneofBool; + break; + case OneofFieldOneofCase.OneofUint64: + OneofUint64 = other.OneofUint64; + break; + case OneofFieldOneofCase.OneofFloat: + OneofFloat = other.OneofFloat; + break; + case OneofFieldOneofCase.OneofDouble: + OneofDouble = other.OneofDouble; + break; + case OneofFieldOneofCase.OneofEnum: + OneofEnum = other.OneofEnum; + break; + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestAllTypes Clone() { + return new TestAllTypes(this); + } + + /// Field number for the "optional_int32" field. + public const int OptionalInt32FieldNumber = 1; + private int optionalInt32_; + /// + /// Singular + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int OptionalInt32 { + get { return optionalInt32_; } + set { + optionalInt32_ = value; + } + } + + /// Field number for the "optional_int64" field. + public const int OptionalInt64FieldNumber = 2; + private long optionalInt64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long OptionalInt64 { + get { return optionalInt64_; } + set { + optionalInt64_ = value; + } + } + + /// Field number for the "optional_uint32" field. + public const int OptionalUint32FieldNumber = 3; + private uint optionalUint32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint OptionalUint32 { + get { return optionalUint32_; } + set { + optionalUint32_ = value; + } + } + + /// Field number for the "optional_uint64" field. + public const int OptionalUint64FieldNumber = 4; + private ulong optionalUint64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong OptionalUint64 { + get { return optionalUint64_; } + set { + optionalUint64_ = value; + } + } + + /// Field number for the "optional_sint32" field. + public const int OptionalSint32FieldNumber = 5; + private int optionalSint32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int OptionalSint32 { + get { return optionalSint32_; } + set { + optionalSint32_ = value; + } + } + + /// Field number for the "optional_sint64" field. + public const int OptionalSint64FieldNumber = 6; + private long optionalSint64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long OptionalSint64 { + get { return optionalSint64_; } + set { + optionalSint64_ = value; + } + } + + /// Field number for the "optional_fixed32" field. + public const int OptionalFixed32FieldNumber = 7; + private uint optionalFixed32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint OptionalFixed32 { + get { return optionalFixed32_; } + set { + optionalFixed32_ = value; + } + } + + /// Field number for the "optional_fixed64" field. + public const int OptionalFixed64FieldNumber = 8; + private ulong optionalFixed64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong OptionalFixed64 { + get { return optionalFixed64_; } + set { + optionalFixed64_ = value; + } + } + + /// Field number for the "optional_sfixed32" field. + public const int OptionalSfixed32FieldNumber = 9; + private int optionalSfixed32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int OptionalSfixed32 { + get { return optionalSfixed32_; } + set { + optionalSfixed32_ = value; + } + } + + /// Field number for the "optional_sfixed64" field. + public const int OptionalSfixed64FieldNumber = 10; + private long optionalSfixed64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long OptionalSfixed64 { + get { return optionalSfixed64_; } + set { + optionalSfixed64_ = value; + } + } + + /// Field number for the "optional_float" field. + public const int OptionalFloatFieldNumber = 11; + private float optionalFloat_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public float OptionalFloat { + get { return optionalFloat_; } + set { + optionalFloat_ = value; + } + } + + /// Field number for the "optional_double" field. + public const int OptionalDoubleFieldNumber = 12; + private double optionalDouble_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double OptionalDouble { + get { return optionalDouble_; } + set { + optionalDouble_ = value; + } + } + + /// Field number for the "optional_bool" field. + public const int OptionalBoolFieldNumber = 13; + private bool optionalBool_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool OptionalBool { + get { return optionalBool_; } + set { + optionalBool_ = value; + } + } + + /// Field number for the "optional_string" field. + public const int OptionalStringFieldNumber = 14; + private string optionalString_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OptionalString { + get { return optionalString_; } + set { + optionalString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "optional_bytes" field. + public const int OptionalBytesFieldNumber = 15; + private pb::ByteString optionalBytes_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString OptionalBytes { + get { return optionalBytes_; } + set { + optionalBytes_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "optional_nested_message" field. + public const int OptionalNestedMessageFieldNumber = 18; + private global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage optionalNestedMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_; } + set { + optionalNestedMessage_ = value; + } + } + + /// Field number for the "optional_foreign_message" field. + public const int OptionalForeignMessageFieldNumber = 19; + private global::ProtobufTestMessages.Proto3.ForeignMessage optionalForeignMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.ForeignMessage OptionalForeignMessage { + get { return optionalForeignMessage_; } + set { + optionalForeignMessage_ = value; + } + } + + /// Field number for the "optional_nested_enum" field. + public const int OptionalNestedEnumFieldNumber = 21; + private global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return optionalNestedEnum_; } + set { + optionalNestedEnum_ = value; + } + } + + /// Field number for the "optional_foreign_enum" field. + public const int OptionalForeignEnumFieldNumber = 22; + private global::ProtobufTestMessages.Proto3.ForeignEnum optionalForeignEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.ForeignEnum OptionalForeignEnum { + get { return optionalForeignEnum_; } + set { + optionalForeignEnum_ = value; + } + } + + /// Field number for the "optional_string_piece" field. + public const int OptionalStringPieceFieldNumber = 24; + private string optionalStringPiece_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OptionalStringPiece { + get { return optionalStringPiece_; } + set { + optionalStringPiece_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "optional_cord" field. + public const int OptionalCordFieldNumber = 25; + private string optionalCord_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OptionalCord { + get { return optionalCord_; } + set { + optionalCord_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "recursive_message" field. + public const int RecursiveMessageFieldNumber = 27; + private global::ProtobufTestMessages.Proto3.TestAllTypes recursiveMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.TestAllTypes RecursiveMessage { + get { return recursiveMessage_; } + set { + recursiveMessage_ = value; + } + } + + /// Field number for the "repeated_int32" field. + public const int RepeatedInt32FieldNumber = 31; + private static readonly pb::FieldCodec _repeated_repeatedInt32_codec + = pb::FieldCodec.ForInt32(250); + private readonly pbc::RepeatedField repeatedInt32_ = new pbc::RepeatedField(); + /// + /// Repeated + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedInt32 { + get { return repeatedInt32_; } + } + + /// Field number for the "repeated_int64" field. + public const int RepeatedInt64FieldNumber = 32; + private static readonly pb::FieldCodec _repeated_repeatedInt64_codec + = pb::FieldCodec.ForInt64(258); + private readonly pbc::RepeatedField repeatedInt64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedInt64 { + get { return repeatedInt64_; } + } + + /// Field number for the "repeated_uint32" field. + public const int RepeatedUint32FieldNumber = 33; + private static readonly pb::FieldCodec _repeated_repeatedUint32_codec + = pb::FieldCodec.ForUInt32(266); + private readonly pbc::RepeatedField repeatedUint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedUint32 { + get { return repeatedUint32_; } + } + + /// Field number for the "repeated_uint64" field. + public const int RepeatedUint64FieldNumber = 34; + private static readonly pb::FieldCodec _repeated_repeatedUint64_codec + = pb::FieldCodec.ForUInt64(274); + private readonly pbc::RepeatedField repeatedUint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedUint64 { + get { return repeatedUint64_; } + } + + /// Field number for the "repeated_sint32" field. + public const int RepeatedSint32FieldNumber = 35; + private static readonly pb::FieldCodec _repeated_repeatedSint32_codec + = pb::FieldCodec.ForSInt32(282); + private readonly pbc::RepeatedField repeatedSint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedSint32 { + get { return repeatedSint32_; } + } + + /// Field number for the "repeated_sint64" field. + public const int RepeatedSint64FieldNumber = 36; + private static readonly pb::FieldCodec _repeated_repeatedSint64_codec + = pb::FieldCodec.ForSInt64(290); + private readonly pbc::RepeatedField repeatedSint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedSint64 { + get { return repeatedSint64_; } + } + + /// Field number for the "repeated_fixed32" field. + public const int RepeatedFixed32FieldNumber = 37; + private static readonly pb::FieldCodec _repeated_repeatedFixed32_codec + = pb::FieldCodec.ForFixed32(298); + private readonly pbc::RepeatedField repeatedFixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedFixed32 { + get { return repeatedFixed32_; } + } + + /// Field number for the "repeated_fixed64" field. + public const int RepeatedFixed64FieldNumber = 38; + private static readonly pb::FieldCodec _repeated_repeatedFixed64_codec + = pb::FieldCodec.ForFixed64(306); + private readonly pbc::RepeatedField repeatedFixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedFixed64 { + get { return repeatedFixed64_; } + } + + /// Field number for the "repeated_sfixed32" field. + public const int RepeatedSfixed32FieldNumber = 39; + private static readonly pb::FieldCodec _repeated_repeatedSfixed32_codec + = pb::FieldCodec.ForSFixed32(314); + private readonly pbc::RepeatedField repeatedSfixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedSfixed32 { + get { return repeatedSfixed32_; } + } + + /// Field number for the "repeated_sfixed64" field. + public const int RepeatedSfixed64FieldNumber = 40; + private static readonly pb::FieldCodec _repeated_repeatedSfixed64_codec + = pb::FieldCodec.ForSFixed64(322); + private readonly pbc::RepeatedField repeatedSfixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedSfixed64 { + get { return repeatedSfixed64_; } + } + + /// Field number for the "repeated_float" field. + public const int RepeatedFloatFieldNumber = 41; + private static readonly pb::FieldCodec _repeated_repeatedFloat_codec + = pb::FieldCodec.ForFloat(330); + private readonly pbc::RepeatedField repeatedFloat_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedFloat { + get { return repeatedFloat_; } + } + + /// Field number for the "repeated_double" field. + public const int RepeatedDoubleFieldNumber = 42; + private static readonly pb::FieldCodec _repeated_repeatedDouble_codec + = pb::FieldCodec.ForDouble(338); + private readonly pbc::RepeatedField repeatedDouble_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedDouble { + get { return repeatedDouble_; } + } + + /// Field number for the "repeated_bool" field. + public const int RepeatedBoolFieldNumber = 43; + private static readonly pb::FieldCodec _repeated_repeatedBool_codec + = pb::FieldCodec.ForBool(346); + private readonly pbc::RepeatedField repeatedBool_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedBool { + get { return repeatedBool_; } + } + + /// Field number for the "repeated_string" field. + public const int RepeatedStringFieldNumber = 44; + private static readonly pb::FieldCodec _repeated_repeatedString_codec + = pb::FieldCodec.ForString(354); + private readonly pbc::RepeatedField repeatedString_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedString { + get { return repeatedString_; } + } + + /// Field number for the "repeated_bytes" field. + public const int RepeatedBytesFieldNumber = 45; + private static readonly pb::FieldCodec _repeated_repeatedBytes_codec + = pb::FieldCodec.ForBytes(362); + private readonly pbc::RepeatedField repeatedBytes_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedBytes { + get { return repeatedBytes_; } + } + + /// Field number for the "repeated_nested_message" field. + public const int RepeatedNestedMessageFieldNumber = 48; + private static readonly pb::FieldCodec _repeated_repeatedNestedMessage_codec + = pb::FieldCodec.ForMessage(386, global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage.Parser); + private readonly pbc::RepeatedField repeatedNestedMessage_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedNestedMessage { + get { return repeatedNestedMessage_; } + } + + /// Field number for the "repeated_foreign_message" field. + public const int RepeatedForeignMessageFieldNumber = 49; + private static readonly pb::FieldCodec _repeated_repeatedForeignMessage_codec + = pb::FieldCodec.ForMessage(394, global::ProtobufTestMessages.Proto3.ForeignMessage.Parser); + private readonly pbc::RepeatedField repeatedForeignMessage_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedForeignMessage { + get { return repeatedForeignMessage_; } + } + + /// Field number for the "repeated_nested_enum" field. + public const int RepeatedNestedEnumFieldNumber = 51; + private static readonly pb::FieldCodec _repeated_repeatedNestedEnum_codec + = pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum) x); + private readonly pbc::RepeatedField repeatedNestedEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedNestedEnum { + get { return repeatedNestedEnum_; } + } + + /// Field number for the "repeated_foreign_enum" field. + public const int RepeatedForeignEnumFieldNumber = 52; + private static readonly pb::FieldCodec _repeated_repeatedForeignEnum_codec + = pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::ProtobufTestMessages.Proto3.ForeignEnum) x); + private readonly pbc::RepeatedField repeatedForeignEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedForeignEnum { + get { return repeatedForeignEnum_; } + } + + /// Field number for the "repeated_string_piece" field. + public const int RepeatedStringPieceFieldNumber = 54; + private static readonly pb::FieldCodec _repeated_repeatedStringPiece_codec + = pb::FieldCodec.ForString(434); + private readonly pbc::RepeatedField repeatedStringPiece_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedStringPiece { + get { return repeatedStringPiece_; } + } + + /// Field number for the "repeated_cord" field. + public const int RepeatedCordFieldNumber = 55; + private static readonly pb::FieldCodec _repeated_repeatedCord_codec + = pb::FieldCodec.ForString(442); + private readonly pbc::RepeatedField repeatedCord_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedCord { + get { return repeatedCord_; } + } + + /// Field number for the "map_int32_int32" field. + public const int MapInt32Int32FieldNumber = 56; + private static readonly pbc::MapField.Codec _map_mapInt32Int32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForInt32(16), 450); + private readonly pbc::MapField mapInt32Int32_ = new pbc::MapField(); + /// + /// Map + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapInt32Int32 { + get { return mapInt32Int32_; } + } + + /// Field number for the "map_int64_int64" field. + public const int MapInt64Int64FieldNumber = 57; + private static readonly pbc::MapField.Codec _map_mapInt64Int64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt64(8), pb::FieldCodec.ForInt64(16), 458); + private readonly pbc::MapField mapInt64Int64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapInt64Int64 { + get { return mapInt64Int64_; } + } + + /// Field number for the "map_uint32_uint32" field. + public const int MapUint32Uint32FieldNumber = 58; + private static readonly pbc::MapField.Codec _map_mapUint32Uint32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt32(8), pb::FieldCodec.ForUInt32(16), 466); + private readonly pbc::MapField mapUint32Uint32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapUint32Uint32 { + get { return mapUint32Uint32_; } + } + + /// Field number for the "map_uint64_uint64" field. + public const int MapUint64Uint64FieldNumber = 59; + private static readonly pbc::MapField.Codec _map_mapUint64Uint64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForUInt64(8), pb::FieldCodec.ForUInt64(16), 474); + private readonly pbc::MapField mapUint64Uint64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapUint64Uint64 { + get { return mapUint64Uint64_; } + } + + /// Field number for the "map_sint32_sint32" field. + public const int MapSint32Sint32FieldNumber = 60; + private static readonly pbc::MapField.Codec _map_mapSint32Sint32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt32(8), pb::FieldCodec.ForSInt32(16), 482); + private readonly pbc::MapField mapSint32Sint32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapSint32Sint32 { + get { return mapSint32Sint32_; } + } + + /// Field number for the "map_sint64_sint64" field. + public const int MapSint64Sint64FieldNumber = 61; + private static readonly pbc::MapField.Codec _map_mapSint64Sint64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSInt64(8), pb::FieldCodec.ForSInt64(16), 490); + private readonly pbc::MapField mapSint64Sint64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapSint64Sint64 { + get { return mapSint64Sint64_; } + } + + /// Field number for the "map_fixed32_fixed32" field. + public const int MapFixed32Fixed32FieldNumber = 62; + private static readonly pbc::MapField.Codec _map_mapFixed32Fixed32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed32(13), pb::FieldCodec.ForFixed32(21), 498); + private readonly pbc::MapField mapFixed32Fixed32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapFixed32Fixed32 { + get { return mapFixed32Fixed32_; } + } + + /// Field number for the "map_fixed64_fixed64" field. + public const int MapFixed64Fixed64FieldNumber = 63; + private static readonly pbc::MapField.Codec _map_mapFixed64Fixed64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForFixed64(9), pb::FieldCodec.ForFixed64(17), 506); + private readonly pbc::MapField mapFixed64Fixed64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapFixed64Fixed64 { + get { return mapFixed64Fixed64_; } + } + + /// Field number for the "map_sfixed32_sfixed32" field. + public const int MapSfixed32Sfixed32FieldNumber = 64; + private static readonly pbc::MapField.Codec _map_mapSfixed32Sfixed32_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed32(13), pb::FieldCodec.ForSFixed32(21), 514); + private readonly pbc::MapField mapSfixed32Sfixed32_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapSfixed32Sfixed32 { + get { return mapSfixed32Sfixed32_; } + } + + /// Field number for the "map_sfixed64_sfixed64" field. + public const int MapSfixed64Sfixed64FieldNumber = 65; + private static readonly pbc::MapField.Codec _map_mapSfixed64Sfixed64_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForSFixed64(9), pb::FieldCodec.ForSFixed64(17), 522); + private readonly pbc::MapField mapSfixed64Sfixed64_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapSfixed64Sfixed64 { + get { return mapSfixed64Sfixed64_; } + } + + /// Field number for the "map_int32_float" field. + public const int MapInt32FloatFieldNumber = 66; + private static readonly pbc::MapField.Codec _map_mapInt32Float_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForFloat(21), 530); + private readonly pbc::MapField mapInt32Float_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapInt32Float { + get { return mapInt32Float_; } + } + + /// Field number for the "map_int32_double" field. + public const int MapInt32DoubleFieldNumber = 67; + private static readonly pbc::MapField.Codec _map_mapInt32Double_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForDouble(17), 538); + private readonly pbc::MapField mapInt32Double_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapInt32Double { + get { return mapInt32Double_; } + } + + /// Field number for the "map_bool_bool" field. + public const int MapBoolBoolFieldNumber = 68; + private static readonly pbc::MapField.Codec _map_mapBoolBool_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForBool(8), pb::FieldCodec.ForBool(16), 546); + private readonly pbc::MapField mapBoolBool_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapBoolBool { + get { return mapBoolBool_; } + } + + /// Field number for the "map_string_string" field. + public const int MapStringStringFieldNumber = 69; + private static readonly pbc::MapField.Codec _map_mapStringString_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForString(18), 554); + private readonly pbc::MapField mapStringString_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapStringString { + get { return mapStringString_; } + } + + /// Field number for the "map_string_bytes" field. + public const int MapStringBytesFieldNumber = 70; + private static readonly pbc::MapField.Codec _map_mapStringBytes_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForBytes(18), 562); + private readonly pbc::MapField mapStringBytes_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapStringBytes { + get { return mapStringBytes_; } + } + + /// Field number for the "map_string_nested_message" field. + public const int MapStringNestedMessageFieldNumber = 71; + private static readonly pbc::MapField.Codec _map_mapStringNestedMessage_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage.Parser), 570); + private readonly pbc::MapField mapStringNestedMessage_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapStringNestedMessage { + get { return mapStringNestedMessage_; } + } + + /// Field number for the "map_string_foreign_message" field. + public const int MapStringForeignMessageFieldNumber = 72; + private static readonly pbc::MapField.Codec _map_mapStringForeignMessage_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::ProtobufTestMessages.Proto3.ForeignMessage.Parser), 578); + private readonly pbc::MapField mapStringForeignMessage_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapStringForeignMessage { + get { return mapStringForeignMessage_; } + } + + /// Field number for the "map_string_nested_enum" field. + public const int MapStringNestedEnumFieldNumber = 73; + private static readonly pbc::MapField.Codec _map_mapStringNestedEnum_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum) x), 586); + private readonly pbc::MapField mapStringNestedEnum_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapStringNestedEnum { + get { return mapStringNestedEnum_; } + } + + /// Field number for the "map_string_foreign_enum" field. + public const int MapStringForeignEnumFieldNumber = 74; + private static readonly pbc::MapField.Codec _map_mapStringForeignEnum_codec + = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::ProtobufTestMessages.Proto3.ForeignEnum) x), 594); + private readonly pbc::MapField mapStringForeignEnum_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::MapField MapStringForeignEnum { + get { return mapStringForeignEnum_; } + } + + /// Field number for the "oneof_uint32" field. + public const int OneofUint32FieldNumber = 111; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint OneofUint32 { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofUint32; + } + } + + /// Field number for the "oneof_nested_message" field. + public const int OneofNestedMessageFieldNumber = 112; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage OneofNestedMessage { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage) oneofField_ : null; } + set { + oneofField_ = value; + oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofNestedMessage; + } + } + + /// Field number for the "oneof_string" field. + public const int OneofStringFieldNumber = 113; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OneofString { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } + set { + oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + oneofFieldCase_ = OneofFieldOneofCase.OneofString; + } + } + + /// Field number for the "oneof_bytes" field. + public const int OneofBytesFieldNumber = 114; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString OneofBytes { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } + set { + oneofField_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; + } + } + + /// Field number for the "oneof_bool" field. + public const int OneofBoolFieldNumber = 115; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool OneofBool { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBool ? (bool) oneofField_ : false; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofBool; + } + } + + /// Field number for the "oneof_uint64" field. + public const int OneofUint64FieldNumber = 116; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong OneofUint64 { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint64 ? (ulong) oneofField_ : 0UL; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofUint64; + } + } + + /// Field number for the "oneof_float" field. + public const int OneofFloatFieldNumber = 117; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public float OneofFloat { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofFloat ? (float) oneofField_ : 0F; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofFloat; + } + } + + /// Field number for the "oneof_double" field. + public const int OneofDoubleFieldNumber = 118; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double OneofDouble { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofDouble ? (double) oneofField_ : 0D; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofDouble; + } + } + + /// Field number for the "oneof_enum" field. + public const int OneofEnumFieldNumber = 119; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum OneofEnum { + get { return oneofFieldCase_ == OneofFieldOneofCase.OneofEnum ? (global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum) oneofField_ : 0; } + set { + oneofField_ = value; + oneofFieldCase_ = OneofFieldOneofCase.OneofEnum; + } + } + + /// Field number for the "optional_bool_wrapper" field. + public const int OptionalBoolWrapperFieldNumber = 201; + private static readonly pb::FieldCodec _single_optionalBoolWrapper_codec = pb::FieldCodec.ForStructWrapper(1610); + private bool? optionalBoolWrapper_; + /// + /// Well-known types + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool? OptionalBoolWrapper { + get { return optionalBoolWrapper_; } + set { + optionalBoolWrapper_ = value; + } + } + + /// Field number for the "optional_int32_wrapper" field. + public const int OptionalInt32WrapperFieldNumber = 202; + private static readonly pb::FieldCodec _single_optionalInt32Wrapper_codec = pb::FieldCodec.ForStructWrapper(1618); + private int? optionalInt32Wrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int? OptionalInt32Wrapper { + get { return optionalInt32Wrapper_; } + set { + optionalInt32Wrapper_ = value; + } + } + + /// Field number for the "optional_int64_wrapper" field. + public const int OptionalInt64WrapperFieldNumber = 203; + private static readonly pb::FieldCodec _single_optionalInt64Wrapper_codec = pb::FieldCodec.ForStructWrapper(1626); + private long? optionalInt64Wrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public long? OptionalInt64Wrapper { + get { return optionalInt64Wrapper_; } + set { + optionalInt64Wrapper_ = value; + } + } + + /// Field number for the "optional_uint32_wrapper" field. + public const int OptionalUint32WrapperFieldNumber = 204; + private static readonly pb::FieldCodec _single_optionalUint32Wrapper_codec = pb::FieldCodec.ForStructWrapper(1634); + private uint? optionalUint32Wrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public uint? OptionalUint32Wrapper { + get { return optionalUint32Wrapper_; } + set { + optionalUint32Wrapper_ = value; + } + } + + /// Field number for the "optional_uint64_wrapper" field. + public const int OptionalUint64WrapperFieldNumber = 205; + private static readonly pb::FieldCodec _single_optionalUint64Wrapper_codec = pb::FieldCodec.ForStructWrapper(1642); + private ulong? optionalUint64Wrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ulong? OptionalUint64Wrapper { + get { return optionalUint64Wrapper_; } + set { + optionalUint64Wrapper_ = value; + } + } + + /// Field number for the "optional_float_wrapper" field. + public const int OptionalFloatWrapperFieldNumber = 206; + private static readonly pb::FieldCodec _single_optionalFloatWrapper_codec = pb::FieldCodec.ForStructWrapper(1650); + private float? optionalFloatWrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public float? OptionalFloatWrapper { + get { return optionalFloatWrapper_; } + set { + optionalFloatWrapper_ = value; + } + } + + /// Field number for the "optional_double_wrapper" field. + public const int OptionalDoubleWrapperFieldNumber = 207; + private static readonly pb::FieldCodec _single_optionalDoubleWrapper_codec = pb::FieldCodec.ForStructWrapper(1658); + private double? optionalDoubleWrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double? OptionalDoubleWrapper { + get { return optionalDoubleWrapper_; } + set { + optionalDoubleWrapper_ = value; + } + } + + /// Field number for the "optional_string_wrapper" field. + public const int OptionalStringWrapperFieldNumber = 208; + private static readonly pb::FieldCodec _single_optionalStringWrapper_codec = pb::FieldCodec.ForClassWrapper(1666); + private string optionalStringWrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string OptionalStringWrapper { + get { return optionalStringWrapper_; } + set { + optionalStringWrapper_ = value; + } + } + + /// Field number for the "optional_bytes_wrapper" field. + public const int OptionalBytesWrapperFieldNumber = 209; + private static readonly pb::FieldCodec _single_optionalBytesWrapper_codec = pb::FieldCodec.ForClassWrapper(1674); + private pb::ByteString optionalBytesWrapper_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString OptionalBytesWrapper { + get { return optionalBytesWrapper_; } + set { + optionalBytesWrapper_ = value; + } + } + + /// Field number for the "repeated_bool_wrapper" field. + public const int RepeatedBoolWrapperFieldNumber = 211; + private static readonly pb::FieldCodec _repeated_repeatedBoolWrapper_codec + = pb::FieldCodec.ForStructWrapper(1690); + private readonly pbc::RepeatedField repeatedBoolWrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedBoolWrapper { + get { return repeatedBoolWrapper_; } + } + + /// Field number for the "repeated_int32_wrapper" field. + public const int RepeatedInt32WrapperFieldNumber = 212; + private static readonly pb::FieldCodec _repeated_repeatedInt32Wrapper_codec + = pb::FieldCodec.ForStructWrapper(1698); + private readonly pbc::RepeatedField repeatedInt32Wrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedInt32Wrapper { + get { return repeatedInt32Wrapper_; } + } + + /// Field number for the "repeated_int64_wrapper" field. + public const int RepeatedInt64WrapperFieldNumber = 213; + private static readonly pb::FieldCodec _repeated_repeatedInt64Wrapper_codec + = pb::FieldCodec.ForStructWrapper(1706); + private readonly pbc::RepeatedField repeatedInt64Wrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedInt64Wrapper { + get { return repeatedInt64Wrapper_; } + } + + /// Field number for the "repeated_uint32_wrapper" field. + public const int RepeatedUint32WrapperFieldNumber = 214; + private static readonly pb::FieldCodec _repeated_repeatedUint32Wrapper_codec + = pb::FieldCodec.ForStructWrapper(1714); + private readonly pbc::RepeatedField repeatedUint32Wrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedUint32Wrapper { + get { return repeatedUint32Wrapper_; } + } + + /// Field number for the "repeated_uint64_wrapper" field. + public const int RepeatedUint64WrapperFieldNumber = 215; + private static readonly pb::FieldCodec _repeated_repeatedUint64Wrapper_codec + = pb::FieldCodec.ForStructWrapper(1722); + private readonly pbc::RepeatedField repeatedUint64Wrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedUint64Wrapper { + get { return repeatedUint64Wrapper_; } + } + + /// Field number for the "repeated_float_wrapper" field. + public const int RepeatedFloatWrapperFieldNumber = 216; + private static readonly pb::FieldCodec _repeated_repeatedFloatWrapper_codec + = pb::FieldCodec.ForStructWrapper(1730); + private readonly pbc::RepeatedField repeatedFloatWrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedFloatWrapper { + get { return repeatedFloatWrapper_; } + } + + /// Field number for the "repeated_double_wrapper" field. + public const int RepeatedDoubleWrapperFieldNumber = 217; + private static readonly pb::FieldCodec _repeated_repeatedDoubleWrapper_codec + = pb::FieldCodec.ForStructWrapper(1738); + private readonly pbc::RepeatedField repeatedDoubleWrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedDoubleWrapper { + get { return repeatedDoubleWrapper_; } + } + + /// Field number for the "repeated_string_wrapper" field. + public const int RepeatedStringWrapperFieldNumber = 218; + private static readonly pb::FieldCodec _repeated_repeatedStringWrapper_codec + = pb::FieldCodec.ForClassWrapper(1746); + private readonly pbc::RepeatedField repeatedStringWrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedStringWrapper { + get { return repeatedStringWrapper_; } + } + + /// Field number for the "repeated_bytes_wrapper" field. + public const int RepeatedBytesWrapperFieldNumber = 219; + private static readonly pb::FieldCodec _repeated_repeatedBytesWrapper_codec + = pb::FieldCodec.ForClassWrapper(1754); + private readonly pbc::RepeatedField repeatedBytesWrapper_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedBytesWrapper { + get { return repeatedBytesWrapper_; } + } + + /// Field number for the "optional_duration" field. + public const int OptionalDurationFieldNumber = 301; + private global::Google.Protobuf.WellKnownTypes.Duration optionalDuration_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Duration OptionalDuration { + get { return optionalDuration_; } + set { + optionalDuration_ = value; + } + } + + /// Field number for the "optional_timestamp" field. + public const int OptionalTimestampFieldNumber = 302; + private global::Google.Protobuf.WellKnownTypes.Timestamp optionalTimestamp_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Timestamp OptionalTimestamp { + get { return optionalTimestamp_; } + set { + optionalTimestamp_ = value; + } + } + + /// Field number for the "optional_field_mask" field. + public const int OptionalFieldMaskFieldNumber = 303; + private global::Google.Protobuf.WellKnownTypes.FieldMask optionalFieldMask_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.FieldMask OptionalFieldMask { + get { return optionalFieldMask_; } + set { + optionalFieldMask_ = value; + } + } + + /// Field number for the "optional_struct" field. + public const int OptionalStructFieldNumber = 304; + private global::Google.Protobuf.WellKnownTypes.Struct optionalStruct_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Struct OptionalStruct { + get { return optionalStruct_; } + set { + optionalStruct_ = value; + } + } + + /// Field number for the "optional_any" field. + public const int OptionalAnyFieldNumber = 305; + private global::Google.Protobuf.WellKnownTypes.Any optionalAny_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Any OptionalAny { + get { return optionalAny_; } + set { + optionalAny_ = value; + } + } + + /// Field number for the "optional_value" field. + public const int OptionalValueFieldNumber = 306; + private global::Google.Protobuf.WellKnownTypes.Value optionalValue_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.WellKnownTypes.Value OptionalValue { + get { return optionalValue_; } + set { + optionalValue_ = value; + } + } + + /// Field number for the "repeated_duration" field. + public const int RepeatedDurationFieldNumber = 311; + private static readonly pb::FieldCodec _repeated_repeatedDuration_codec + = pb::FieldCodec.ForMessage(2490, global::Google.Protobuf.WellKnownTypes.Duration.Parser); + private readonly pbc::RepeatedField repeatedDuration_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedDuration { + get { return repeatedDuration_; } + } + + /// Field number for the "repeated_timestamp" field. + public const int RepeatedTimestampFieldNumber = 312; + private static readonly pb::FieldCodec _repeated_repeatedTimestamp_codec + = pb::FieldCodec.ForMessage(2498, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser); + private readonly pbc::RepeatedField repeatedTimestamp_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedTimestamp { + get { return repeatedTimestamp_; } + } + + /// Field number for the "repeated_fieldmask" field. + public const int RepeatedFieldmaskFieldNumber = 313; + private static readonly pb::FieldCodec _repeated_repeatedFieldmask_codec + = pb::FieldCodec.ForMessage(2506, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser); + private readonly pbc::RepeatedField repeatedFieldmask_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedFieldmask { + get { return repeatedFieldmask_; } + } + + /// Field number for the "repeated_struct" field. + public const int RepeatedStructFieldNumber = 324; + private static readonly pb::FieldCodec _repeated_repeatedStruct_codec + = pb::FieldCodec.ForMessage(2594, global::Google.Protobuf.WellKnownTypes.Struct.Parser); + private readonly pbc::RepeatedField repeatedStruct_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedStruct { + get { return repeatedStruct_; } + } + + /// Field number for the "repeated_any" field. + public const int RepeatedAnyFieldNumber = 315; + private static readonly pb::FieldCodec _repeated_repeatedAny_codec + = pb::FieldCodec.ForMessage(2522, global::Google.Protobuf.WellKnownTypes.Any.Parser); + private readonly pbc::RepeatedField repeatedAny_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedAny { + get { return repeatedAny_; } + } + + /// Field number for the "repeated_value" field. + public const int RepeatedValueFieldNumber = 316; + private static readonly pb::FieldCodec _repeated_repeatedValue_codec + = pb::FieldCodec.ForMessage(2530, global::Google.Protobuf.WellKnownTypes.Value.Parser); + private readonly pbc::RepeatedField repeatedValue_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField RepeatedValue { + get { return repeatedValue_; } + } + + /// Field number for the "fieldname1" field. + public const int Fieldname1FieldNumber = 401; + private int fieldname1_; + /// + /// Test field-name-to-JSON-name convention. + /// (protobuf says names can be any valid C/C++ identifier.) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Fieldname1 { + get { return fieldname1_; } + set { + fieldname1_ = value; + } + } + + /// Field number for the "field_name2" field. + public const int FieldName2FieldNumber = 402; + private int fieldName2_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName2 { + get { return fieldName2_; } + set { + fieldName2_ = value; + } + } + + /// Field number for the "_field_name3" field. + public const int FieldName3FieldNumber = 403; + private int FieldName3_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName3 { + get { return FieldName3_; } + set { + FieldName3_ = value; + } + } + + /// Field number for the "field__name4_" field. + public const int FieldName4FieldNumber = 404; + private int fieldName4_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName4 { + get { return fieldName4_; } + set { + fieldName4_ = value; + } + } + + /// Field number for the "field0name5" field. + public const int Field0Name5FieldNumber = 405; + private int field0Name5_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Field0Name5 { + get { return field0Name5_; } + set { + field0Name5_ = value; + } + } + + /// Field number for the "field_0_name6" field. + public const int Field0Name6FieldNumber = 406; + private int field0Name6_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Field0Name6 { + get { return field0Name6_; } + set { + field0Name6_ = value; + } + } + + /// Field number for the "fieldName7" field. + public const int FieldName7FieldNumber = 407; + private int fieldName7_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName7 { + get { return fieldName7_; } + set { + fieldName7_ = value; + } + } + + /// Field number for the "FieldName8" field. + public const int FieldName8FieldNumber = 408; + private int fieldName8_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName8 { + get { return fieldName8_; } + set { + fieldName8_ = value; + } + } + + /// Field number for the "field_Name9" field. + public const int FieldName9FieldNumber = 409; + private int fieldName9_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName9 { + get { return fieldName9_; } + set { + fieldName9_ = value; + } + } + + /// Field number for the "Field_Name10" field. + public const int FieldName10FieldNumber = 410; + private int fieldName10_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName10 { + get { return fieldName10_; } + set { + fieldName10_ = value; + } + } + + /// Field number for the "FIELD_NAME11" field. + public const int FIELDNAME11FieldNumber = 411; + private int fIELDNAME11_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FIELDNAME11 { + get { return fIELDNAME11_; } + set { + fIELDNAME11_ = value; + } + } + + /// Field number for the "FIELD_name12" field. + public const int FIELDName12FieldNumber = 412; + private int fIELDName12_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FIELDName12 { + get { return fIELDName12_; } + set { + fIELDName12_ = value; + } + } + + /// Field number for the "__field_name13" field. + public const int FieldName13FieldNumber = 413; + private int FieldName13_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName13 { + get { return FieldName13_; } + set { + FieldName13_ = value; + } + } + + /// Field number for the "__Field_name14" field. + public const int FieldName14FieldNumber = 414; + private int FieldName14_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName14 { + get { return FieldName14_; } + set { + FieldName14_ = value; + } + } + + /// Field number for the "field__name15" field. + public const int FieldName15FieldNumber = 415; + private int fieldName15_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName15 { + get { return fieldName15_; } + set { + fieldName15_ = value; + } + } + + /// Field number for the "field__Name16" field. + public const int FieldName16FieldNumber = 416; + private int fieldName16_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName16 { + get { return fieldName16_; } + set { + fieldName16_ = value; + } + } + + /// Field number for the "field_name17__" field. + public const int FieldName17FieldNumber = 417; + private int fieldName17_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName17 { + get { return fieldName17_; } + set { + fieldName17_ = value; + } + } + + /// Field number for the "Field_name18__" field. + public const int FieldName18FieldNumber = 418; + private int fieldName18_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int FieldName18 { + get { return fieldName18_; } + set { + fieldName18_ = value; + } + } + + private object oneofField_; + /// Enum of possible cases for the "oneof_field" oneof. + public enum OneofFieldOneofCase { + None = 0, + OneofUint32 = 111, + OneofNestedMessage = 112, + OneofString = 113, + OneofBytes = 114, + OneofBool = 115, + OneofUint64 = 116, + OneofFloat = 117, + OneofDouble = 118, + OneofEnum = 119, + } + private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OneofFieldOneofCase OneofFieldCase { + get { return oneofFieldCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearOneofField() { + oneofFieldCase_ = OneofFieldOneofCase.None; + oneofField_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestAllTypes); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestAllTypes other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (OptionalInt32 != other.OptionalInt32) return false; + if (OptionalInt64 != other.OptionalInt64) return false; + if (OptionalUint32 != other.OptionalUint32) return false; + if (OptionalUint64 != other.OptionalUint64) return false; + if (OptionalSint32 != other.OptionalSint32) return false; + if (OptionalSint64 != other.OptionalSint64) return false; + if (OptionalFixed32 != other.OptionalFixed32) return false; + if (OptionalFixed64 != other.OptionalFixed64) return false; + if (OptionalSfixed32 != other.OptionalSfixed32) return false; + if (OptionalSfixed64 != other.OptionalSfixed64) return false; + if (OptionalFloat != other.OptionalFloat) return false; + if (OptionalDouble != other.OptionalDouble) return false; + if (OptionalBool != other.OptionalBool) return false; + if (OptionalString != other.OptionalString) return false; + if (OptionalBytes != other.OptionalBytes) return false; + if (!object.Equals(OptionalNestedMessage, other.OptionalNestedMessage)) return false; + if (!object.Equals(OptionalForeignMessage, other.OptionalForeignMessage)) return false; + if (OptionalNestedEnum != other.OptionalNestedEnum) return false; + if (OptionalForeignEnum != other.OptionalForeignEnum) return false; + if (OptionalStringPiece != other.OptionalStringPiece) return false; + if (OptionalCord != other.OptionalCord) return false; + if (!object.Equals(RecursiveMessage, other.RecursiveMessage)) return false; + if(!repeatedInt32_.Equals(other.repeatedInt32_)) return false; + if(!repeatedInt64_.Equals(other.repeatedInt64_)) return false; + if(!repeatedUint32_.Equals(other.repeatedUint32_)) return false; + if(!repeatedUint64_.Equals(other.repeatedUint64_)) return false; + if(!repeatedSint32_.Equals(other.repeatedSint32_)) return false; + if(!repeatedSint64_.Equals(other.repeatedSint64_)) return false; + if(!repeatedFixed32_.Equals(other.repeatedFixed32_)) return false; + if(!repeatedFixed64_.Equals(other.repeatedFixed64_)) return false; + if(!repeatedSfixed32_.Equals(other.repeatedSfixed32_)) return false; + if(!repeatedSfixed64_.Equals(other.repeatedSfixed64_)) return false; + if(!repeatedFloat_.Equals(other.repeatedFloat_)) return false; + if(!repeatedDouble_.Equals(other.repeatedDouble_)) return false; + if(!repeatedBool_.Equals(other.repeatedBool_)) return false; + if(!repeatedString_.Equals(other.repeatedString_)) return false; + if(!repeatedBytes_.Equals(other.repeatedBytes_)) return false; + if(!repeatedNestedMessage_.Equals(other.repeatedNestedMessage_)) return false; + if(!repeatedForeignMessage_.Equals(other.repeatedForeignMessage_)) return false; + if(!repeatedNestedEnum_.Equals(other.repeatedNestedEnum_)) return false; + if(!repeatedForeignEnum_.Equals(other.repeatedForeignEnum_)) return false; + if(!repeatedStringPiece_.Equals(other.repeatedStringPiece_)) return false; + if(!repeatedCord_.Equals(other.repeatedCord_)) return false; + if (!MapInt32Int32.Equals(other.MapInt32Int32)) return false; + if (!MapInt64Int64.Equals(other.MapInt64Int64)) return false; + if (!MapUint32Uint32.Equals(other.MapUint32Uint32)) return false; + if (!MapUint64Uint64.Equals(other.MapUint64Uint64)) return false; + if (!MapSint32Sint32.Equals(other.MapSint32Sint32)) return false; + if (!MapSint64Sint64.Equals(other.MapSint64Sint64)) return false; + if (!MapFixed32Fixed32.Equals(other.MapFixed32Fixed32)) return false; + if (!MapFixed64Fixed64.Equals(other.MapFixed64Fixed64)) return false; + if (!MapSfixed32Sfixed32.Equals(other.MapSfixed32Sfixed32)) return false; + if (!MapSfixed64Sfixed64.Equals(other.MapSfixed64Sfixed64)) return false; + if (!MapInt32Float.Equals(other.MapInt32Float)) return false; + if (!MapInt32Double.Equals(other.MapInt32Double)) return false; + if (!MapBoolBool.Equals(other.MapBoolBool)) return false; + if (!MapStringString.Equals(other.MapStringString)) return false; + if (!MapStringBytes.Equals(other.MapStringBytes)) return false; + if (!MapStringNestedMessage.Equals(other.MapStringNestedMessage)) return false; + if (!MapStringForeignMessage.Equals(other.MapStringForeignMessage)) return false; + if (!MapStringNestedEnum.Equals(other.MapStringNestedEnum)) return false; + if (!MapStringForeignEnum.Equals(other.MapStringForeignEnum)) return false; + if (OneofUint32 != other.OneofUint32) return false; + if (!object.Equals(OneofNestedMessage, other.OneofNestedMessage)) return false; + if (OneofString != other.OneofString) return false; + if (OneofBytes != other.OneofBytes) return false; + if (OneofBool != other.OneofBool) return false; + if (OneofUint64 != other.OneofUint64) return false; + if (OneofFloat != other.OneofFloat) return false; + if (OneofDouble != other.OneofDouble) return false; + if (OneofEnum != other.OneofEnum) return false; + if (OptionalBoolWrapper != other.OptionalBoolWrapper) return false; + if (OptionalInt32Wrapper != other.OptionalInt32Wrapper) return false; + if (OptionalInt64Wrapper != other.OptionalInt64Wrapper) return false; + if (OptionalUint32Wrapper != other.OptionalUint32Wrapper) return false; + if (OptionalUint64Wrapper != other.OptionalUint64Wrapper) return false; + if (OptionalFloatWrapper != other.OptionalFloatWrapper) return false; + if (OptionalDoubleWrapper != other.OptionalDoubleWrapper) return false; + if (OptionalStringWrapper != other.OptionalStringWrapper) return false; + if (OptionalBytesWrapper != other.OptionalBytesWrapper) return false; + if(!repeatedBoolWrapper_.Equals(other.repeatedBoolWrapper_)) return false; + if(!repeatedInt32Wrapper_.Equals(other.repeatedInt32Wrapper_)) return false; + if(!repeatedInt64Wrapper_.Equals(other.repeatedInt64Wrapper_)) return false; + if(!repeatedUint32Wrapper_.Equals(other.repeatedUint32Wrapper_)) return false; + if(!repeatedUint64Wrapper_.Equals(other.repeatedUint64Wrapper_)) return false; + if(!repeatedFloatWrapper_.Equals(other.repeatedFloatWrapper_)) return false; + if(!repeatedDoubleWrapper_.Equals(other.repeatedDoubleWrapper_)) return false; + if(!repeatedStringWrapper_.Equals(other.repeatedStringWrapper_)) return false; + if(!repeatedBytesWrapper_.Equals(other.repeatedBytesWrapper_)) return false; + if (!object.Equals(OptionalDuration, other.OptionalDuration)) return false; + if (!object.Equals(OptionalTimestamp, other.OptionalTimestamp)) return false; + if (!object.Equals(OptionalFieldMask, other.OptionalFieldMask)) return false; + if (!object.Equals(OptionalStruct, other.OptionalStruct)) return false; + if (!object.Equals(OptionalAny, other.OptionalAny)) return false; + if (!object.Equals(OptionalValue, other.OptionalValue)) return false; + if(!repeatedDuration_.Equals(other.repeatedDuration_)) return false; + if(!repeatedTimestamp_.Equals(other.repeatedTimestamp_)) return false; + if(!repeatedFieldmask_.Equals(other.repeatedFieldmask_)) return false; + if(!repeatedStruct_.Equals(other.repeatedStruct_)) return false; + if(!repeatedAny_.Equals(other.repeatedAny_)) return false; + if(!repeatedValue_.Equals(other.repeatedValue_)) return false; + if (Fieldname1 != other.Fieldname1) return false; + if (FieldName2 != other.FieldName2) return false; + if (FieldName3 != other.FieldName3) return false; + if (FieldName4 != other.FieldName4) return false; + if (Field0Name5 != other.Field0Name5) return false; + if (Field0Name6 != other.Field0Name6) return false; + if (FieldName7 != other.FieldName7) return false; + if (FieldName8 != other.FieldName8) return false; + if (FieldName9 != other.FieldName9) return false; + if (FieldName10 != other.FieldName10) return false; + if (FIELDNAME11 != other.FIELDNAME11) return false; + if (FIELDName12 != other.FIELDName12) return false; + if (FieldName13 != other.FieldName13) return false; + if (FieldName14 != other.FieldName14) return false; + if (FieldName15 != other.FieldName15) return false; + if (FieldName16 != other.FieldName16) return false; + if (FieldName17 != other.FieldName17) return false; + if (FieldName18 != other.FieldName18) return false; + if (OneofFieldCase != other.OneofFieldCase) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (OptionalInt32 != 0) hash ^= OptionalInt32.GetHashCode(); + if (OptionalInt64 != 0L) hash ^= OptionalInt64.GetHashCode(); + if (OptionalUint32 != 0) hash ^= OptionalUint32.GetHashCode(); + if (OptionalUint64 != 0UL) hash ^= OptionalUint64.GetHashCode(); + if (OptionalSint32 != 0) hash ^= OptionalSint32.GetHashCode(); + if (OptionalSint64 != 0L) hash ^= OptionalSint64.GetHashCode(); + if (OptionalFixed32 != 0) hash ^= OptionalFixed32.GetHashCode(); + if (OptionalFixed64 != 0UL) hash ^= OptionalFixed64.GetHashCode(); + if (OptionalSfixed32 != 0) hash ^= OptionalSfixed32.GetHashCode(); + if (OptionalSfixed64 != 0L) hash ^= OptionalSfixed64.GetHashCode(); + if (OptionalFloat != 0F) hash ^= OptionalFloat.GetHashCode(); + if (OptionalDouble != 0D) hash ^= OptionalDouble.GetHashCode(); + if (OptionalBool != false) hash ^= OptionalBool.GetHashCode(); + if (OptionalString.Length != 0) hash ^= OptionalString.GetHashCode(); + if (OptionalBytes.Length != 0) hash ^= OptionalBytes.GetHashCode(); + if (optionalNestedMessage_ != null) hash ^= OptionalNestedMessage.GetHashCode(); + if (optionalForeignMessage_ != null) hash ^= OptionalForeignMessage.GetHashCode(); + if (OptionalNestedEnum != 0) hash ^= OptionalNestedEnum.GetHashCode(); + if (OptionalForeignEnum != 0) hash ^= OptionalForeignEnum.GetHashCode(); + if (OptionalStringPiece.Length != 0) hash ^= OptionalStringPiece.GetHashCode(); + if (OptionalCord.Length != 0) hash ^= OptionalCord.GetHashCode(); + if (recursiveMessage_ != null) hash ^= RecursiveMessage.GetHashCode(); + hash ^= repeatedInt32_.GetHashCode(); + hash ^= repeatedInt64_.GetHashCode(); + hash ^= repeatedUint32_.GetHashCode(); + hash ^= repeatedUint64_.GetHashCode(); + hash ^= repeatedSint32_.GetHashCode(); + hash ^= repeatedSint64_.GetHashCode(); + hash ^= repeatedFixed32_.GetHashCode(); + hash ^= repeatedFixed64_.GetHashCode(); + hash ^= repeatedSfixed32_.GetHashCode(); + hash ^= repeatedSfixed64_.GetHashCode(); + hash ^= repeatedFloat_.GetHashCode(); + hash ^= repeatedDouble_.GetHashCode(); + hash ^= repeatedBool_.GetHashCode(); + hash ^= repeatedString_.GetHashCode(); + hash ^= repeatedBytes_.GetHashCode(); + hash ^= repeatedNestedMessage_.GetHashCode(); + hash ^= repeatedForeignMessage_.GetHashCode(); + hash ^= repeatedNestedEnum_.GetHashCode(); + hash ^= repeatedForeignEnum_.GetHashCode(); + hash ^= repeatedStringPiece_.GetHashCode(); + hash ^= repeatedCord_.GetHashCode(); + hash ^= MapInt32Int32.GetHashCode(); + hash ^= MapInt64Int64.GetHashCode(); + hash ^= MapUint32Uint32.GetHashCode(); + hash ^= MapUint64Uint64.GetHashCode(); + hash ^= MapSint32Sint32.GetHashCode(); + hash ^= MapSint64Sint64.GetHashCode(); + hash ^= MapFixed32Fixed32.GetHashCode(); + hash ^= MapFixed64Fixed64.GetHashCode(); + hash ^= MapSfixed32Sfixed32.GetHashCode(); + hash ^= MapSfixed64Sfixed64.GetHashCode(); + hash ^= MapInt32Float.GetHashCode(); + hash ^= MapInt32Double.GetHashCode(); + hash ^= MapBoolBool.GetHashCode(); + hash ^= MapStringString.GetHashCode(); + hash ^= MapStringBytes.GetHashCode(); + hash ^= MapStringNestedMessage.GetHashCode(); + hash ^= MapStringForeignMessage.GetHashCode(); + hash ^= MapStringNestedEnum.GetHashCode(); + hash ^= MapStringForeignEnum.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) hash ^= OneofUint32.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) hash ^= OneofNestedMessage.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) hash ^= OneofString.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) hash ^= OneofBytes.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBool) hash ^= OneofBool.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint64) hash ^= OneofUint64.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) hash ^= OneofFloat.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) hash ^= OneofDouble.GetHashCode(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofEnum) hash ^= OneofEnum.GetHashCode(); + if (optionalBoolWrapper_ != null) hash ^= OptionalBoolWrapper.GetHashCode(); + if (optionalInt32Wrapper_ != null) hash ^= OptionalInt32Wrapper.GetHashCode(); + if (optionalInt64Wrapper_ != null) hash ^= OptionalInt64Wrapper.GetHashCode(); + if (optionalUint32Wrapper_ != null) hash ^= OptionalUint32Wrapper.GetHashCode(); + if (optionalUint64Wrapper_ != null) hash ^= OptionalUint64Wrapper.GetHashCode(); + if (optionalFloatWrapper_ != null) hash ^= OptionalFloatWrapper.GetHashCode(); + if (optionalDoubleWrapper_ != null) hash ^= OptionalDoubleWrapper.GetHashCode(); + if (optionalStringWrapper_ != null) hash ^= OptionalStringWrapper.GetHashCode(); + if (optionalBytesWrapper_ != null) hash ^= OptionalBytesWrapper.GetHashCode(); + hash ^= repeatedBoolWrapper_.GetHashCode(); + hash ^= repeatedInt32Wrapper_.GetHashCode(); + hash ^= repeatedInt64Wrapper_.GetHashCode(); + hash ^= repeatedUint32Wrapper_.GetHashCode(); + hash ^= repeatedUint64Wrapper_.GetHashCode(); + hash ^= repeatedFloatWrapper_.GetHashCode(); + hash ^= repeatedDoubleWrapper_.GetHashCode(); + hash ^= repeatedStringWrapper_.GetHashCode(); + hash ^= repeatedBytesWrapper_.GetHashCode(); + if (optionalDuration_ != null) hash ^= OptionalDuration.GetHashCode(); + if (optionalTimestamp_ != null) hash ^= OptionalTimestamp.GetHashCode(); + if (optionalFieldMask_ != null) hash ^= OptionalFieldMask.GetHashCode(); + if (optionalStruct_ != null) hash ^= OptionalStruct.GetHashCode(); + if (optionalAny_ != null) hash ^= OptionalAny.GetHashCode(); + if (optionalValue_ != null) hash ^= OptionalValue.GetHashCode(); + hash ^= repeatedDuration_.GetHashCode(); + hash ^= repeatedTimestamp_.GetHashCode(); + hash ^= repeatedFieldmask_.GetHashCode(); + hash ^= repeatedStruct_.GetHashCode(); + hash ^= repeatedAny_.GetHashCode(); + hash ^= repeatedValue_.GetHashCode(); + if (Fieldname1 != 0) hash ^= Fieldname1.GetHashCode(); + if (FieldName2 != 0) hash ^= FieldName2.GetHashCode(); + if (FieldName3 != 0) hash ^= FieldName3.GetHashCode(); + if (FieldName4 != 0) hash ^= FieldName4.GetHashCode(); + if (Field0Name5 != 0) hash ^= Field0Name5.GetHashCode(); + if (Field0Name6 != 0) hash ^= Field0Name6.GetHashCode(); + if (FieldName7 != 0) hash ^= FieldName7.GetHashCode(); + if (FieldName8 != 0) hash ^= FieldName8.GetHashCode(); + if (FieldName9 != 0) hash ^= FieldName9.GetHashCode(); + if (FieldName10 != 0) hash ^= FieldName10.GetHashCode(); + if (FIELDNAME11 != 0) hash ^= FIELDNAME11.GetHashCode(); + if (FIELDName12 != 0) hash ^= FIELDName12.GetHashCode(); + if (FieldName13 != 0) hash ^= FieldName13.GetHashCode(); + if (FieldName14 != 0) hash ^= FieldName14.GetHashCode(); + if (FieldName15 != 0) hash ^= FieldName15.GetHashCode(); + if (FieldName16 != 0) hash ^= FieldName16.GetHashCode(); + if (FieldName17 != 0) hash ^= FieldName17.GetHashCode(); + if (FieldName18 != 0) hash ^= FieldName18.GetHashCode(); + hash ^= (int) oneofFieldCase_; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (OptionalInt32 != 0) { + output.WriteRawTag(8); + output.WriteInt32(OptionalInt32); + } + if (OptionalInt64 != 0L) { + output.WriteRawTag(16); + output.WriteInt64(OptionalInt64); + } + if (OptionalUint32 != 0) { + output.WriteRawTag(24); + output.WriteUInt32(OptionalUint32); + } + if (OptionalUint64 != 0UL) { + output.WriteRawTag(32); + output.WriteUInt64(OptionalUint64); + } + if (OptionalSint32 != 0) { + output.WriteRawTag(40); + output.WriteSInt32(OptionalSint32); + } + if (OptionalSint64 != 0L) { + output.WriteRawTag(48); + output.WriteSInt64(OptionalSint64); + } + if (OptionalFixed32 != 0) { + output.WriteRawTag(61); + output.WriteFixed32(OptionalFixed32); + } + if (OptionalFixed64 != 0UL) { + output.WriteRawTag(65); + output.WriteFixed64(OptionalFixed64); + } + if (OptionalSfixed32 != 0) { + output.WriteRawTag(77); + output.WriteSFixed32(OptionalSfixed32); + } + if (OptionalSfixed64 != 0L) { + output.WriteRawTag(81); + output.WriteSFixed64(OptionalSfixed64); + } + if (OptionalFloat != 0F) { + output.WriteRawTag(93); + output.WriteFloat(OptionalFloat); + } + if (OptionalDouble != 0D) { + output.WriteRawTag(97); + output.WriteDouble(OptionalDouble); + } + if (OptionalBool != false) { + output.WriteRawTag(104); + output.WriteBool(OptionalBool); + } + if (OptionalString.Length != 0) { + output.WriteRawTag(114); + output.WriteString(OptionalString); + } + if (OptionalBytes.Length != 0) { + output.WriteRawTag(122); + output.WriteBytes(OptionalBytes); + } + if (optionalNestedMessage_ != null) { + output.WriteRawTag(146, 1); + output.WriteMessage(OptionalNestedMessage); + } + if (optionalForeignMessage_ != null) { + output.WriteRawTag(154, 1); + output.WriteMessage(OptionalForeignMessage); + } + if (OptionalNestedEnum != 0) { + output.WriteRawTag(168, 1); + output.WriteEnum((int) OptionalNestedEnum); + } + if (OptionalForeignEnum != 0) { + output.WriteRawTag(176, 1); + output.WriteEnum((int) OptionalForeignEnum); + } + if (OptionalStringPiece.Length != 0) { + output.WriteRawTag(194, 1); + output.WriteString(OptionalStringPiece); + } + if (OptionalCord.Length != 0) { + output.WriteRawTag(202, 1); + output.WriteString(OptionalCord); + } + if (recursiveMessage_ != null) { + output.WriteRawTag(218, 1); + output.WriteMessage(RecursiveMessage); + } + repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec); + repeatedInt64_.WriteTo(output, _repeated_repeatedInt64_codec); + repeatedUint32_.WriteTo(output, _repeated_repeatedUint32_codec); + repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec); + repeatedSint32_.WriteTo(output, _repeated_repeatedSint32_codec); + repeatedSint64_.WriteTo(output, _repeated_repeatedSint64_codec); + repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec); + repeatedFixed64_.WriteTo(output, _repeated_repeatedFixed64_codec); + repeatedSfixed32_.WriteTo(output, _repeated_repeatedSfixed32_codec); + repeatedSfixed64_.WriteTo(output, _repeated_repeatedSfixed64_codec); + repeatedFloat_.WriteTo(output, _repeated_repeatedFloat_codec); + repeatedDouble_.WriteTo(output, _repeated_repeatedDouble_codec); + repeatedBool_.WriteTo(output, _repeated_repeatedBool_codec); + repeatedString_.WriteTo(output, _repeated_repeatedString_codec); + repeatedBytes_.WriteTo(output, _repeated_repeatedBytes_codec); + repeatedNestedMessage_.WriteTo(output, _repeated_repeatedNestedMessage_codec); + repeatedForeignMessage_.WriteTo(output, _repeated_repeatedForeignMessage_codec); + repeatedNestedEnum_.WriteTo(output, _repeated_repeatedNestedEnum_codec); + repeatedForeignEnum_.WriteTo(output, _repeated_repeatedForeignEnum_codec); + repeatedStringPiece_.WriteTo(output, _repeated_repeatedStringPiece_codec); + repeatedCord_.WriteTo(output, _repeated_repeatedCord_codec); + mapInt32Int32_.WriteTo(output, _map_mapInt32Int32_codec); + mapInt64Int64_.WriteTo(output, _map_mapInt64Int64_codec); + mapUint32Uint32_.WriteTo(output, _map_mapUint32Uint32_codec); + mapUint64Uint64_.WriteTo(output, _map_mapUint64Uint64_codec); + mapSint32Sint32_.WriteTo(output, _map_mapSint32Sint32_codec); + mapSint64Sint64_.WriteTo(output, _map_mapSint64Sint64_codec); + mapFixed32Fixed32_.WriteTo(output, _map_mapFixed32Fixed32_codec); + mapFixed64Fixed64_.WriteTo(output, _map_mapFixed64Fixed64_codec); + mapSfixed32Sfixed32_.WriteTo(output, _map_mapSfixed32Sfixed32_codec); + mapSfixed64Sfixed64_.WriteTo(output, _map_mapSfixed64Sfixed64_codec); + mapInt32Float_.WriteTo(output, _map_mapInt32Float_codec); + mapInt32Double_.WriteTo(output, _map_mapInt32Double_codec); + mapBoolBool_.WriteTo(output, _map_mapBoolBool_codec); + mapStringString_.WriteTo(output, _map_mapStringString_codec); + mapStringBytes_.WriteTo(output, _map_mapStringBytes_codec); + mapStringNestedMessage_.WriteTo(output, _map_mapStringNestedMessage_codec); + mapStringForeignMessage_.WriteTo(output, _map_mapStringForeignMessage_codec); + mapStringNestedEnum_.WriteTo(output, _map_mapStringNestedEnum_codec); + mapStringForeignEnum_.WriteTo(output, _map_mapStringForeignEnum_codec); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { + output.WriteRawTag(248, 6); + output.WriteUInt32(OneofUint32); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { + output.WriteRawTag(130, 7); + output.WriteMessage(OneofNestedMessage); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) { + output.WriteRawTag(138, 7); + output.WriteString(OneofString); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { + output.WriteRawTag(146, 7); + output.WriteBytes(OneofBytes); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBool) { + output.WriteRawTag(152, 7); + output.WriteBool(OneofBool); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint64) { + output.WriteRawTag(160, 7); + output.WriteUInt64(OneofUint64); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) { + output.WriteRawTag(173, 7); + output.WriteFloat(OneofFloat); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) { + output.WriteRawTag(177, 7); + output.WriteDouble(OneofDouble); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofEnum) { + output.WriteRawTag(184, 7); + output.WriteEnum((int) OneofEnum); + } + if (optionalBoolWrapper_ != null) { + _single_optionalBoolWrapper_codec.WriteTagAndValue(output, OptionalBoolWrapper); + } + if (optionalInt32Wrapper_ != null) { + _single_optionalInt32Wrapper_codec.WriteTagAndValue(output, OptionalInt32Wrapper); + } + if (optionalInt64Wrapper_ != null) { + _single_optionalInt64Wrapper_codec.WriteTagAndValue(output, OptionalInt64Wrapper); + } + if (optionalUint32Wrapper_ != null) { + _single_optionalUint32Wrapper_codec.WriteTagAndValue(output, OptionalUint32Wrapper); + } + if (optionalUint64Wrapper_ != null) { + _single_optionalUint64Wrapper_codec.WriteTagAndValue(output, OptionalUint64Wrapper); + } + if (optionalFloatWrapper_ != null) { + _single_optionalFloatWrapper_codec.WriteTagAndValue(output, OptionalFloatWrapper); + } + if (optionalDoubleWrapper_ != null) { + _single_optionalDoubleWrapper_codec.WriteTagAndValue(output, OptionalDoubleWrapper); + } + if (optionalStringWrapper_ != null) { + _single_optionalStringWrapper_codec.WriteTagAndValue(output, OptionalStringWrapper); + } + if (optionalBytesWrapper_ != null) { + _single_optionalBytesWrapper_codec.WriteTagAndValue(output, OptionalBytesWrapper); + } + repeatedBoolWrapper_.WriteTo(output, _repeated_repeatedBoolWrapper_codec); + repeatedInt32Wrapper_.WriteTo(output, _repeated_repeatedInt32Wrapper_codec); + repeatedInt64Wrapper_.WriteTo(output, _repeated_repeatedInt64Wrapper_codec); + repeatedUint32Wrapper_.WriteTo(output, _repeated_repeatedUint32Wrapper_codec); + repeatedUint64Wrapper_.WriteTo(output, _repeated_repeatedUint64Wrapper_codec); + repeatedFloatWrapper_.WriteTo(output, _repeated_repeatedFloatWrapper_codec); + repeatedDoubleWrapper_.WriteTo(output, _repeated_repeatedDoubleWrapper_codec); + repeatedStringWrapper_.WriteTo(output, _repeated_repeatedStringWrapper_codec); + repeatedBytesWrapper_.WriteTo(output, _repeated_repeatedBytesWrapper_codec); + if (optionalDuration_ != null) { + output.WriteRawTag(234, 18); + output.WriteMessage(OptionalDuration); + } + if (optionalTimestamp_ != null) { + output.WriteRawTag(242, 18); + output.WriteMessage(OptionalTimestamp); + } + if (optionalFieldMask_ != null) { + output.WriteRawTag(250, 18); + output.WriteMessage(OptionalFieldMask); + } + if (optionalStruct_ != null) { + output.WriteRawTag(130, 19); + output.WriteMessage(OptionalStruct); + } + if (optionalAny_ != null) { + output.WriteRawTag(138, 19); + output.WriteMessage(OptionalAny); + } + if (optionalValue_ != null) { + output.WriteRawTag(146, 19); + output.WriteMessage(OptionalValue); + } + repeatedDuration_.WriteTo(output, _repeated_repeatedDuration_codec); + repeatedTimestamp_.WriteTo(output, _repeated_repeatedTimestamp_codec); + repeatedFieldmask_.WriteTo(output, _repeated_repeatedFieldmask_codec); + repeatedAny_.WriteTo(output, _repeated_repeatedAny_codec); + repeatedValue_.WriteTo(output, _repeated_repeatedValue_codec); + repeatedStruct_.WriteTo(output, _repeated_repeatedStruct_codec); + if (Fieldname1 != 0) { + output.WriteRawTag(136, 25); + output.WriteInt32(Fieldname1); + } + if (FieldName2 != 0) { + output.WriteRawTag(144, 25); + output.WriteInt32(FieldName2); + } + if (FieldName3 != 0) { + output.WriteRawTag(152, 25); + output.WriteInt32(FieldName3); + } + if (FieldName4 != 0) { + output.WriteRawTag(160, 25); + output.WriteInt32(FieldName4); + } + if (Field0Name5 != 0) { + output.WriteRawTag(168, 25); + output.WriteInt32(Field0Name5); + } + if (Field0Name6 != 0) { + output.WriteRawTag(176, 25); + output.WriteInt32(Field0Name6); + } + if (FieldName7 != 0) { + output.WriteRawTag(184, 25); + output.WriteInt32(FieldName7); + } + if (FieldName8 != 0) { + output.WriteRawTag(192, 25); + output.WriteInt32(FieldName8); + } + if (FieldName9 != 0) { + output.WriteRawTag(200, 25); + output.WriteInt32(FieldName9); + } + if (FieldName10 != 0) { + output.WriteRawTag(208, 25); + output.WriteInt32(FieldName10); + } + if (FIELDNAME11 != 0) { + output.WriteRawTag(216, 25); + output.WriteInt32(FIELDNAME11); + } + if (FIELDName12 != 0) { + output.WriteRawTag(224, 25); + output.WriteInt32(FIELDName12); + } + if (FieldName13 != 0) { + output.WriteRawTag(232, 25); + output.WriteInt32(FieldName13); + } + if (FieldName14 != 0) { + output.WriteRawTag(240, 25); + output.WriteInt32(FieldName14); + } + if (FieldName15 != 0) { + output.WriteRawTag(248, 25); + output.WriteInt32(FieldName15); + } + if (FieldName16 != 0) { + output.WriteRawTag(128, 26); + output.WriteInt32(FieldName16); + } + if (FieldName17 != 0) { + output.WriteRawTag(136, 26); + output.WriteInt32(FieldName17); + } + if (FieldName18 != 0) { + output.WriteRawTag(144, 26); + output.WriteInt32(FieldName18); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (OptionalInt32 != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(OptionalInt32); + } + if (OptionalInt64 != 0L) { + size += 1 + pb::CodedOutputStream.ComputeInt64Size(OptionalInt64); + } + if (OptionalUint32 != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(OptionalUint32); + } + if (OptionalUint64 != 0UL) { + size += 1 + pb::CodedOutputStream.ComputeUInt64Size(OptionalUint64); + } + if (OptionalSint32 != 0) { + size += 1 + pb::CodedOutputStream.ComputeSInt32Size(OptionalSint32); + } + if (OptionalSint64 != 0L) { + size += 1 + pb::CodedOutputStream.ComputeSInt64Size(OptionalSint64); + } + if (OptionalFixed32 != 0) { + size += 1 + 4; + } + if (OptionalFixed64 != 0UL) { + size += 1 + 8; + } + if (OptionalSfixed32 != 0) { + size += 1 + 4; + } + if (OptionalSfixed64 != 0L) { + size += 1 + 8; + } + if (OptionalFloat != 0F) { + size += 1 + 4; + } + if (OptionalDouble != 0D) { + size += 1 + 8; + } + if (OptionalBool != false) { + size += 1 + 1; + } + if (OptionalString.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(OptionalString); + } + if (OptionalBytes.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(OptionalBytes); + } + if (optionalNestedMessage_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalNestedMessage); + } + if (optionalForeignMessage_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalForeignMessage); + } + if (OptionalNestedEnum != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalNestedEnum); + } + if (OptionalForeignEnum != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OptionalForeignEnum); + } + if (OptionalStringPiece.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalStringPiece); + } + if (OptionalCord.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OptionalCord); + } + if (recursiveMessage_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(RecursiveMessage); + } + size += repeatedInt32_.CalculateSize(_repeated_repeatedInt32_codec); + size += repeatedInt64_.CalculateSize(_repeated_repeatedInt64_codec); + size += repeatedUint32_.CalculateSize(_repeated_repeatedUint32_codec); + size += repeatedUint64_.CalculateSize(_repeated_repeatedUint64_codec); + size += repeatedSint32_.CalculateSize(_repeated_repeatedSint32_codec); + size += repeatedSint64_.CalculateSize(_repeated_repeatedSint64_codec); + size += repeatedFixed32_.CalculateSize(_repeated_repeatedFixed32_codec); + size += repeatedFixed64_.CalculateSize(_repeated_repeatedFixed64_codec); + size += repeatedSfixed32_.CalculateSize(_repeated_repeatedSfixed32_codec); + size += repeatedSfixed64_.CalculateSize(_repeated_repeatedSfixed64_codec); + size += repeatedFloat_.CalculateSize(_repeated_repeatedFloat_codec); + size += repeatedDouble_.CalculateSize(_repeated_repeatedDouble_codec); + size += repeatedBool_.CalculateSize(_repeated_repeatedBool_codec); + size += repeatedString_.CalculateSize(_repeated_repeatedString_codec); + size += repeatedBytes_.CalculateSize(_repeated_repeatedBytes_codec); + size += repeatedNestedMessage_.CalculateSize(_repeated_repeatedNestedMessage_codec); + size += repeatedForeignMessage_.CalculateSize(_repeated_repeatedForeignMessage_codec); + size += repeatedNestedEnum_.CalculateSize(_repeated_repeatedNestedEnum_codec); + size += repeatedForeignEnum_.CalculateSize(_repeated_repeatedForeignEnum_codec); + size += repeatedStringPiece_.CalculateSize(_repeated_repeatedStringPiece_codec); + size += repeatedCord_.CalculateSize(_repeated_repeatedCord_codec); + size += mapInt32Int32_.CalculateSize(_map_mapInt32Int32_codec); + size += mapInt64Int64_.CalculateSize(_map_mapInt64Int64_codec); + size += mapUint32Uint32_.CalculateSize(_map_mapUint32Uint32_codec); + size += mapUint64Uint64_.CalculateSize(_map_mapUint64Uint64_codec); + size += mapSint32Sint32_.CalculateSize(_map_mapSint32Sint32_codec); + size += mapSint64Sint64_.CalculateSize(_map_mapSint64Sint64_codec); + size += mapFixed32Fixed32_.CalculateSize(_map_mapFixed32Fixed32_codec); + size += mapFixed64Fixed64_.CalculateSize(_map_mapFixed64Fixed64_codec); + size += mapSfixed32Sfixed32_.CalculateSize(_map_mapSfixed32Sfixed32_codec); + size += mapSfixed64Sfixed64_.CalculateSize(_map_mapSfixed64Sfixed64_codec); + size += mapInt32Float_.CalculateSize(_map_mapInt32Float_codec); + size += mapInt32Double_.CalculateSize(_map_mapInt32Double_codec); + size += mapBoolBool_.CalculateSize(_map_mapBoolBool_codec); + size += mapStringString_.CalculateSize(_map_mapStringString_codec); + size += mapStringBytes_.CalculateSize(_map_mapStringBytes_codec); + size += mapStringNestedMessage_.CalculateSize(_map_mapStringNestedMessage_codec); + size += mapStringForeignMessage_.CalculateSize(_map_mapStringForeignMessage_codec); + size += mapStringNestedEnum_.CalculateSize(_map_mapStringNestedEnum_codec); + size += mapStringForeignEnum_.CalculateSize(_map_mapStringForeignEnum_codec); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { + size += 2 + pb::CodedOutputStream.ComputeUInt32Size(OneofUint32); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OneofNestedMessage); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofString) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(OneofString); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBytes) { + size += 2 + pb::CodedOutputStream.ComputeBytesSize(OneofBytes); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofBool) { + size += 2 + 1; + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint64) { + size += 2 + pb::CodedOutputStream.ComputeUInt64Size(OneofUint64); + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofFloat) { + size += 2 + 4; + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofDouble) { + size += 2 + 8; + } + if (oneofFieldCase_ == OneofFieldOneofCase.OneofEnum) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) OneofEnum); + } + if (optionalBoolWrapper_ != null) { + size += _single_optionalBoolWrapper_codec.CalculateSizeWithTag(OptionalBoolWrapper); + } + if (optionalInt32Wrapper_ != null) { + size += _single_optionalInt32Wrapper_codec.CalculateSizeWithTag(OptionalInt32Wrapper); + } + if (optionalInt64Wrapper_ != null) { + size += _single_optionalInt64Wrapper_codec.CalculateSizeWithTag(OptionalInt64Wrapper); + } + if (optionalUint32Wrapper_ != null) { + size += _single_optionalUint32Wrapper_codec.CalculateSizeWithTag(OptionalUint32Wrapper); + } + if (optionalUint64Wrapper_ != null) { + size += _single_optionalUint64Wrapper_codec.CalculateSizeWithTag(OptionalUint64Wrapper); + } + if (optionalFloatWrapper_ != null) { + size += _single_optionalFloatWrapper_codec.CalculateSizeWithTag(OptionalFloatWrapper); + } + if (optionalDoubleWrapper_ != null) { + size += _single_optionalDoubleWrapper_codec.CalculateSizeWithTag(OptionalDoubleWrapper); + } + if (optionalStringWrapper_ != null) { + size += _single_optionalStringWrapper_codec.CalculateSizeWithTag(OptionalStringWrapper); + } + if (optionalBytesWrapper_ != null) { + size += _single_optionalBytesWrapper_codec.CalculateSizeWithTag(OptionalBytesWrapper); + } + size += repeatedBoolWrapper_.CalculateSize(_repeated_repeatedBoolWrapper_codec); + size += repeatedInt32Wrapper_.CalculateSize(_repeated_repeatedInt32Wrapper_codec); + size += repeatedInt64Wrapper_.CalculateSize(_repeated_repeatedInt64Wrapper_codec); + size += repeatedUint32Wrapper_.CalculateSize(_repeated_repeatedUint32Wrapper_codec); + size += repeatedUint64Wrapper_.CalculateSize(_repeated_repeatedUint64Wrapper_codec); + size += repeatedFloatWrapper_.CalculateSize(_repeated_repeatedFloatWrapper_codec); + size += repeatedDoubleWrapper_.CalculateSize(_repeated_repeatedDoubleWrapper_codec); + size += repeatedStringWrapper_.CalculateSize(_repeated_repeatedStringWrapper_codec); + size += repeatedBytesWrapper_.CalculateSize(_repeated_repeatedBytesWrapper_codec); + if (optionalDuration_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalDuration); + } + if (optionalTimestamp_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalTimestamp); + } + if (optionalFieldMask_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalFieldMask); + } + if (optionalStruct_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalStruct); + } + if (optionalAny_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalAny); + } + if (optionalValue_ != null) { + size += 2 + pb::CodedOutputStream.ComputeMessageSize(OptionalValue); + } + size += repeatedDuration_.CalculateSize(_repeated_repeatedDuration_codec); + size += repeatedTimestamp_.CalculateSize(_repeated_repeatedTimestamp_codec); + size += repeatedFieldmask_.CalculateSize(_repeated_repeatedFieldmask_codec); + size += repeatedStruct_.CalculateSize(_repeated_repeatedStruct_codec); + size += repeatedAny_.CalculateSize(_repeated_repeatedAny_codec); + size += repeatedValue_.CalculateSize(_repeated_repeatedValue_codec); + if (Fieldname1 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Fieldname1); + } + if (FieldName2 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName2); + } + if (FieldName3 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName3); + } + if (FieldName4 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName4); + } + if (Field0Name5 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field0Name5); + } + if (Field0Name6 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field0Name6); + } + if (FieldName7 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName7); + } + if (FieldName8 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName8); + } + if (FieldName9 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName9); + } + if (FieldName10 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName10); + } + if (FIELDNAME11 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FIELDNAME11); + } + if (FIELDName12 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FIELDName12); + } + if (FieldName13 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName13); + } + if (FieldName14 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName14); + } + if (FieldName15 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName15); + } + if (FieldName16 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName16); + } + if (FieldName17 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName17); + } + if (FieldName18 != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(FieldName18); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestAllTypes other) { + if (other == null) { + return; + } + if (other.OptionalInt32 != 0) { + OptionalInt32 = other.OptionalInt32; + } + if (other.OptionalInt64 != 0L) { + OptionalInt64 = other.OptionalInt64; + } + if (other.OptionalUint32 != 0) { + OptionalUint32 = other.OptionalUint32; + } + if (other.OptionalUint64 != 0UL) { + OptionalUint64 = other.OptionalUint64; + } + if (other.OptionalSint32 != 0) { + OptionalSint32 = other.OptionalSint32; + } + if (other.OptionalSint64 != 0L) { + OptionalSint64 = other.OptionalSint64; + } + if (other.OptionalFixed32 != 0) { + OptionalFixed32 = other.OptionalFixed32; + } + if (other.OptionalFixed64 != 0UL) { + OptionalFixed64 = other.OptionalFixed64; + } + if (other.OptionalSfixed32 != 0) { + OptionalSfixed32 = other.OptionalSfixed32; + } + if (other.OptionalSfixed64 != 0L) { + OptionalSfixed64 = other.OptionalSfixed64; + } + if (other.OptionalFloat != 0F) { + OptionalFloat = other.OptionalFloat; + } + if (other.OptionalDouble != 0D) { + OptionalDouble = other.OptionalDouble; + } + if (other.OptionalBool != false) { + OptionalBool = other.OptionalBool; + } + if (other.OptionalString.Length != 0) { + OptionalString = other.OptionalString; + } + if (other.OptionalBytes.Length != 0) { + OptionalBytes = other.OptionalBytes; + } + if (other.optionalNestedMessage_ != null) { + if (optionalNestedMessage_ == null) { + optionalNestedMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage(); + } + OptionalNestedMessage.MergeFrom(other.OptionalNestedMessage); + } + if (other.optionalForeignMessage_ != null) { + if (optionalForeignMessage_ == null) { + optionalForeignMessage_ = new global::ProtobufTestMessages.Proto3.ForeignMessage(); + } + OptionalForeignMessage.MergeFrom(other.OptionalForeignMessage); + } + if (other.OptionalNestedEnum != 0) { + OptionalNestedEnum = other.OptionalNestedEnum; + } + if (other.OptionalForeignEnum != 0) { + OptionalForeignEnum = other.OptionalForeignEnum; + } + if (other.OptionalStringPiece.Length != 0) { + OptionalStringPiece = other.OptionalStringPiece; + } + if (other.OptionalCord.Length != 0) { + OptionalCord = other.OptionalCord; + } + if (other.recursiveMessage_ != null) { + if (recursiveMessage_ == null) { + recursiveMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypes(); + } + RecursiveMessage.MergeFrom(other.RecursiveMessage); + } + repeatedInt32_.Add(other.repeatedInt32_); + repeatedInt64_.Add(other.repeatedInt64_); + repeatedUint32_.Add(other.repeatedUint32_); + repeatedUint64_.Add(other.repeatedUint64_); + repeatedSint32_.Add(other.repeatedSint32_); + repeatedSint64_.Add(other.repeatedSint64_); + repeatedFixed32_.Add(other.repeatedFixed32_); + repeatedFixed64_.Add(other.repeatedFixed64_); + repeatedSfixed32_.Add(other.repeatedSfixed32_); + repeatedSfixed64_.Add(other.repeatedSfixed64_); + repeatedFloat_.Add(other.repeatedFloat_); + repeatedDouble_.Add(other.repeatedDouble_); + repeatedBool_.Add(other.repeatedBool_); + repeatedString_.Add(other.repeatedString_); + repeatedBytes_.Add(other.repeatedBytes_); + repeatedNestedMessage_.Add(other.repeatedNestedMessage_); + repeatedForeignMessage_.Add(other.repeatedForeignMessage_); + repeatedNestedEnum_.Add(other.repeatedNestedEnum_); + repeatedForeignEnum_.Add(other.repeatedForeignEnum_); + repeatedStringPiece_.Add(other.repeatedStringPiece_); + repeatedCord_.Add(other.repeatedCord_); + mapInt32Int32_.Add(other.mapInt32Int32_); + mapInt64Int64_.Add(other.mapInt64Int64_); + mapUint32Uint32_.Add(other.mapUint32Uint32_); + mapUint64Uint64_.Add(other.mapUint64Uint64_); + mapSint32Sint32_.Add(other.mapSint32Sint32_); + mapSint64Sint64_.Add(other.mapSint64Sint64_); + mapFixed32Fixed32_.Add(other.mapFixed32Fixed32_); + mapFixed64Fixed64_.Add(other.mapFixed64Fixed64_); + mapSfixed32Sfixed32_.Add(other.mapSfixed32Sfixed32_); + mapSfixed64Sfixed64_.Add(other.mapSfixed64Sfixed64_); + mapInt32Float_.Add(other.mapInt32Float_); + mapInt32Double_.Add(other.mapInt32Double_); + mapBoolBool_.Add(other.mapBoolBool_); + mapStringString_.Add(other.mapStringString_); + mapStringBytes_.Add(other.mapStringBytes_); + mapStringNestedMessage_.Add(other.mapStringNestedMessage_); + mapStringForeignMessage_.Add(other.mapStringForeignMessage_); + mapStringNestedEnum_.Add(other.mapStringNestedEnum_); + mapStringForeignEnum_.Add(other.mapStringForeignEnum_); + if (other.optionalBoolWrapper_ != null) { + if (optionalBoolWrapper_ == null || other.OptionalBoolWrapper != false) { + OptionalBoolWrapper = other.OptionalBoolWrapper; + } + } + if (other.optionalInt32Wrapper_ != null) { + if (optionalInt32Wrapper_ == null || other.OptionalInt32Wrapper != 0) { + OptionalInt32Wrapper = other.OptionalInt32Wrapper; + } + } + if (other.optionalInt64Wrapper_ != null) { + if (optionalInt64Wrapper_ == null || other.OptionalInt64Wrapper != 0L) { + OptionalInt64Wrapper = other.OptionalInt64Wrapper; + } + } + if (other.optionalUint32Wrapper_ != null) { + if (optionalUint32Wrapper_ == null || other.OptionalUint32Wrapper != 0) { + OptionalUint32Wrapper = other.OptionalUint32Wrapper; + } + } + if (other.optionalUint64Wrapper_ != null) { + if (optionalUint64Wrapper_ == null || other.OptionalUint64Wrapper != 0UL) { + OptionalUint64Wrapper = other.OptionalUint64Wrapper; + } + } + if (other.optionalFloatWrapper_ != null) { + if (optionalFloatWrapper_ == null || other.OptionalFloatWrapper != 0F) { + OptionalFloatWrapper = other.OptionalFloatWrapper; + } + } + if (other.optionalDoubleWrapper_ != null) { + if (optionalDoubleWrapper_ == null || other.OptionalDoubleWrapper != 0D) { + OptionalDoubleWrapper = other.OptionalDoubleWrapper; + } + } + if (other.optionalStringWrapper_ != null) { + if (optionalStringWrapper_ == null || other.OptionalStringWrapper != "") { + OptionalStringWrapper = other.OptionalStringWrapper; + } + } + if (other.optionalBytesWrapper_ != null) { + if (optionalBytesWrapper_ == null || other.OptionalBytesWrapper != pb::ByteString.Empty) { + OptionalBytesWrapper = other.OptionalBytesWrapper; + } + } + repeatedBoolWrapper_.Add(other.repeatedBoolWrapper_); + repeatedInt32Wrapper_.Add(other.repeatedInt32Wrapper_); + repeatedInt64Wrapper_.Add(other.repeatedInt64Wrapper_); + repeatedUint32Wrapper_.Add(other.repeatedUint32Wrapper_); + repeatedUint64Wrapper_.Add(other.repeatedUint64Wrapper_); + repeatedFloatWrapper_.Add(other.repeatedFloatWrapper_); + repeatedDoubleWrapper_.Add(other.repeatedDoubleWrapper_); + repeatedStringWrapper_.Add(other.repeatedStringWrapper_); + repeatedBytesWrapper_.Add(other.repeatedBytesWrapper_); + if (other.optionalDuration_ != null) { + if (optionalDuration_ == null) { + optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + OptionalDuration.MergeFrom(other.OptionalDuration); + } + if (other.optionalTimestamp_ != null) { + if (optionalTimestamp_ == null) { + optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + OptionalTimestamp.MergeFrom(other.OptionalTimestamp); + } + if (other.optionalFieldMask_ != null) { + if (optionalFieldMask_ == null) { + optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + } + OptionalFieldMask.MergeFrom(other.OptionalFieldMask); + } + if (other.optionalStruct_ != null) { + if (optionalStruct_ == null) { + optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + OptionalStruct.MergeFrom(other.OptionalStruct); + } + if (other.optionalAny_ != null) { + if (optionalAny_ == null) { + optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any(); + } + OptionalAny.MergeFrom(other.OptionalAny); + } + if (other.optionalValue_ != null) { + if (optionalValue_ == null) { + optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value(); + } + OptionalValue.MergeFrom(other.OptionalValue); + } + repeatedDuration_.Add(other.repeatedDuration_); + repeatedTimestamp_.Add(other.repeatedTimestamp_); + repeatedFieldmask_.Add(other.repeatedFieldmask_); + repeatedStruct_.Add(other.repeatedStruct_); + repeatedAny_.Add(other.repeatedAny_); + repeatedValue_.Add(other.repeatedValue_); + if (other.Fieldname1 != 0) { + Fieldname1 = other.Fieldname1; + } + if (other.FieldName2 != 0) { + FieldName2 = other.FieldName2; + } + if (other.FieldName3 != 0) { + FieldName3 = other.FieldName3; + } + if (other.FieldName4 != 0) { + FieldName4 = other.FieldName4; + } + if (other.Field0Name5 != 0) { + Field0Name5 = other.Field0Name5; + } + if (other.Field0Name6 != 0) { + Field0Name6 = other.Field0Name6; + } + if (other.FieldName7 != 0) { + FieldName7 = other.FieldName7; + } + if (other.FieldName8 != 0) { + FieldName8 = other.FieldName8; + } + if (other.FieldName9 != 0) { + FieldName9 = other.FieldName9; + } + if (other.FieldName10 != 0) { + FieldName10 = other.FieldName10; + } + if (other.FIELDNAME11 != 0) { + FIELDNAME11 = other.FIELDNAME11; + } + if (other.FIELDName12 != 0) { + FIELDName12 = other.FIELDName12; + } + if (other.FieldName13 != 0) { + FieldName13 = other.FieldName13; + } + if (other.FieldName14 != 0) { + FieldName14 = other.FieldName14; + } + if (other.FieldName15 != 0) { + FieldName15 = other.FieldName15; + } + if (other.FieldName16 != 0) { + FieldName16 = other.FieldName16; + } + if (other.FieldName17 != 0) { + FieldName17 = other.FieldName17; + } + if (other.FieldName18 != 0) { + FieldName18 = other.FieldName18; + } + switch (other.OneofFieldCase) { + case OneofFieldOneofCase.OneofUint32: + OneofUint32 = other.OneofUint32; + break; + case OneofFieldOneofCase.OneofNestedMessage: + OneofNestedMessage = other.OneofNestedMessage; + break; + case OneofFieldOneofCase.OneofString: + OneofString = other.OneofString; + break; + case OneofFieldOneofCase.OneofBytes: + OneofBytes = other.OneofBytes; + break; + case OneofFieldOneofCase.OneofBool: + OneofBool = other.OneofBool; + break; + case OneofFieldOneofCase.OneofUint64: + OneofUint64 = other.OneofUint64; + break; + case OneofFieldOneofCase.OneofFloat: + OneofFloat = other.OneofFloat; + break; + case OneofFieldOneofCase.OneofDouble: + OneofDouble = other.OneofDouble; + break; + case OneofFieldOneofCase.OneofEnum: + OneofEnum = other.OneofEnum; + break; + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + OptionalInt32 = input.ReadInt32(); + break; + } + case 16: { + OptionalInt64 = input.ReadInt64(); + break; + } + case 24: { + OptionalUint32 = input.ReadUInt32(); + break; + } + case 32: { + OptionalUint64 = input.ReadUInt64(); + break; + } + case 40: { + OptionalSint32 = input.ReadSInt32(); + break; + } + case 48: { + OptionalSint64 = input.ReadSInt64(); + break; + } + case 61: { + OptionalFixed32 = input.ReadFixed32(); + break; + } + case 65: { + OptionalFixed64 = input.ReadFixed64(); + break; + } + case 77: { + OptionalSfixed32 = input.ReadSFixed32(); + break; + } + case 81: { + OptionalSfixed64 = input.ReadSFixed64(); + break; + } + case 93: { + OptionalFloat = input.ReadFloat(); + break; + } + case 97: { + OptionalDouble = input.ReadDouble(); + break; + } + case 104: { + OptionalBool = input.ReadBool(); + break; + } + case 114: { + OptionalString = input.ReadString(); + break; + } + case 122: { + OptionalBytes = input.ReadBytes(); + break; + } + case 146: { + if (optionalNestedMessage_ == null) { + optionalNestedMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage(); + } + input.ReadMessage(optionalNestedMessage_); + break; + } + case 154: { + if (optionalForeignMessage_ == null) { + optionalForeignMessage_ = new global::ProtobufTestMessages.Proto3.ForeignMessage(); + } + input.ReadMessage(optionalForeignMessage_); + break; + } + case 168: { + optionalNestedEnum_ = (global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedEnum) input.ReadEnum(); + break; + } + case 176: { + optionalForeignEnum_ = (global::ProtobufTestMessages.Proto3.ForeignEnum) input.ReadEnum(); + break; + } + case 194: { + OptionalStringPiece = input.ReadString(); + break; + } + case 202: { + OptionalCord = input.ReadString(); + break; + } + case 218: { + if (recursiveMessage_ == null) { + recursiveMessage_ = new global::ProtobufTestMessages.Proto3.TestAllTypes(); + } + input.ReadMessage(recursiveMessage_); + break; + } + case 250: + case 248: { + repeatedInt32_.AddEntriesFrom(input, _repeated_repeatedInt32_codec); + break; + } + case 258: + case 256: { + repeatedInt64_.AddEntriesFrom(input, _repeated_repeatedInt64_codec); + break; + } + case 266: + case 264: { + repeatedUint32_.AddEntriesFrom(input, _repeated_repeatedUint32_codec); + break; + } + case 274: + case 272: { + repeatedUint64_.AddEntriesFrom(input, _repeated_repeatedUint64_codec); + break; + } + case 282: + case 280: { + repeatedSint32_.AddEntriesFrom(input, _repeated_repeatedSint32_codec); + break; + } + case 290: + case 288: { + repeatedSint64_.AddEntriesFrom(input, _repeated_repeatedSint64_codec); + break; + } + case 298: + case 301: { + repeatedFixed32_.AddEntriesFrom(input, _repeated_repeatedFixed32_codec); + break; + } + case 306: + case 305: { + repeatedFixed64_.AddEntriesFrom(input, _repeated_repeatedFixed64_codec); + break; + } + case 314: + case 317: { + repeatedSfixed32_.AddEntriesFrom(input, _repeated_repeatedSfixed32_codec); + break; + } + case 322: + case 321: { + repeatedSfixed64_.AddEntriesFrom(input, _repeated_repeatedSfixed64_codec); + break; + } + case 330: + case 333: { + repeatedFloat_.AddEntriesFrom(input, _repeated_repeatedFloat_codec); + break; + } + case 338: + case 337: { + repeatedDouble_.AddEntriesFrom(input, _repeated_repeatedDouble_codec); + break; + } + case 346: + case 344: { + repeatedBool_.AddEntriesFrom(input, _repeated_repeatedBool_codec); + break; + } + case 354: { + repeatedString_.AddEntriesFrom(input, _repeated_repeatedString_codec); + break; + } + case 362: { + repeatedBytes_.AddEntriesFrom(input, _repeated_repeatedBytes_codec); + break; + } + case 386: { + repeatedNestedMessage_.AddEntriesFrom(input, _repeated_repeatedNestedMessage_codec); + break; + } + case 394: { + repeatedForeignMessage_.AddEntriesFrom(input, _repeated_repeatedForeignMessage_codec); + break; + } + case 410: + case 408: { + repeatedNestedEnum_.AddEntriesFrom(input, _repeated_repeatedNestedEnum_codec); + break; + } + case 418: + case 416: { + repeatedForeignEnum_.AddEntriesFrom(input, _repeated_repeatedForeignEnum_codec); + break; + } + case 434: { + repeatedStringPiece_.AddEntriesFrom(input, _repeated_repeatedStringPiece_codec); + break; + } + case 442: { + repeatedCord_.AddEntriesFrom(input, _repeated_repeatedCord_codec); + break; + } + case 450: { + mapInt32Int32_.AddEntriesFrom(input, _map_mapInt32Int32_codec); + break; + } + case 458: { + mapInt64Int64_.AddEntriesFrom(input, _map_mapInt64Int64_codec); + break; + } + case 466: { + mapUint32Uint32_.AddEntriesFrom(input, _map_mapUint32Uint32_codec); + break; + } + case 474: { + mapUint64Uint64_.AddEntriesFrom(input, _map_mapUint64Uint64_codec); + break; + } + case 482: { + mapSint32Sint32_.AddEntriesFrom(input, _map_mapSint32Sint32_codec); + break; + } + case 490: { + mapSint64Sint64_.AddEntriesFrom(input, _map_mapSint64Sint64_codec); + break; + } + case 498: { + mapFixed32Fixed32_.AddEntriesFrom(input, _map_mapFixed32Fixed32_codec); + break; + } + case 506: { + mapFixed64Fixed64_.AddEntriesFrom(input, _map_mapFixed64Fixed64_codec); + break; + } + case 514: { + mapSfixed32Sfixed32_.AddEntriesFrom(input, _map_mapSfixed32Sfixed32_codec); + break; + } + case 522: { + mapSfixed64Sfixed64_.AddEntriesFrom(input, _map_mapSfixed64Sfixed64_codec); + break; + } + case 530: { + mapInt32Float_.AddEntriesFrom(input, _map_mapInt32Float_codec); + break; + } + case 538: { + mapInt32Double_.AddEntriesFrom(input, _map_mapInt32Double_codec); + break; + } + case 546: { + mapBoolBool_.AddEntriesFrom(input, _map_mapBoolBool_codec); + break; + } + case 554: { + mapStringString_.AddEntriesFrom(input, _map_mapStringString_codec); + break; + } + case 562: { + mapStringBytes_.AddEntriesFrom(input, _map_mapStringBytes_codec); + break; + } + case 570: { + mapStringNestedMessage_.AddEntriesFrom(input, _map_mapStringNestedMessage_codec); + break; + } + case 578: { + mapStringForeignMessage_.AddEntriesFrom(input, _map_mapStringForeignMessage_codec); + break; + } + case 586: { + mapStringNestedEnum_.AddEntriesFrom(input, _map_mapStringNestedEnum_codec); + break; + } + case 594: { + mapStringForeignEnum_.AddEntriesFrom(input, _map_mapStringForeignEnum_codec); + break; + } + case 888: { + OneofUint32 = input.ReadUInt32(); + break; + } + case 898: { + global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage subBuilder = new global::ProtobufTestMessages.Proto3.TestAllTypes.Types.NestedMessage(); + if (oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage) { + subBuilder.MergeFrom(OneofNestedMessage); + } + input.ReadMessage(subBuilder); + OneofNestedMessage = subBuilder; + break; + } + case 906: { + OneofString = input.ReadString(); + break; + } + case 914: { + OneofBytes = input.ReadBytes(); + break; + } + case 920: { + OneofBool = input.ReadBool(); + break; + } + case 928: { + OneofUint64 = input.ReadUInt64(); + break; + } + case 941: { + OneofFloat = input.ReadFloat(); + break; + } + case 945: { + OneofDouble = input.ReadDouble(); + break; + } + case 952: { + oneofField_ = input.ReadEnum(); + oneofFieldCase_ = OneofFieldOneofCase.OneofEnum; + break; + } + case 1610: { + bool? value = _single_optionalBoolWrapper_codec.Read(input); + if (optionalBoolWrapper_ == null || value != false) { + OptionalBoolWrapper = value; + } + break; + } + case 1618: { + int? value = _single_optionalInt32Wrapper_codec.Read(input); + if (optionalInt32Wrapper_ == null || value != 0) { + OptionalInt32Wrapper = value; + } + break; + } + case 1626: { + long? value = _single_optionalInt64Wrapper_codec.Read(input); + if (optionalInt64Wrapper_ == null || value != 0L) { + OptionalInt64Wrapper = value; + } + break; + } + case 1634: { + uint? value = _single_optionalUint32Wrapper_codec.Read(input); + if (optionalUint32Wrapper_ == null || value != 0) { + OptionalUint32Wrapper = value; + } + break; + } + case 1642: { + ulong? value = _single_optionalUint64Wrapper_codec.Read(input); + if (optionalUint64Wrapper_ == null || value != 0UL) { + OptionalUint64Wrapper = value; + } + break; + } + case 1650: { + float? value = _single_optionalFloatWrapper_codec.Read(input); + if (optionalFloatWrapper_ == null || value != 0F) { + OptionalFloatWrapper = value; + } + break; + } + case 1658: { + double? value = _single_optionalDoubleWrapper_codec.Read(input); + if (optionalDoubleWrapper_ == null || value != 0D) { + OptionalDoubleWrapper = value; + } + break; + } + case 1666: { + string value = _single_optionalStringWrapper_codec.Read(input); + if (optionalStringWrapper_ == null || value != "") { + OptionalStringWrapper = value; + } + break; + } + case 1674: { + pb::ByteString value = _single_optionalBytesWrapper_codec.Read(input); + if (optionalBytesWrapper_ == null || value != pb::ByteString.Empty) { + OptionalBytesWrapper = value; + } + break; + } + case 1690: { + repeatedBoolWrapper_.AddEntriesFrom(input, _repeated_repeatedBoolWrapper_codec); + break; + } + case 1698: { + repeatedInt32Wrapper_.AddEntriesFrom(input, _repeated_repeatedInt32Wrapper_codec); + break; + } + case 1706: { + repeatedInt64Wrapper_.AddEntriesFrom(input, _repeated_repeatedInt64Wrapper_codec); + break; + } + case 1714: { + repeatedUint32Wrapper_.AddEntriesFrom(input, _repeated_repeatedUint32Wrapper_codec); + break; + } + case 1722: { + repeatedUint64Wrapper_.AddEntriesFrom(input, _repeated_repeatedUint64Wrapper_codec); + break; + } + case 1730: { + repeatedFloatWrapper_.AddEntriesFrom(input, _repeated_repeatedFloatWrapper_codec); + break; + } + case 1738: { + repeatedDoubleWrapper_.AddEntriesFrom(input, _repeated_repeatedDoubleWrapper_codec); + break; + } + case 1746: { + repeatedStringWrapper_.AddEntriesFrom(input, _repeated_repeatedStringWrapper_codec); + break; + } + case 1754: { + repeatedBytesWrapper_.AddEntriesFrom(input, _repeated_repeatedBytesWrapper_codec); + break; + } + case 2410: { + if (optionalDuration_ == null) { + optionalDuration_ = new global::Google.Protobuf.WellKnownTypes.Duration(); + } + input.ReadMessage(optionalDuration_); + break; + } + case 2418: { + if (optionalTimestamp_ == null) { + optionalTimestamp_ = new global::Google.Protobuf.WellKnownTypes.Timestamp(); + } + input.ReadMessage(optionalTimestamp_); + break; + } + case 2426: { + if (optionalFieldMask_ == null) { + optionalFieldMask_ = new global::Google.Protobuf.WellKnownTypes.FieldMask(); + } + input.ReadMessage(optionalFieldMask_); + break; + } + case 2434: { + if (optionalStruct_ == null) { + optionalStruct_ = new global::Google.Protobuf.WellKnownTypes.Struct(); + } + input.ReadMessage(optionalStruct_); + break; + } + case 2442: { + if (optionalAny_ == null) { + optionalAny_ = new global::Google.Protobuf.WellKnownTypes.Any(); + } + input.ReadMessage(optionalAny_); + break; + } + case 2450: { + if (optionalValue_ == null) { + optionalValue_ = new global::Google.Protobuf.WellKnownTypes.Value(); + } + input.ReadMessage(optionalValue_); + break; + } + case 2490: { + repeatedDuration_.AddEntriesFrom(input, _repeated_repeatedDuration_codec); + break; + } + case 2498: { + repeatedTimestamp_.AddEntriesFrom(input, _repeated_repeatedTimestamp_codec); + break; + } + case 2506: { + repeatedFieldmask_.AddEntriesFrom(input, _repeated_repeatedFieldmask_codec); + break; + } + case 2522: { + repeatedAny_.AddEntriesFrom(input, _repeated_repeatedAny_codec); + break; + } + case 2530: { + repeatedValue_.AddEntriesFrom(input, _repeated_repeatedValue_codec); + break; + } + case 2594: { + repeatedStruct_.AddEntriesFrom(input, _repeated_repeatedStruct_codec); + break; + } + case 3208: { + Fieldname1 = input.ReadInt32(); + break; + } + case 3216: { + FieldName2 = input.ReadInt32(); + break; + } + case 3224: { + FieldName3 = input.ReadInt32(); + break; + } + case 3232: { + FieldName4 = input.ReadInt32(); + break; + } + case 3240: { + Field0Name5 = input.ReadInt32(); + break; + } + case 3248: { + Field0Name6 = input.ReadInt32(); + break; + } + case 3256: { + FieldName7 = input.ReadInt32(); + break; + } + case 3264: { + FieldName8 = input.ReadInt32(); + break; + } + case 3272: { + FieldName9 = input.ReadInt32(); + break; + } + case 3280: { + FieldName10 = input.ReadInt32(); + break; + } + case 3288: { + FIELDNAME11 = input.ReadInt32(); + break; + } + case 3296: { + FIELDName12 = input.ReadInt32(); + break; + } + case 3304: { + FieldName13 = input.ReadInt32(); + break; + } + case 3312: { + FieldName14 = input.ReadInt32(); + break; + } + case 3320: { + FieldName15 = input.ReadInt32(); + break; + } + case 3328: { + FieldName16 = input.ReadInt32(); + break; + } + case 3336: { + FieldName17 = input.ReadInt32(); + break; + } + case 3344: { + FieldName18 = input.ReadInt32(); + break; + } + } + } + } + + #region Nested types + /// Container for nested types declared in the TestAllTypes message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public enum NestedEnum { + [pbr::OriginalName("FOO")] Foo = 0, + [pbr::OriginalName("BAR")] Bar = 1, + [pbr::OriginalName("BAZ")] Baz = 2, + /// + /// Intentionally negative. + /// + [pbr::OriginalName("NEG")] Neg = -1, + } + + public sealed partial class NestedMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto3.TestAllTypes.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedMessage(NestedMessage other) : this() { + a_ = other.a_; + Corecursive = other.corecursive_ != null ? other.Corecursive.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedMessage Clone() { + return new NestedMessage(this); + } + + /// Field number for the "a" field. + public const int AFieldNumber = 1; + private int a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int A { + get { return a_; } + set { + a_ = value; + } + } + + /// Field number for the "corecursive" field. + public const int CorecursiveFieldNumber = 2; + private global::ProtobufTestMessages.Proto3.TestAllTypes corecursive_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::ProtobufTestMessages.Proto3.TestAllTypes Corecursive { + get { return corecursive_; } + set { + corecursive_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as NestedMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(NestedMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (A != other.A) return false; + if (!object.Equals(Corecursive, other.Corecursive)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (A != 0) hash ^= A.GetHashCode(); + if (corecursive_ != null) hash ^= Corecursive.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (A != 0) { + output.WriteRawTag(8); + output.WriteInt32(A); + } + if (corecursive_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Corecursive); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (A != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(A); + } + if (corecursive_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Corecursive); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(NestedMessage other) { + if (other == null) { + return; + } + if (other.A != 0) { + A = other.A; + } + if (other.corecursive_ != null) { + if (corecursive_ == null) { + corecursive_ = new global::ProtobufTestMessages.Proto3.TestAllTypes(); + } + Corecursive.MergeFrom(other.Corecursive); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + A = input.ReadInt32(); + break; + } + case 18: { + if (corecursive_ == null) { + corecursive_ = new global::ProtobufTestMessages.Proto3.TestAllTypes(); + } + input.ReadMessage(corecursive_); + break; + } + } + } + } + + } + + } + #endregion + + } + + public sealed partial class ForeignMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ForeignMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::ProtobufTestMessages.Proto3.TestMessagesProto3Reflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ForeignMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ForeignMessage(ForeignMessage other) : this() { + c_ = other.c_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ForeignMessage Clone() { + return new ForeignMessage(this); + } + + /// Field number for the "c" field. + public const int CFieldNumber = 1; + private int c_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int C { + get { return c_; } + set { + c_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ForeignMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ForeignMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (C != other.C) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (C != 0) hash ^= C.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (C != 0) { + output.WriteRawTag(8); + output.WriteInt32(C); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (C != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(C); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ForeignMessage other) { + if (other == null) { + return; + } + if (other.C != 0) { + C = other.C; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + C = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs new file mode 100644 index 0000000000..e21ede9c54 --- /dev/null +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs @@ -0,0 +1,2625 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: unittest_custom_options_proto3.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace UnitTest.Issues.TestProtos { + + /// Holder for reflection information generated from unittest_custom_options_proto3.proto + public static partial class UnittestCustomOptionsProto3Reflection { + + #region Descriptor + /// File descriptor for unittest_custom_options_proto3.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static UnittestCustomOptionsProto3Reflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiR1bml0dGVzdF9jdXN0b21fb3B0aW9uc19wcm90bzMucHJvdG8SEXByb3Rv", + "YnVmX3VuaXR0ZXN0GiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90", + "byLXAQocVGVzdE1lc3NhZ2VXaXRoQ3VzdG9tT3B0aW9ucxIeCgZmaWVsZDEY", + "ASABKAlCDggBweDDHS3hdQoCAAAAEhUKC29uZW9mX2ZpZWxkGAIgASgFSAAi", + "UwoGQW5FbnVtEhYKEkFORU5VTV9VTlNQRUNJRklFRBAAEg8KC0FORU5VTV9W", + "QUwxEAESFgoLQU5FTlVNX1ZBTDIQAhoFsIb6BXsaCMX2yR3r/P//OhAIAODp", + "wh3I//////////8BQhkKB0FuT25lb2YSDviswx2d//////////8BIhgKFkN1", + "c3RvbU9wdGlvbkZvb1JlcXVlc3QiGQoXQ3VzdG9tT3B0aW9uRm9vUmVzcG9u", + "c2UiHgocQ3VzdG9tT3B0aW9uRm9vQ2xpZW50TWVzc2FnZSIeChxDdXN0b21P", + "cHRpb25Gb29TZXJ2ZXJNZXNzYWdlIo8BChpEdW1teU1lc3NhZ2VDb250YWlu", + "aW5nRW51bSJxCgxUZXN0RW51bVR5cGUSIAocVEVTVF9PUFRJT05fRU5VTV9V", + "TlNQRUNJRklFRBAAEhoKFlRFU1RfT1BUSU9OX0VOVU1fVFlQRTEQFhIjChZU", + "RVNUX09QVElPTl9FTlVNX1RZUEUyEOn//////////wEiIQofRHVtbXlNZXNz", + "YWdlSW52YWxpZEFzT3B0aW9uVHlwZSKKAQocQ3VzdG9tT3B0aW9uTWluSW50", + "ZWdlclZhbHVlczpq0N6yHQDoxrIdgICAgPj/////AbC8sh2AgICAgICAgIAB", + "gJOyHQD49bAdAIDEsB3/////D/iXsB3///////////8BnfWvHQAAAACR7q8d", + "AAAAAAAAAACtja8dAAAAgJnWqB0AAAAAAAAAgCKRAQocQ3VzdG9tT3B0aW9u", + "TWF4SW50ZWdlclZhbHVlczpx0N6yHQHoxrId/////wewvLId//////////9/", + "gJOyHf////8P+PWwHf///////////wGAxLAd/v///w/4l7Ad/v//////////", + "AZ31rx3/////ke6vHf//////////rY2vHf///3+Z1qgd/////////38ibgoX", + "Q3VzdG9tT3B0aW9uT3RoZXJWYWx1ZXM6U+jGsh2c//////////8B9d+jHeeH", + "RUHp3KId+1mMQsrA8z+q3KIdDkhlbGxvLCAiV29ybGQistmiHQtIZWxsbwBX", + "b3JsZIjZoh3p//////////8BIjQKHFNldHRpbmdSZWFsc0Zyb21Qb3NpdGl2", + "ZUludHM6FPXfox0AAEBB6dyiHQAAAAAAQGNAIjQKHFNldHRpbmdSZWFsc0Zy", + "b21OZWdhdGl2ZUludHM6FPXfox0AAEDB6dyiHQAAAAAAQGPAIksKEkNvbXBs", + "ZXhPcHRpb25UeXBlMRILCgNmb28YASABKAUSDAoEZm9vMhgCIAEoBRIMCgRm", + "b28zGAMgASgFEgwKBGZvbzQYBCADKAUigQMKEkNvbXBsZXhPcHRpb25UeXBl", + "MhIyCgNiYXIYASABKAsyJS5wcm90b2J1Zl91bml0dGVzdC5Db21wbGV4T3B0", + "aW9uVHlwZTESCwoDYmF6GAIgASgFEkYKBGZyZWQYAyABKAsyOC5wcm90b2J1", + "Zl91bml0dGVzdC5Db21wbGV4T3B0aW9uVHlwZTIuQ29tcGxleE9wdGlvblR5", + "cGU0EkgKBmJhcm5leRgEIAMoCzI4LnByb3RvYnVmX3VuaXR0ZXN0LkNvbXBs", + "ZXhPcHRpb25UeXBlMi5Db21wbGV4T3B0aW9uVHlwZTQalwEKEkNvbXBsZXhP", + "cHRpb25UeXBlNBINCgV3YWxkbxgBIAEoBTJyCgxjb21wbGV4X29wdDQSHy5n", + "b29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYivXRAyABKAsyOC5wcm90", + "b2J1Zl91bml0dGVzdC5Db21wbGV4T3B0aW9uVHlwZTIuQ29tcGxleE9wdGlv", + "blR5cGU0IiEKEkNvbXBsZXhPcHRpb25UeXBlMxILCgNxdXgYASABKAUibAoV", + "VmFyaW91c0NvbXBsZXhPcHRpb25zOlOi4pUdAggqouKVHQIgY6LilR0CIFiq", + "/ZAdAxDbB6r9kB0FCgMI5wXSqI8dAwizD6r9kB0FGgMIwQKq/ZAdBCICCGWq", + "/ZAdBSIDCNQB+t6QHQIICSJMCglBZ2dyZWdhdGUSCQoBaRgBIAEoBRIJCgFz", + "GAIgASgJEikKA3N1YhgDIAEoCzIcLnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3Jl", + "Z2F0ZSJZChBBZ2dyZWdhdGVNZXNzYWdlEikKCWZpZWxkbmFtZRgBIAEoBUIW", + "8qGHOxESD0ZpZWxkQW5ub3RhdGlvbjoawtGGOxUIZRIRTWVzc2FnZUFubm90", + "YXRpb24ilwEKEE5lc3RlZE9wdGlvblR5cGUaOwoNTmVzdGVkTWVzc2FnZRIi", + "CgxuZXN0ZWRfZmllbGQYASABKAVCDMHgwx3qAwAAAAAAADoG4OnCHekHIkYK", + "Ck5lc3RlZEVudW0SDwoLVU5TUEVDSUZJRUQQABIdChFORVNURURfRU5VTV9W", + "QUxVRRABGgawhvoF7AcaCMX2yR3rAwAAKlIKCk1ldGhvZE9wdDESGgoWTUVU", + "SE9ET1BUMV9VTlNQRUNJRklFRBAAEhMKD01FVEhPRE9QVDFfVkFMMRABEhMK", + "D01FVEhPRE9QVDFfVkFMMhACKl4KDUFnZ3JlZ2F0ZUVudW0SDwoLVU5TUEVD", + "SUZJRUQQABIlCgVWQUxVRRABGhrK/Ik7FRITRW51bVZhbHVlQW5ub3RhdGlv", + "bhoVkpWIOxASDkVudW1Bbm5vdGF0aW9uMo4BChxUZXN0U2VydmljZVdpdGhD", + "dXN0b21PcHRpb25zEmMKA0ZvbxIpLnByb3RvYnVmX3VuaXR0ZXN0LkN1c3Rv", + "bU9wdGlvbkZvb1JlcXVlc3QaKi5wcm90b2J1Zl91bml0dGVzdC5DdXN0b21P", + "cHRpb25Gb29SZXNwb25zZSIF4PqMHgIaCZCyix7T24DLSTKZAQoQQWdncmVn", + "YXRlU2VydmljZRJrCgZNZXRob2QSIy5wcm90b2J1Zl91bml0dGVzdC5BZ2dy", + "ZWdhdGVNZXNzYWdlGiMucHJvdG9idWZfdW5pdHRlc3QuQWdncmVnYXRlTWVz", + "c2FnZSIXysiWOxISEE1ldGhvZEFubm90YXRpb24aGMr7jjsTEhFTZXJ2aWNl", + "QW5ub3RhdGlvbjoyCglmaWxlX29wdDESHC5nb29nbGUucHJvdG9idWYuRmls", + "ZU9wdGlvbnMYjp3YAyABKAQ6OAoMbWVzc2FnZV9vcHQxEh8uZ29vZ2xlLnBy", + "b3RvYnVmLk1lc3NhZ2VPcHRpb25zGJyt2AMgASgFOjQKCmZpZWxkX29wdDES", + "HS5nb29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGIi82AMgASgGOjQKCm9u", + "ZW9mX29wdDESHS5nb29nbGUucHJvdG9idWYuT25lb2ZPcHRpb25zGM+12AMg", + "ASgFOjIKCWVudW1fb3B0MRIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9u", + "cxjontkDIAEoDzo8Cg9lbnVtX3ZhbHVlX29wdDESIS5nb29nbGUucHJvdG9i", + "dWYuRW51bVZhbHVlT3B0aW9ucxjmoF8gASgFOjgKDHNlcnZpY2Vfb3B0MRIf", + "Lmdvb2dsZS5wcm90b2J1Zi5TZXJ2aWNlT3B0aW9ucxiituEDIAEoEjpVCgtt", + "ZXRob2Rfb3B0MRIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGKzP", + "4QMgASgOMh0ucHJvdG9idWZfdW5pdHRlc3QuTWV0aG9kT3B0MTo0Cghib29s", + "X29wdBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjqq9YDIAEo", + "CDo1CglpbnQzMl9vcHQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlv", + "bnMY7ajWAyABKAU6NQoJaW50NjRfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1l", + "c3NhZ2VPcHRpb25zGMan1gMgASgDOjYKCnVpbnQzMl9vcHQSHy5nb29nbGUu", + "cHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYsKLWAyABKA06NgoKdWludDY0X29w", + "dBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjfjtYDIAEoBDo2", + "CgpzaW50MzJfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25z", + "GMCI1gMgASgROjYKCnNpbnQ2NF9vcHQSHy5nb29nbGUucHJvdG9idWYuTWVz", + "c2FnZU9wdGlvbnMY/4LWAyABKBI6NwoLZml4ZWQzMl9vcHQSHy5nb29nbGUu", + "cHJvdG9idWYuTWVzc2FnZU9wdGlvbnMY0/7VAyABKAc6NwoLZml4ZWQ2NF9v", + "cHQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMY4v3VAyABKAY6", + "OAoMc2ZpeGVkMzJfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRp", + "b25zGNXx1QMgASgPOjgKDHNmaXhlZDY0X29wdBIfLmdvb2dsZS5wcm90b2J1", + "Zi5NZXNzYWdlT3B0aW9ucxjjitUDIAEoEDo1CglmbG9hdF9vcHQSHy5nb29n", + "bGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMY/rvUAyABKAI6NgoKZG91Ymxl", + "X29wdBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjNq9QDIAEo", + "ATo2CgpzdHJpbmdfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRp", + "b25zGMWr1AMgASgJOjUKCWJ5dGVzX29wdBIfLmdvb2dsZS5wcm90b2J1Zi5N", + "ZXNzYWdlT3B0aW9ucxiWq9QDIAEoDDpwCghlbnVtX29wdBIfLmdvb2dsZS5w", + "cm90b2J1Zi5NZXNzYWdlT3B0aW9ucxiRq9QDIAEoDjI6LnByb3RvYnVmX3Vu", + "aXR0ZXN0LkR1bW15TWVzc2FnZUNvbnRhaW5pbmdFbnVtLlRlc3RFbnVtVHlw", + "ZTpwChBtZXNzYWdlX3R5cGVfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3Nh", + "Z2VPcHRpb25zGK/y0wMgASgLMjIucHJvdG9idWZfdW5pdHRlc3QuRHVtbXlN", + "ZXNzYWdlSW52YWxpZEFzT3B0aW9uVHlwZTpfCgxjb21wbGV4X29wdDESHy5n", + "b29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYpNzSAyABKAsyJS5wcm90", + "b2J1Zl91bml0dGVzdC5Db21wbGV4T3B0aW9uVHlwZTE6XwoMY29tcGxleF9v", + "cHQyEh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGNWP0gMgASgL", + "MiUucHJvdG9idWZfdW5pdHRlc3QuQ29tcGxleE9wdGlvblR5cGUyOl8KDGNv", + "bXBsZXhfb3B0MxIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjv", + "i9IDIAEoCzIlLnByb3RvYnVmX3VuaXR0ZXN0LkNvbXBsZXhPcHRpb25UeXBl", + "MzpOCgdmaWxlb3B0EhwuZ29vZ2xlLnByb3RvYnVmLkZpbGVPcHRpb25zGM/d", + "sAcgASgLMhwucHJvdG9idWZfdW5pdHRlc3QuQWdncmVnYXRlOlAKBm1zZ29w", + "dBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxiY6rAHIAEoCzIc", + "LnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3JlZ2F0ZTpQCghmaWVsZG9wdBIdLmdv", + "b2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMYnvSwByABKAsyHC5wcm90b2J1", + "Zl91bml0dGVzdC5BZ2dyZWdhdGU6TgoHZW51bW9wdBIcLmdvb2dsZS5wcm90", + "b2J1Zi5FbnVtT3B0aW9ucxjSgrEHIAEoCzIcLnByb3RvYnVmX3VuaXR0ZXN0", + "LkFnZ3JlZ2F0ZTpWCgplbnVtdmFsb3B0EiEuZ29vZ2xlLnByb3RvYnVmLkVu", + "dW1WYWx1ZU9wdGlvbnMYyZ+xByABKAsyHC5wcm90b2J1Zl91bml0dGVzdC5B", + "Z2dyZWdhdGU6VAoKc2VydmljZW9wdBIfLmdvb2dsZS5wcm90b2J1Zi5TZXJ2", + "aWNlT3B0aW9ucxi577EHIAEoCzIcLnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3Jl", + "Z2F0ZTpSCgltZXRob2RvcHQSHi5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0", + "aW9ucxiJ6bIHIAEoCzIcLnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3JlZ2F0ZUJV", + "qgIaVW5pdFRlc3QuSXNzdWVzLlRlc3RQcm90b3Pw6MEd6q3A5ST67IU7Kghk", + "Eg5GaWxlQW5ub3RhdGlvbhoWEhROZXN0ZWRGaWxlQW5ub3RhdGlvbmIGcHJv", + "dG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { pbr::FileDescriptor.DescriptorProtoFileDescriptor, }, + new pbr::GeneratedClrTypeInfo(new[] {typeof(global::UnitTest.Issues.TestProtos.MethodOpt1), typeof(global::UnitTest.Issues.TestProtos.AggregateEnum), }, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions), global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions.Parser, new[]{ "Field1", "OneofField" }, new[]{ "AnOneof" }, new[]{ typeof(global::UnitTest.Issues.TestProtos.TestMessageWithCustomOptions.Types.AnEnum) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooRequest), global::UnitTest.Issues.TestProtos.CustomOptionFooRequest.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooResponse), global::UnitTest.Issues.TestProtos.CustomOptionFooResponse.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooClientMessage), global::UnitTest.Issues.TestProtos.CustomOptionFooClientMessage.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionFooServerMessage), global::UnitTest.Issues.TestProtos.CustomOptionFooServerMessage.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum), global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Parser, null, null, new[]{ typeof(global::UnitTest.Issues.TestProtos.DummyMessageContainingEnum.Types.TestEnumType) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType), global::UnitTest.Issues.TestProtos.DummyMessageInvalidAsOptionType.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionMinIntegerValues), global::UnitTest.Issues.TestProtos.CustomOptionMinIntegerValues.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionMaxIntegerValues), global::UnitTest.Issues.TestProtos.CustomOptionMaxIntegerValues.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.CustomOptionOtherValues), global::UnitTest.Issues.TestProtos.CustomOptionOtherValues.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.SettingRealsFromPositiveInts), global::UnitTest.Issues.TestProtos.SettingRealsFromPositiveInts.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.SettingRealsFromNegativeInts), global::UnitTest.Issues.TestProtos.SettingRealsFromNegativeInts.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType1), global::UnitTest.Issues.TestProtos.ComplexOptionType1.Parser, new[]{ "Foo", "Foo2", "Foo3", "Foo4" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType2), global::UnitTest.Issues.TestProtos.ComplexOptionType2.Parser, new[]{ "Bar", "Baz", "Fred", "Barney" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4), global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Parser, new[]{ "Waldo" }, null, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.ComplexOptionType3), global::UnitTest.Issues.TestProtos.ComplexOptionType3.Parser, new[]{ "Qux" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.VariousComplexOptions), global::UnitTest.Issues.TestProtos.VariousComplexOptions.Parser, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.Aggregate), global::UnitTest.Issues.TestProtos.Aggregate.Parser, new[]{ "I", "S", "Sub" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.AggregateMessage), global::UnitTest.Issues.TestProtos.AggregateMessage.Parser, new[]{ "Fieldname" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NestedOptionType), global::UnitTest.Issues.TestProtos.NestedOptionType.Parser, null, null, new[]{ typeof(global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedEnum) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedMessage), global::UnitTest.Issues.TestProtos.NestedOptionType.Types.NestedMessage.Parser, new[]{ "NestedField" }, null, null, null)}) + })); + } + #endregion + + } + #region Enums + public enum MethodOpt1 { + [pbr::OriginalName("METHODOPT1_UNSPECIFIED")] Unspecified = 0, + [pbr::OriginalName("METHODOPT1_VAL1")] Val1 = 1, + [pbr::OriginalName("METHODOPT1_VAL2")] Val2 = 2, + } + + public enum AggregateEnum { + [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0, + [pbr::OriginalName("VALUE")] Value = 1, + } + + #endregion + + #region Messages + /// + /// A test message with custom options at all possible locations (and also some + /// regular options, to make sure they interact nicely). + /// + public sealed partial class TestMessageWithCustomOptions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMessageWithCustomOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestMessageWithCustomOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestMessageWithCustomOptions(TestMessageWithCustomOptions other) : this() { + field1_ = other.field1_; + switch (other.AnOneofCase) { + case AnOneofOneofCase.OneofField: + OneofField = other.OneofField; + break; + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestMessageWithCustomOptions Clone() { + return new TestMessageWithCustomOptions(this); + } + + /// Field number for the "field1" field. + public const int Field1FieldNumber = 1; + private string field1_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Field1 { + get { return field1_; } + set { + field1_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "oneof_field" field. + public const int OneofFieldFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int OneofField { + get { return anOneofCase_ == AnOneofOneofCase.OneofField ? (int) anOneof_ : 0; } + set { + anOneof_ = value; + anOneofCase_ = AnOneofOneofCase.OneofField; + } + } + + private object anOneof_; + /// Enum of possible cases for the "AnOneof" oneof. + public enum AnOneofOneofCase { + None = 0, + OneofField = 2, + } + private AnOneofOneofCase anOneofCase_ = AnOneofOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AnOneofOneofCase AnOneofCase { + get { return anOneofCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearAnOneof() { + anOneofCase_ = AnOneofOneofCase.None; + anOneof_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestMessageWithCustomOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestMessageWithCustomOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Field1 != other.Field1) return false; + if (OneofField != other.OneofField) return false; + if (AnOneofCase != other.AnOneofCase) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Field1.Length != 0) hash ^= Field1.GetHashCode(); + if (anOneofCase_ == AnOneofOneofCase.OneofField) hash ^= OneofField.GetHashCode(); + hash ^= (int) anOneofCase_; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Field1.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Field1); + } + if (anOneofCase_ == AnOneofOneofCase.OneofField) { + output.WriteRawTag(16); + output.WriteInt32(OneofField); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Field1.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Field1); + } + if (anOneofCase_ == AnOneofOneofCase.OneofField) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(OneofField); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestMessageWithCustomOptions other) { + if (other == null) { + return; + } + if (other.Field1.Length != 0) { + Field1 = other.Field1; + } + switch (other.AnOneofCase) { + case AnOneofOneofCase.OneofField: + OneofField = other.OneofField; + break; + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Field1 = input.ReadString(); + break; + } + case 16: { + OneofField = input.ReadInt32(); + break; + } + } + } + } + + #region Nested types + /// Container for nested types declared in the TestMessageWithCustomOptions message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public enum AnEnum { + [pbr::OriginalName("ANENUM_UNSPECIFIED")] Unspecified = 0, + [pbr::OriginalName("ANENUM_VAL1")] Val1 = 1, + [pbr::OriginalName("ANENUM_VAL2")] Val2 = 2, + } + + } + #endregion + + } + + /// + /// A test RPC service with custom options at all possible locations (and also + /// some regular options, to make sure they interact nicely). + /// + public sealed partial class CustomOptionFooRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[1]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooRequest(CustomOptionFooRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooRequest Clone() { + return new CustomOptionFooRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionFooRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionFooRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionFooRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class CustomOptionFooResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[2]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooResponse(CustomOptionFooResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooResponse Clone() { + return new CustomOptionFooResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionFooResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionFooResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionFooResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class CustomOptionFooClientMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooClientMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[3]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooClientMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooClientMessage(CustomOptionFooClientMessage other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooClientMessage Clone() { + return new CustomOptionFooClientMessage(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionFooClientMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionFooClientMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionFooClientMessage other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class CustomOptionFooServerMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionFooServerMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooServerMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooServerMessage(CustomOptionFooServerMessage other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionFooServerMessage Clone() { + return new CustomOptionFooServerMessage(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionFooServerMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionFooServerMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionFooServerMessage other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class DummyMessageContainingEnum : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DummyMessageContainingEnum()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[5]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DummyMessageContainingEnum() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DummyMessageContainingEnum(DummyMessageContainingEnum other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DummyMessageContainingEnum Clone() { + return new DummyMessageContainingEnum(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DummyMessageContainingEnum); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DummyMessageContainingEnum other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DummyMessageContainingEnum other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + #region Nested types + /// Container for nested types declared in the DummyMessageContainingEnum message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public enum TestEnumType { + [pbr::OriginalName("TEST_OPTION_ENUM_UNSPECIFIED")] TestOptionEnumUnspecified = 0, + [pbr::OriginalName("TEST_OPTION_ENUM_TYPE1")] TestOptionEnumType1 = 22, + [pbr::OriginalName("TEST_OPTION_ENUM_TYPE2")] TestOptionEnumType2 = -23, + } + + } + #endregion + + } + + public sealed partial class DummyMessageInvalidAsOptionType : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DummyMessageInvalidAsOptionType()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DummyMessageInvalidAsOptionType() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DummyMessageInvalidAsOptionType(DummyMessageInvalidAsOptionType other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public DummyMessageInvalidAsOptionType Clone() { + return new DummyMessageInvalidAsOptionType(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as DummyMessageInvalidAsOptionType); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(DummyMessageInvalidAsOptionType other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(DummyMessageInvalidAsOptionType other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class CustomOptionMinIntegerValues : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionMinIntegerValues()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[7]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionMinIntegerValues() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionMinIntegerValues(CustomOptionMinIntegerValues other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionMinIntegerValues Clone() { + return new CustomOptionMinIntegerValues(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionMinIntegerValues); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionMinIntegerValues other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionMinIntegerValues other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class CustomOptionMaxIntegerValues : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionMaxIntegerValues()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[8]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionMaxIntegerValues() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionMaxIntegerValues(CustomOptionMaxIntegerValues other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionMaxIntegerValues Clone() { + return new CustomOptionMaxIntegerValues(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionMaxIntegerValues); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionMaxIntegerValues other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionMaxIntegerValues other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class CustomOptionOtherValues : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new CustomOptionOtherValues()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[9]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionOtherValues() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionOtherValues(CustomOptionOtherValues other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CustomOptionOtherValues Clone() { + return new CustomOptionOtherValues(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CustomOptionOtherValues); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CustomOptionOtherValues other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CustomOptionOtherValues other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class SettingRealsFromPositiveInts : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SettingRealsFromPositiveInts()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SettingRealsFromPositiveInts() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SettingRealsFromPositiveInts(SettingRealsFromPositiveInts other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SettingRealsFromPositiveInts Clone() { + return new SettingRealsFromPositiveInts(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SettingRealsFromPositiveInts); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SettingRealsFromPositiveInts other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SettingRealsFromPositiveInts other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class SettingRealsFromNegativeInts : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SettingRealsFromNegativeInts()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SettingRealsFromNegativeInts() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SettingRealsFromNegativeInts(SettingRealsFromNegativeInts other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public SettingRealsFromNegativeInts Clone() { + return new SettingRealsFromNegativeInts(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as SettingRealsFromNegativeInts); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(SettingRealsFromNegativeInts other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(SettingRealsFromNegativeInts other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + public sealed partial class ComplexOptionType1 : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType1()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType1() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType1(ComplexOptionType1 other) : this() { + foo_ = other.foo_; + foo2_ = other.foo2_; + foo3_ = other.foo3_; + foo4_ = other.foo4_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType1 Clone() { + return new ComplexOptionType1(this); + } + + /// Field number for the "foo" field. + public const int FooFieldNumber = 1; + private int foo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Foo { + get { return foo_; } + set { + foo_ = value; + } + } + + /// Field number for the "foo2" field. + public const int Foo2FieldNumber = 2; + private int foo2_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Foo2 { + get { return foo2_; } + set { + foo2_ = value; + } + } + + /// Field number for the "foo3" field. + public const int Foo3FieldNumber = 3; + private int foo3_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Foo3 { + get { return foo3_; } + set { + foo3_ = value; + } + } + + /// Field number for the "foo4" field. + public const int Foo4FieldNumber = 4; + private static readonly pb::FieldCodec _repeated_foo4_codec + = pb::FieldCodec.ForInt32(34); + private readonly pbc::RepeatedField foo4_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Foo4 { + get { return foo4_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ComplexOptionType1); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ComplexOptionType1 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Foo != other.Foo) return false; + if (Foo2 != other.Foo2) return false; + if (Foo3 != other.Foo3) return false; + if(!foo4_.Equals(other.foo4_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Foo != 0) hash ^= Foo.GetHashCode(); + if (Foo2 != 0) hash ^= Foo2.GetHashCode(); + if (Foo3 != 0) hash ^= Foo3.GetHashCode(); + hash ^= foo4_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Foo != 0) { + output.WriteRawTag(8); + output.WriteInt32(Foo); + } + if (Foo2 != 0) { + output.WriteRawTag(16); + output.WriteInt32(Foo2); + } + if (Foo3 != 0) { + output.WriteRawTag(24); + output.WriteInt32(Foo3); + } + foo4_.WriteTo(output, _repeated_foo4_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Foo != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Foo); + } + if (Foo2 != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Foo2); + } + if (Foo3 != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Foo3); + } + size += foo4_.CalculateSize(_repeated_foo4_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ComplexOptionType1 other) { + if (other == null) { + return; + } + if (other.Foo != 0) { + Foo = other.Foo; + } + if (other.Foo2 != 0) { + Foo2 = other.Foo2; + } + if (other.Foo3 != 0) { + Foo3 = other.Foo3; + } + foo4_.Add(other.foo4_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Foo = input.ReadInt32(); + break; + } + case 16: { + Foo2 = input.ReadInt32(); + break; + } + case 24: { + Foo3 = input.ReadInt32(); + break; + } + case 34: + case 32: { + foo4_.AddEntriesFrom(input, _repeated_foo4_codec); + break; + } + } + } + } + + } + + public sealed partial class ComplexOptionType2 : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType2()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType2() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType2(ComplexOptionType2 other) : this() { + Bar = other.bar_ != null ? other.Bar.Clone() : null; + baz_ = other.baz_; + Fred = other.fred_ != null ? other.Fred.Clone() : null; + barney_ = other.barney_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType2 Clone() { + return new ComplexOptionType2(this); + } + + /// Field number for the "bar" field. + public const int BarFieldNumber = 1; + private global::UnitTest.Issues.TestProtos.ComplexOptionType1 bar_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::UnitTest.Issues.TestProtos.ComplexOptionType1 Bar { + get { return bar_; } + set { + bar_ = value; + } + } + + /// Field number for the "baz" field. + public const int BazFieldNumber = 2; + private int baz_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Baz { + get { return baz_; } + set { + baz_ = value; + } + } + + /// Field number for the "fred" field. + public const int FredFieldNumber = 3; + private global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 fred_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 Fred { + get { return fred_; } + set { + fred_ = value; + } + } + + /// Field number for the "barney" field. + public const int BarneyFieldNumber = 4; + private static readonly pb::FieldCodec _repeated_barney_codec + = pb::FieldCodec.ForMessage(34, global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Parser); + private readonly pbc::RepeatedField barney_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField Barney { + get { return barney_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ComplexOptionType2); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ComplexOptionType2 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Bar, other.Bar)) return false; + if (Baz != other.Baz) return false; + if (!object.Equals(Fred, other.Fred)) return false; + if(!barney_.Equals(other.barney_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (bar_ != null) hash ^= Bar.GetHashCode(); + if (Baz != 0) hash ^= Baz.GetHashCode(); + if (fred_ != null) hash ^= Fred.GetHashCode(); + hash ^= barney_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (bar_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Bar); + } + if (Baz != 0) { + output.WriteRawTag(16); + output.WriteInt32(Baz); + } + if (fred_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Fred); + } + barney_.WriteTo(output, _repeated_barney_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (bar_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Bar); + } + if (Baz != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Baz); + } + if (fred_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Fred); + } + size += barney_.CalculateSize(_repeated_barney_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ComplexOptionType2 other) { + if (other == null) { + return; + } + if (other.bar_ != null) { + if (bar_ == null) { + bar_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType1(); + } + Bar.MergeFrom(other.Bar); + } + if (other.Baz != 0) { + Baz = other.Baz; + } + if (other.fred_ != null) { + if (fred_ == null) { + fred_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4(); + } + Fred.MergeFrom(other.Fred); + } + barney_.Add(other.barney_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (bar_ == null) { + bar_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType1(); + } + input.ReadMessage(bar_); + break; + } + case 16: { + Baz = input.ReadInt32(); + break; + } + case 26: { + if (fred_ == null) { + fred_ = new global::UnitTest.Issues.TestProtos.ComplexOptionType2.Types.ComplexOptionType4(); + } + input.ReadMessage(fred_); + break; + } + case 34: { + barney_.AddEntriesFrom(input, _repeated_barney_codec); + break; + } + } + } + } + + #region Nested types + /// Container for nested types declared in the ComplexOptionType2 message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public sealed partial class ComplexOptionType4 : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType4()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.ComplexOptionType2.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType4() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType4(ComplexOptionType4 other) : this() { + waldo_ = other.waldo_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType4 Clone() { + return new ComplexOptionType4(this); + } + + /// Field number for the "waldo" field. + public const int WaldoFieldNumber = 1; + private int waldo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Waldo { + get { return waldo_; } + set { + waldo_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ComplexOptionType4); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ComplexOptionType4 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Waldo != other.Waldo) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Waldo != 0) hash ^= Waldo.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Waldo != 0) { + output.WriteRawTag(8); + output.WriteInt32(Waldo); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Waldo != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Waldo); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ComplexOptionType4 other) { + if (other == null) { + return; + } + if (other.Waldo != 0) { + Waldo = other.Waldo; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Waldo = input.ReadInt32(); + break; + } + } + } + } + + } + + } + #endregion + + } + + public sealed partial class ComplexOptionType3 : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ComplexOptionType3()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[14]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType3() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType3(ComplexOptionType3 other) : this() { + qux_ = other.qux_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ComplexOptionType3 Clone() { + return new ComplexOptionType3(this); + } + + /// Field number for the "qux" field. + public const int QuxFieldNumber = 1; + private int qux_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Qux { + get { return qux_; } + set { + qux_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ComplexOptionType3); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ComplexOptionType3 other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Qux != other.Qux) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Qux != 0) hash ^= Qux.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Qux != 0) { + output.WriteRawTag(8); + output.WriteInt32(Qux); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Qux != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Qux); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ComplexOptionType3 other) { + if (other == null) { + return; + } + if (other.Qux != 0) { + Qux = other.Qux; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Qux = input.ReadInt32(); + break; + } + } + } + } + + } + + /// + /// Note that we try various different ways of naming the same extension. + /// + public sealed partial class VariousComplexOptions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new VariousComplexOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[15]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public VariousComplexOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public VariousComplexOptions(VariousComplexOptions other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public VariousComplexOptions Clone() { + return new VariousComplexOptions(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as VariousComplexOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(VariousComplexOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(VariousComplexOptions other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + /// + /// A helper type used to test aggregate option parsing + /// + public sealed partial class Aggregate : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Aggregate()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[16]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Aggregate() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Aggregate(Aggregate other) : this() { + i_ = other.i_; + s_ = other.s_; + Sub = other.sub_ != null ? other.Sub.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public Aggregate Clone() { + return new Aggregate(this); + } + + /// Field number for the "i" field. + public const int IFieldNumber = 1; + private int i_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int I { + get { return i_; } + set { + i_ = value; + } + } + + /// Field number for the "s" field. + public const int SFieldNumber = 2; + private string s_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string S { + get { return s_; } + set { + s_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "sub" field. + public const int SubFieldNumber = 3; + private global::UnitTest.Issues.TestProtos.Aggregate sub_; + /// + /// A nested object + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::UnitTest.Issues.TestProtos.Aggregate Sub { + get { return sub_; } + set { + sub_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as Aggregate); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(Aggregate other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (I != other.I) return false; + if (S != other.S) return false; + if (!object.Equals(Sub, other.Sub)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (I != 0) hash ^= I.GetHashCode(); + if (S.Length != 0) hash ^= S.GetHashCode(); + if (sub_ != null) hash ^= Sub.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (I != 0) { + output.WriteRawTag(8); + output.WriteInt32(I); + } + if (S.Length != 0) { + output.WriteRawTag(18); + output.WriteString(S); + } + if (sub_ != null) { + output.WriteRawTag(26); + output.WriteMessage(Sub); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (I != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(I); + } + if (S.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(S); + } + if (sub_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Sub); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(Aggregate other) { + if (other == null) { + return; + } + if (other.I != 0) { + I = other.I; + } + if (other.S.Length != 0) { + S = other.S; + } + if (other.sub_ != null) { + if (sub_ == null) { + sub_ = new global::UnitTest.Issues.TestProtos.Aggregate(); + } + Sub.MergeFrom(other.Sub); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + I = input.ReadInt32(); + break; + } + case 18: { + S = input.ReadString(); + break; + } + case 26: { + if (sub_ == null) { + sub_ = new global::UnitTest.Issues.TestProtos.Aggregate(); + } + input.ReadMessage(sub_); + break; + } + } + } + } + + } + + public sealed partial class AggregateMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AggregateMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[17]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AggregateMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AggregateMessage(AggregateMessage other) : this() { + fieldname_ = other.fieldname_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public AggregateMessage Clone() { + return new AggregateMessage(this); + } + + /// Field number for the "fieldname" field. + public const int FieldnameFieldNumber = 1; + private int fieldname_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Fieldname { + get { return fieldname_; } + set { + fieldname_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as AggregateMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(AggregateMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Fieldname != other.Fieldname) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Fieldname != 0) hash ^= Fieldname.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Fieldname != 0) { + output.WriteRawTag(8); + output.WriteInt32(Fieldname); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Fieldname != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Fieldname); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(AggregateMessage other) { + if (other == null) { + return; + } + if (other.Fieldname != 0) { + Fieldname = other.Fieldname; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Fieldname = input.ReadInt32(); + break; + } + } + } + } + + } + + /// + /// Test custom options for nested type. + /// + public sealed partial class NestedOptionType : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedOptionType()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnittestCustomOptionsProto3Reflection.Descriptor.MessageTypes[18]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedOptionType() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedOptionType(NestedOptionType other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedOptionType Clone() { + return new NestedOptionType(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as NestedOptionType); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(NestedOptionType other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(NestedOptionType other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + #region Nested types + /// Container for nested types declared in the NestedOptionType message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + public enum NestedEnum { + [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0, + [pbr::OriginalName("NESTED_ENUM_VALUE")] Value = 1, + } + + public sealed partial class NestedMessage : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.NestedOptionType.Descriptor.NestedTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedMessage(NestedMessage other) : this() { + nestedField_ = other.nestedField_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public NestedMessage Clone() { + return new NestedMessage(this); + } + + /// Field number for the "nested_field" field. + public const int NestedFieldFieldNumber = 1; + private int nestedField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int NestedField { + get { return nestedField_; } + set { + nestedField_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as NestedMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(NestedMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (NestedField != other.NestedField) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (NestedField != 0) hash ^= NestedField.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (NestedField != 0) { + output.WriteRawTag(8); + output.WriteInt32(NestedField); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (NestedField != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(NestedField); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(NestedMessage other) { + if (other == null) { + return; + } + if (other.NestedField != 0) { + NestedField = other.NestedField; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + NestedField = input.ReadInt32(); + break; + } + } + } + } + + } + + } + #endregion + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs index 263e17c021..f6df4e8726 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { /// Holder for reflection information generated from google/protobuf/unittest_import_proto3.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class UnittestImportProto3Reflection { #region Descriptor @@ -51,29 +50,34 @@ namespace Google.Protobuf.TestProtos { #endregion #region Messages - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ImportMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ImportMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ImportMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ImportMessage(ImportMessage other) : this() { d_ = other.d_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ImportMessage Clone() { return new ImportMessage(this); } @@ -81,6 +85,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "d" field. public const int DFieldNumber = 1; private int d_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int D { get { return d_; } set { @@ -88,10 +93,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ImportMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ImportMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -103,16 +110,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (D != 0) hash ^= D.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (D != 0) { output.WriteRawTag(8); @@ -120,6 +130,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (D != 0) { @@ -128,6 +139,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ImportMessage other) { if (other == null) { return; @@ -137,6 +149,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs index b471a8cf1a..67b8edf464 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { /// Holder for reflection information generated from google/protobuf/unittest_import_public_proto3.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class UnittestImportPublicProto3Reflection { #region Descriptor @@ -37,29 +36,34 @@ namespace Google.Protobuf.TestProtos { } #region Messages - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class PublicImportMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PublicImportMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestImportPublicProto3Reflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PublicImportMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PublicImportMessage(PublicImportMessage other) : this() { e_ = other.e_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public PublicImportMessage Clone() { return new PublicImportMessage(this); } @@ -67,6 +71,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "e" field. public const int EFieldNumber = 1; private int e_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int E { get { return e_; } set { @@ -74,10 +79,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as PublicImportMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(PublicImportMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -89,16 +96,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (E != 0) hash ^= E.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (E != 0) { output.WriteRawTag(8); @@ -106,6 +116,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (E != 0) { @@ -114,6 +125,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(PublicImportMessage other) { if (other == null) { return; @@ -123,6 +135,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs index 7d4451b093..7c0ba8a677 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace UnitTest.Issues.TestProtos { /// Holder for reflection information generated from unittest_issues.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class UnittestIssuesReflection { #region Descriptor @@ -80,39 +79,46 @@ namespace UnitTest.Issues.TestProtos { #region Messages /// - /// Issue 307: when generating doubly-nested types, any references - /// should be of the form A.Types.B.Types.C. + /// Issue 307: when generating doubly-nested types, any references + /// should be of the form A.Types.B.Types.C. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Issue307 : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Issue307()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Issue307() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Issue307(Issue307 other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Issue307 Clone() { return new Issue307(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Issue307); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Issue307 other) { if (ReferenceEquals(other, null)) { return false; @@ -123,29 +129,35 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Issue307 other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -159,38 +171,45 @@ namespace UnitTest.Issues.TestProtos { #region Nested types /// Container for nested types declared in the Issue307 message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class NestedOnce : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedOnce()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.Issue307.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedOnce() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedOnce(NestedOnce other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedOnce Clone() { return new NestedOnce(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NestedOnce); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NestedOnce other) { if (ReferenceEquals(other, null)) { return false; @@ -201,29 +220,35 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NestedOnce other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -237,38 +262,45 @@ namespace UnitTest.Issues.TestProtos { #region Nested types /// Container for nested types declared in the NestedOnce message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class NestedTwice : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedTwice()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.Issue307.Types.NestedOnce.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTwice() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTwice(NestedTwice other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTwice Clone() { return new NestedTwice(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NestedTwice); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NestedTwice other) { if (ReferenceEquals(other, null)) { return false; @@ -279,29 +311,35 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NestedTwice other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -325,31 +363,36 @@ namespace UnitTest.Issues.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class NegativeEnumMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NegativeEnumMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NegativeEnumMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NegativeEnumMessage(NegativeEnumMessage other) : this() { value_ = other.value_; values_ = other.values_.Clone(); packedValues_ = other.packedValues_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NegativeEnumMessage Clone() { return new NegativeEnumMessage(this); } @@ -357,6 +400,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "value" field. public const int ValueFieldNumber = 1; private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::UnitTest.Issues.TestProtos.NegativeEnum Value { get { return value_; } set { @@ -369,6 +413,7 @@ namespace UnitTest.Issues.TestProtos { private static readonly pb::FieldCodec _repeated_values_codec = pb::FieldCodec.ForEnum(16, x => (int) x, x => (global::UnitTest.Issues.TestProtos.NegativeEnum) x); private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Values { get { return values_; } } @@ -378,14 +423,17 @@ namespace UnitTest.Issues.TestProtos { private static readonly pb::FieldCodec _repeated_packedValues_codec = pb::FieldCodec.ForEnum(26, x => (int) x, x => (global::UnitTest.Issues.TestProtos.NegativeEnum) x); private readonly pbc::RepeatedField packedValues_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedValues { get { return packedValues_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NegativeEnumMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NegativeEnumMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -399,6 +447,7 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Value != 0) hash ^= Value.GetHashCode(); @@ -407,10 +456,12 @@ namespace UnitTest.Issues.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Value != 0) { output.WriteRawTag(8); @@ -420,6 +471,7 @@ namespace UnitTest.Issues.TestProtos { packedValues_.WriteTo(output, _repeated_packedValues_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Value != 0) { @@ -430,6 +482,7 @@ namespace UnitTest.Issues.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NegativeEnumMessage other) { if (other == null) { return; @@ -441,6 +494,7 @@ namespace UnitTest.Issues.TestProtos { packedValues_.Add(other.packedValues_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -468,36 +522,43 @@ namespace UnitTest.Issues.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class DeprecatedChild : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeprecatedChild()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedChild() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedChild(DeprecatedChild other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedChild Clone() { return new DeprecatedChild(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as DeprecatedChild); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(DeprecatedChild other) { if (ReferenceEquals(other, null)) { return false; @@ -508,29 +569,35 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(DeprecatedChild other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -544,25 +611,29 @@ namespace UnitTest.Issues.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class DeprecatedFieldsMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DeprecatedFieldsMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[3]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedFieldsMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedFieldsMessage(DeprecatedFieldsMessage other) : this() { primitiveValue_ = other.primitiveValue_; primitiveArray_ = other.primitiveArray_.Clone(); @@ -572,6 +643,7 @@ namespace UnitTest.Issues.TestProtos { enumArray_ = other.enumArray_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DeprecatedFieldsMessage Clone() { return new DeprecatedFieldsMessage(this); } @@ -579,7 +651,8 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "PrimitiveValue" field. public const int PrimitiveValueFieldNumber = 1; private int primitiveValue_; - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int PrimitiveValue { get { return primitiveValue_; } set { @@ -592,7 +665,8 @@ namespace UnitTest.Issues.TestProtos { private static readonly pb::FieldCodec _repeated_primitiveArray_codec = pb::FieldCodec.ForInt32(18); private readonly pbc::RepeatedField primitiveArray_ = new pbc::RepeatedField(); - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PrimitiveArray { get { return primitiveArray_; } } @@ -600,7 +674,8 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "MessageValue" field. public const int MessageValueFieldNumber = 3; private global::UnitTest.Issues.TestProtos.DeprecatedChild messageValue_; - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue { get { return messageValue_; } set { @@ -613,7 +688,8 @@ namespace UnitTest.Issues.TestProtos { private static readonly pb::FieldCodec _repeated_messageArray_codec = pb::FieldCodec.ForMessage(34, global::UnitTest.Issues.TestProtos.DeprecatedChild.Parser); private readonly pbc::RepeatedField messageArray_ = new pbc::RepeatedField(); - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField MessageArray { get { return messageArray_; } } @@ -621,7 +697,8 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "EnumValue" field. public const int EnumValueFieldNumber = 5; private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = 0; - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue { get { return enumValue_; } set { @@ -634,15 +711,18 @@ namespace UnitTest.Issues.TestProtos { private static readonly pb::FieldCodec _repeated_enumArray_codec = pb::FieldCodec.ForEnum(50, x => (int) x, x => (global::UnitTest.Issues.TestProtos.DeprecatedEnum) x); private readonly pbc::RepeatedField enumArray_ = new pbc::RepeatedField(); - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField EnumArray { get { return enumArray_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as DeprecatedFieldsMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(DeprecatedFieldsMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -659,6 +739,7 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (PrimitiveValue != 0) hash ^= PrimitiveValue.GetHashCode(); @@ -670,10 +751,12 @@ namespace UnitTest.Issues.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (PrimitiveValue != 0) { output.WriteRawTag(8); @@ -692,6 +775,7 @@ namespace UnitTest.Issues.TestProtos { enumArray_.WriteTo(output, _repeated_enumArray_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (PrimitiveValue != 0) { @@ -709,6 +793,7 @@ namespace UnitTest.Issues.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(DeprecatedFieldsMessage other) { if (other == null) { return; @@ -730,6 +815,7 @@ namespace UnitTest.Issues.TestProtos { enumArray_.Add(other.enumArray_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -773,31 +859,36 @@ namespace UnitTest.Issues.TestProtos { } /// - /// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 + /// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ItemField : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ItemField()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[4]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ItemField() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ItemField(ItemField other) : this() { item_ = other.item_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ItemField Clone() { return new ItemField(this); } @@ -805,6 +896,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "item" field. public const int ItemFieldNumber = 1; private int item_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Item { get { return item_; } set { @@ -812,10 +904,12 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ItemField); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ItemField other) { if (ReferenceEquals(other, null)) { return false; @@ -827,16 +921,19 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Item != 0) hash ^= Item.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Item != 0) { output.WriteRawTag(8); @@ -844,6 +941,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Item != 0) { @@ -852,6 +950,7 @@ namespace UnitTest.Issues.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ItemField other) { if (other == null) { return; @@ -861,6 +960,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -878,30 +978,35 @@ namespace UnitTest.Issues.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ReservedNames : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedNames()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[5]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedNames() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedNames(ReservedNames other) : this() { types_ = other.types_; descriptor_ = other.descriptor_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedNames Clone() { return new ReservedNames(this); } @@ -909,6 +1014,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "types" field. public const int Types_FieldNumber = 1; private int types_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Types_ { get { return types_; } set { @@ -919,6 +1025,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "descriptor" field. public const int Descriptor_FieldNumber = 2; private int descriptor_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Descriptor_ { get { return descriptor_; } set { @@ -926,10 +1033,12 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ReservedNames); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ReservedNames other) { if (ReferenceEquals(other, null)) { return false; @@ -942,6 +1051,7 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Types_ != 0) hash ^= Types_.GetHashCode(); @@ -949,10 +1059,12 @@ namespace UnitTest.Issues.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Types_ != 0) { output.WriteRawTag(8); @@ -964,6 +1076,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Types_ != 0) { @@ -975,6 +1088,7 @@ namespace UnitTest.Issues.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ReservedNames other) { if (other == null) { return; @@ -987,6 +1101,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1008,41 +1123,48 @@ namespace UnitTest.Issues.TestProtos { #region Nested types /// Container for nested types declared in the ReservedNames message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// Force a nested type called Types + /// Force a nested type called Types /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class SomeNestedType : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SomeNestedType()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.ReservedNames.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SomeNestedType() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SomeNestedType(SomeNestedType other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SomeNestedType Clone() { return new SomeNestedType(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SomeNestedType); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(SomeNestedType other) { if (ReferenceEquals(other, null)) { return false; @@ -1053,29 +1175,35 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(SomeNestedType other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1095,36 +1223,40 @@ namespace UnitTest.Issues.TestProtos { } /// - /// These fields are deliberately not declared in numeric - /// order, and the oneof fields aren't contiguous either. - /// This allows for reasonably robust tests of JSON output - /// ordering. - /// TestFieldOrderings in unittest_proto3.proto is similar, - /// but doesn't include oneofs. - /// TODO: Consider adding oneofs to TestFieldOrderings, although - /// that will require fixing other tests in multiple platforms. - /// Alternatively, consider just adding this to - /// unittest_proto3.proto if multiple platforms want it. + /// These fields are deliberately not declared in numeric + /// order, and the oneof fields aren't contiguous either. + /// This allows for reasonably robust tests of JSON output + /// ordering. + /// TestFieldOrderings in unittest_proto3.proto is similar, + /// but doesn't include oneofs. + /// TODO: Consider adding oneofs to TestFieldOrderings, although + /// that will require fixing other tests in multiple platforms. + /// Alternatively, consider just adding this to + /// unittest_proto3.proto if multiple platforms want it. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestJsonFieldOrdering : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestJsonFieldOrdering()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[6]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestJsonFieldOrdering() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestJsonFieldOrdering(TestJsonFieldOrdering other) : this() { plainInt32_ = other.plainInt32_; plainString_ = other.plainString_; @@ -1148,6 +1280,7 @@ namespace UnitTest.Issues.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestJsonFieldOrdering Clone() { return new TestJsonFieldOrdering(this); } @@ -1155,6 +1288,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "plain_int32" field. public const int PlainInt32FieldNumber = 4; private int plainInt32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int PlainInt32 { get { return plainInt32_; } set { @@ -1164,6 +1298,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "o1_string" field. public const int O1StringFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string O1String { get { return o1Case_ == O1OneofCase.O1String ? (string) o1_ : ""; } set { @@ -1174,6 +1309,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "o1_int32" field. public const int O1Int32FieldNumber = 5; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int O1Int32 { get { return o1Case_ == O1OneofCase.O1Int32 ? (int) o1_ : 0; } set { @@ -1185,6 +1321,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "plain_string" field. public const int PlainStringFieldNumber = 1; private string plainString_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string PlainString { get { return plainString_; } set { @@ -1194,6 +1331,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "o2_int32" field. public const int O2Int32FieldNumber = 6; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int O2Int32 { get { return o2Case_ == O2OneofCase.O2Int32 ? (int) o2_ : 0; } set { @@ -1204,6 +1342,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "o2_string" field. public const int O2StringFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string O2String { get { return o2Case_ == O2OneofCase.O2String ? (string) o2_ : ""; } set { @@ -1220,10 +1359,12 @@ namespace UnitTest.Issues.TestProtos { O1Int32 = 5, } private O1OneofCase o1Case_ = O1OneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public O1OneofCase O1Case { get { return o1Case_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearO1() { o1Case_ = O1OneofCase.None; o1_ = null; @@ -1237,19 +1378,23 @@ namespace UnitTest.Issues.TestProtos { O2String = 3, } private O2OneofCase o2Case_ = O2OneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public O2OneofCase O2Case { get { return o2Case_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearO2() { o2Case_ = O2OneofCase.None; o2_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestJsonFieldOrdering); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestJsonFieldOrdering other) { if (ReferenceEquals(other, null)) { return false; @@ -1268,6 +1413,7 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (PlainInt32 != 0) hash ^= PlainInt32.GetHashCode(); @@ -1281,10 +1427,12 @@ namespace UnitTest.Issues.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (PlainString.Length != 0) { output.WriteRawTag(10); @@ -1312,6 +1460,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (PlainInt32 != 0) { @@ -1335,6 +1484,7 @@ namespace UnitTest.Issues.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestJsonFieldOrdering other) { if (other == null) { return; @@ -1365,6 +1515,7 @@ namespace UnitTest.Issues.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1402,31 +1553,36 @@ namespace UnitTest.Issues.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestJsonName : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestJsonName()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::UnitTest.Issues.TestProtos.UnittestIssuesReflection.Descriptor.MessageTypes[7]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestJsonName() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestJsonName(TestJsonName other) : this() { name_ = other.name_; description_ = other.description_; guid_ = other.guid_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestJsonName Clone() { return new TestJsonName(this); } @@ -1435,8 +1591,9 @@ namespace UnitTest.Issues.TestProtos { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// Message for testing the effects for of the json_name option + /// Message for testing the effects for of the json_name option /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -1447,6 +1604,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "description" field. public const int DescriptionFieldNumber = 2; private string description_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Description { get { return description_; } set { @@ -1457,6 +1615,7 @@ namespace UnitTest.Issues.TestProtos { /// Field number for the "guid" field. public const int GuidFieldNumber = 3; private string guid_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Guid { get { return guid_; } set { @@ -1464,10 +1623,12 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestJsonName); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestJsonName other) { if (ReferenceEquals(other, null)) { return false; @@ -1481,6 +1642,7 @@ namespace UnitTest.Issues.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1489,10 +1651,12 @@ namespace UnitTest.Issues.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1508,6 +1672,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1522,6 +1687,7 @@ namespace UnitTest.Issues.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestJsonName other) { if (other == null) { return; @@ -1537,6 +1703,7 @@ namespace UnitTest.Issues.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs index b8d159bb5a..c11ab84d01 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { /// Holder for reflection information generated from google/protobuf/unittest_proto3.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class UnittestProto3Reflection { #region Descriptor @@ -86,70 +85,72 @@ namespace Google.Protobuf.TestProtos { "ZXN0TXV0dWFsUmVjdXJzaW9uQRIzCgJiYhgBIAEoCzInLnByb3RvYnVmX3Vu", "aXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25CImIKFFRlc3RNdXR1YWxSZWN1", "cnNpb25CEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TXV0", - "dWFsUmVjdXJzaW9uQRIWCg5vcHRpb25hbF9pbnQzMhgCIAEoBSLrAgoXVGVz", - "dENhbWVsQ2FzZUZpZWxkTmFtZXMSFgoOUHJpbWl0aXZlRmllbGQYASABKAUS", - "EwoLU3RyaW5nRmllbGQYAiABKAkSMQoJRW51bUZpZWxkGAMgASgOMh4ucHJv", - "dG9idWZfdW5pdHRlc3QuRm9yZWlnbkVudW0SNwoMTWVzc2FnZUZpZWxkGAQg", - "ASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USHgoWUmVw", - "ZWF0ZWRQcmltaXRpdmVGaWVsZBgHIAMoBRIbChNSZXBlYXRlZFN0cmluZ0Zp", - "ZWxkGAggAygJEjkKEVJlcGVhdGVkRW51bUZpZWxkGAkgAygOMh4ucHJvdG9i", - "dWZfdW5pdHRlc3QuRm9yZWlnbkVudW0SPwoUUmVwZWF0ZWRNZXNzYWdlRmll", - "bGQYCiADKAsyIS5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZSLH", - "AQoSVGVzdEZpZWxkT3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEoCRIOCgZt", - "eV9pbnQYASABKAMSEAoIbXlfZmxvYXQYZSABKAISUwoVc2luZ2xlX25lc3Rl", - "ZF9tZXNzYWdlGMgBIAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RGaWVs", - "ZE9yZGVyaW5ncy5OZXN0ZWRNZXNzYWdlGicKDU5lc3RlZE1lc3NhZ2USCgoC", - "b28YAiABKAMSCgoCYmIYASABKAUiSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoL", - "c3BhcnNlX2VudW0YASABKA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3Bh", - "cnNlRW51bSIZCglPbmVTdHJpbmcSDAoEZGF0YRgBIAEoCSIaCgpNb3JlU3Ry", - "aW5nEgwKBGRhdGEYASADKAkiGAoIT25lQnl0ZXMSDAoEZGF0YRgBIAEoDCIZ", - "CglNb3JlQnl0ZXMSDAoEZGF0YRgBIAEoDCIcCgxJbnQzMk1lc3NhZ2USDAoE", - "ZGF0YRgBIAEoBSIdCg1VaW50MzJNZXNzYWdlEgwKBGRhdGEYASABKA0iHAoM", - "SW50NjRNZXNzYWdlEgwKBGRhdGEYASABKAMiHQoNVWludDY0TWVzc2FnZRIM", - "CgRkYXRhGAEgASgEIhsKC0Jvb2xNZXNzYWdlEgwKBGRhdGEYASABKAgicwoJ", - "VGVzdE9uZW9mEhEKB2Zvb19pbnQYASABKAVIABIUCgpmb29fc3RyaW5nGAIg", - "ASgJSAASNgoLZm9vX21lc3NhZ2UYAyABKAsyHy5wcm90b2J1Zl91bml0dGVz", - "dC5UZXN0QWxsVHlwZXNIAEIFCgNmb28iqgMKD1Rlc3RQYWNrZWRUeXBlcxIY", - "CgxwYWNrZWRfaW50MzIYWiADKAVCAhABEhgKDHBhY2tlZF9pbnQ2NBhbIAMo", - "A0ICEAESGQoNcGFja2VkX3VpbnQzMhhcIAMoDUICEAESGQoNcGFja2VkX3Vp", - "bnQ2NBhdIAMoBEICEAESGQoNcGFja2VkX3NpbnQzMhheIAMoEUICEAESGQoN", - "cGFja2VkX3NpbnQ2NBhfIAMoEkICEAESGgoOcGFja2VkX2ZpeGVkMzIYYCAD", - "KAdCAhABEhoKDnBhY2tlZF9maXhlZDY0GGEgAygGQgIQARIbCg9wYWNrZWRf", - "c2ZpeGVkMzIYYiADKA9CAhABEhsKD3BhY2tlZF9zZml4ZWQ2NBhjIAMoEEIC", - "EAESGAoMcGFja2VkX2Zsb2F0GGQgAygCQgIQARIZCg1wYWNrZWRfZG91Ymxl", - "GGUgAygBQgIQARIXCgtwYWNrZWRfYm9vbBhmIAMoCEICEAESNwoLcGFja2Vk", - "X2VudW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUIC", - "EAEiyAMKEVRlc3RVbnBhY2tlZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFog", - "AygFQgIQABIaCg51bnBhY2tlZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNr", - "ZWRfdWludDMyGFwgAygNQgIQABIbCg91bnBhY2tlZF91aW50NjQYXSADKARC", - "AhAAEhsKD3VucGFja2VkX3NpbnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRf", - "c2ludDY0GF8gAygSQgIQABIcChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQ", - "ABIcChB1bnBhY2tlZF9maXhlZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9z", - "Zml4ZWQzMhhiIAMoD0ICEAASHQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBC", - "AhAAEhoKDnVucGFja2VkX2Zsb2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9k", - "b3VibGUYZSADKAFCAhAAEhkKDXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjkK", - "DXVucGFja2VkX2VudW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3Jl", - "aWduRW51bUICEAAiwAEKI1Rlc3RSZXBlYXRlZFNjYWxhckRpZmZlcmVudFRh", - "Z1NpemVzEhgKEHJlcGVhdGVkX2ZpeGVkMzIYDCADKAcSFgoOcmVwZWF0ZWRf", - "aW50MzIYDSADKAUSGQoQcmVwZWF0ZWRfZml4ZWQ2NBj+DyADKAYSFwoOcmVw", - "ZWF0ZWRfaW50NjQY/w8gAygDEhgKDnJlcGVhdGVkX2Zsb2F0GP7/DyADKAIS", - "GQoPcmVwZWF0ZWRfdWludDY0GP//DyADKAQiKAobVGVzdENvbW1lbnRJbmpl", - "Y3Rpb25NZXNzYWdlEgkKAWEYASABKAkiDAoKRm9vUmVxdWVzdCINCgtGb29S", - "ZXNwb25zZSISChBGb29DbGllbnRNZXNzYWdlIhIKEEZvb1NlcnZlck1lc3Nh", - "Z2UiDAoKQmFyUmVxdWVzdCINCgtCYXJSZXNwb25zZSpZCgtGb3JlaWduRW51", - "bRIXChNGT1JFSUdOX1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIP", - "CgtGT1JFSUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1X", - "aXRoRHVwVmFsdWUSKAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BF", - "Q0lGSUVEEAASCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08y", - "EAESCAoEQkFSMhACGgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9T", - "UEFSU0VfRU5VTV9VTlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BB", - "UlNFX0IQpucDEg8KCFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////", - "////ARIVCghTUEFSU0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIymQEK", - "C1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1Jl", - "cXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXIS", - "HS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5p", - "dHRlc3QuQmFyUmVzcG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB", - "+AEBqgIaR29vZ2xlLlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); + "dWFsUmVjdXJzaW9uQRIWCg5vcHRpb25hbF9pbnQzMhgCIAEoBSJMChJUZXN0", + "RW51bUFsbG93QWxpYXMSNgoFdmFsdWUYASABKA4yJy5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0RW51bVdpdGhEdXBWYWx1ZSLrAgoXVGVzdENhbWVsQ2FzZUZp", + "ZWxkTmFtZXMSFgoOUHJpbWl0aXZlRmllbGQYASABKAUSEwoLU3RyaW5nRmll", + "bGQYAiABKAkSMQoJRW51bUZpZWxkGAMgASgOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW0SNwoMTWVzc2FnZUZpZWxkGAQgASgLMiEucHJvdG9i", + "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USHgoWUmVwZWF0ZWRQcmltaXRp", + "dmVGaWVsZBgHIAMoBRIbChNSZXBlYXRlZFN0cmluZ0ZpZWxkGAggAygJEjkK", + "EVJlcGVhdGVkRW51bUZpZWxkGAkgAygOMh4ucHJvdG9idWZfdW5pdHRlc3Qu", + "Rm9yZWlnbkVudW0SPwoUUmVwZWF0ZWRNZXNzYWdlRmllbGQYCiADKAsyIS5w", + "cm90b2J1Zl91bml0dGVzdC5Gb3JlaWduTWVzc2FnZSLHAQoSVGVzdEZpZWxk", + "T3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEoCRIOCgZteV9pbnQYASABKAMS", + "EAoIbXlfZmxvYXQYZSABKAISUwoVc2luZ2xlX25lc3RlZF9tZXNzYWdlGMgB", + "IAEoCzIzLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RGaWVsZE9yZGVyaW5ncy5O", + "ZXN0ZWRNZXNzYWdlGicKDU5lc3RlZE1lc3NhZ2USCgoCb28YAiABKAMSCgoC", + "YmIYASABKAUiSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoLc3BhcnNlX2VudW0Y", + "ASABKA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3BhcnNlRW51bSIZCglP", + "bmVTdHJpbmcSDAoEZGF0YRgBIAEoCSIaCgpNb3JlU3RyaW5nEgwKBGRhdGEY", + "ASADKAkiGAoIT25lQnl0ZXMSDAoEZGF0YRgBIAEoDCIZCglNb3JlQnl0ZXMS", + "DAoEZGF0YRgBIAEoDCIcCgxJbnQzMk1lc3NhZ2USDAoEZGF0YRgBIAEoBSId", + "Cg1VaW50MzJNZXNzYWdlEgwKBGRhdGEYASABKA0iHAoMSW50NjRNZXNzYWdl", + "EgwKBGRhdGEYASABKAMiHQoNVWludDY0TWVzc2FnZRIMCgRkYXRhGAEgASgE", + "IhsKC0Jvb2xNZXNzYWdlEgwKBGRhdGEYASABKAgicwoJVGVzdE9uZW9mEhEK", + "B2Zvb19pbnQYASABKAVIABIUCgpmb29fc3RyaW5nGAIgASgJSAASNgoLZm9v", + "X21lc3NhZ2UYAyABKAsyHy5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlw", + "ZXNIAEIFCgNmb28iqgMKD1Rlc3RQYWNrZWRUeXBlcxIYCgxwYWNrZWRfaW50", + "MzIYWiADKAVCAhABEhgKDHBhY2tlZF9pbnQ2NBhbIAMoA0ICEAESGQoNcGFj", + "a2VkX3VpbnQzMhhcIAMoDUICEAESGQoNcGFja2VkX3VpbnQ2NBhdIAMoBEIC", + "EAESGQoNcGFja2VkX3NpbnQzMhheIAMoEUICEAESGQoNcGFja2VkX3NpbnQ2", + "NBhfIAMoEkICEAESGgoOcGFja2VkX2ZpeGVkMzIYYCADKAdCAhABEhoKDnBh", + "Y2tlZF9maXhlZDY0GGEgAygGQgIQARIbCg9wYWNrZWRfc2ZpeGVkMzIYYiAD", + "KA9CAhABEhsKD3BhY2tlZF9zZml4ZWQ2NBhjIAMoEEICEAESGAoMcGFja2Vk", + "X2Zsb2F0GGQgAygCQgIQARIZCg1wYWNrZWRfZG91YmxlGGUgAygBQgIQARIX", + "CgtwYWNrZWRfYm9vbBhmIAMoCEICEAESNwoLcGFja2VkX2VudW0YZyADKA4y", + "Hi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUICEAEiyAMKEVRlc3RV", + "bnBhY2tlZFR5cGVzEhoKDnVucGFja2VkX2ludDMyGFogAygFQgIQABIaCg51", + "bnBhY2tlZF9pbnQ2NBhbIAMoA0ICEAASGwoPdW5wYWNrZWRfdWludDMyGFwg", + "AygNQgIQABIbCg91bnBhY2tlZF91aW50NjQYXSADKARCAhAAEhsKD3VucGFj", + "a2VkX3NpbnQzMhheIAMoEUICEAASGwoPdW5wYWNrZWRfc2ludDY0GF8gAygS", + "QgIQABIcChB1bnBhY2tlZF9maXhlZDMyGGAgAygHQgIQABIcChB1bnBhY2tl", + "ZF9maXhlZDY0GGEgAygGQgIQABIdChF1bnBhY2tlZF9zZml4ZWQzMhhiIAMo", + "D0ICEAASHQoRdW5wYWNrZWRfc2ZpeGVkNjQYYyADKBBCAhAAEhoKDnVucGFj", + "a2VkX2Zsb2F0GGQgAygCQgIQABIbCg91bnBhY2tlZF9kb3VibGUYZSADKAFC", + "AhAAEhkKDXVucGFja2VkX2Jvb2wYZiADKAhCAhAAEjkKDXVucGFja2VkX2Vu", + "dW0YZyADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bUICEAAi", + "wAEKI1Rlc3RSZXBlYXRlZFNjYWxhckRpZmZlcmVudFRhZ1NpemVzEhgKEHJl", + "cGVhdGVkX2ZpeGVkMzIYDCADKAcSFgoOcmVwZWF0ZWRfaW50MzIYDSADKAUS", + "GQoQcmVwZWF0ZWRfZml4ZWQ2NBj+DyADKAYSFwoOcmVwZWF0ZWRfaW50NjQY", + "/w8gAygDEhgKDnJlcGVhdGVkX2Zsb2F0GP7/DyADKAISGQoPcmVwZWF0ZWRf", + "dWludDY0GP//DyADKAQiKAobVGVzdENvbW1lbnRJbmplY3Rpb25NZXNzYWdl", + "EgkKAWEYASABKAkiDAoKRm9vUmVxdWVzdCINCgtGb29SZXNwb25zZSISChBG", + "b29DbGllbnRNZXNzYWdlIhIKEEZvb1NlcnZlck1lc3NhZ2UiDAoKQmFyUmVx", + "dWVzdCINCgtCYXJSZXNwb25zZSpZCgtGb3JlaWduRW51bRIXChNGT1JFSUdO", + "X1VOU1BFQ0lGSUVEEAASDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JFSUdOX0JB", + "UhAFEg8KC0ZPUkVJR05fQkFaEAYqdQoUVGVzdEVudW1XaXRoRHVwVmFsdWUS", + "KAokVEVTVF9FTlVNX1dJVEhfRFVQX1ZBTFVFX1VOU1BFQ0lGSUVEEAASCAoE", + "Rk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAESCAoEQkFSMhAC", + "GgIQASqdAQoOVGVzdFNwYXJzZUVudW0SIAocVEVTVF9TUEFSU0VfRU5VTV9V", + "TlNQRUNJRklFRBAAEgwKCFNQQVJTRV9BEHsSDgoIU1BBUlNFX0IQpucDEg8K", + "CFNQQVJTRV9DELKxgAYSFQoIU1BBUlNFX0QQ8f//////////ARIVCghTUEFS", + "U0VfRRC03vz///////8BEgwKCFNQQVJTRV9HEAIymQEKC1Rlc3RTZXJ2aWNl", + "EkQKA0ZvbxIdLnByb3RvYnVmX3VuaXR0ZXN0LkZvb1JlcXVlc3QaHi5wcm90", + "b2J1Zl91bml0dGVzdC5Gb29SZXNwb25zZRJECgNCYXISHS5wcm90b2J1Zl91", + "bml0dGVzdC5CYXJSZXF1ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVz", + "cG9uc2VCOkINVW5pdHRlc3RQcm90b0gBgAEBiAEBkAEB+AEBqgIaR29vZ2xl", + "LlByb3RvYnVmLlRlc3RQcm90b3NiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.TestProtos.UnittestImportProto3Reflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.TestProtos.ForeignEnum), typeof(global::Google.Protobuf.TestProtos.TestEnumWithDupValue), typeof(global::Google.Protobuf.TestProtos.TestSparseEnum), }, new pbr::GeneratedClrTypeInfo[] { @@ -163,6 +164,7 @@ namespace Google.Protobuf.TestProtos { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestRecursiveMessage), global::Google.Protobuf.TestProtos.TestRecursiveMessage.Parser, new[]{ "A", "I" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionA), global::Google.Protobuf.TestProtos.TestMutualRecursionA.Parser, new[]{ "Bb" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestMutualRecursionB), global::Google.Protobuf.TestProtos.TestMutualRecursionB.Parser, new[]{ "A", "OptionalInt32" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestEnumAllowAlias), global::Google.Protobuf.TestProtos.TestEnumAllowAlias.Parser, new[]{ "Value" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames), global::Google.Protobuf.TestProtos.TestCamelCaseFieldNames.Parser, new[]{ "PrimitiveField", "StringField", "EnumField", "MessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings), global::Google.Protobuf.TestProtos.TestFieldOrderings.Parser, new[]{ "MyString", "MyInt", "MyFloat", "SingleNestedMessage" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage), global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage.Parser, new[]{ "Oo", "Bb" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.TestProtos.SparseEnumMessage), global::Google.Protobuf.TestProtos.SparseEnumMessage.Parser, new[]{ "SparseEnum" }, null, null, null), @@ -200,19 +202,19 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test an enum that has multiple values with the same number. + /// Test an enum that has multiple values with the same number. /// public enum TestEnumWithDupValue { [pbr::OriginalName("TEST_ENUM_WITH_DUP_VALUE_UNSPECIFIED")] Unspecified = 0, [pbr::OriginalName("FOO1")] Foo1 = 1, [pbr::OriginalName("BAR1")] Bar1 = 2, [pbr::OriginalName("BAZ")] Baz = 3, - [pbr::OriginalName("FOO2")] Foo2 = 1, - [pbr::OriginalName("BAR2")] Bar2 = 2, + [pbr::OriginalName("FOO2", PreferredAlias = false)] Foo2 = 1, + [pbr::OriginalName("BAR2", PreferredAlias = false)] Bar2 = 2, } /// - /// Test an enum with large, unordered values. + /// Test an enum with large, unordered values. /// public enum TestSparseEnum { [pbr::OriginalName("TEST_SPARSE_ENUM_UNSPECIFIED")] Unspecified = 0, @@ -222,8 +224,8 @@ namespace Google.Protobuf.TestProtos { [pbr::OriginalName("SPARSE_D")] SparseD = -15, [pbr::OriginalName("SPARSE_E")] SparseE = -53452, /// - /// In proto3, value 0 must be the first one specified - /// SPARSE_F = 0; + /// In proto3, value 0 must be the first one specified + /// SPARSE_F = 0; /// [pbr::OriginalName("SPARSE_G")] SparseG = 2, } @@ -232,28 +234,32 @@ namespace Google.Protobuf.TestProtos { #region Messages /// - /// This proto includes every type of field in both singular and repeated - /// forms. + /// This proto includes every type of field in both singular and repeated + /// forms. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestAllTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestAllTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestAllTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestAllTypes(TestAllTypes other) : this() { singleInt32_ = other.singleInt32_; singleInt64_ = other.singleInt64_; @@ -316,6 +322,7 @@ namespace Google.Protobuf.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestAllTypes Clone() { return new TestAllTypes(this); } @@ -324,8 +331,9 @@ namespace Google.Protobuf.TestProtos { public const int SingleInt32FieldNumber = 1; private int singleInt32_; /// - /// Singular + /// Singular /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int SingleInt32 { get { return singleInt32_; } set { @@ -336,6 +344,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_int64" field. public const int SingleInt64FieldNumber = 2; private long singleInt64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long SingleInt64 { get { return singleInt64_; } set { @@ -346,6 +355,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_uint32" field. public const int SingleUint32FieldNumber = 3; private uint singleUint32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint SingleUint32 { get { return singleUint32_; } set { @@ -356,6 +366,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_uint64" field. public const int SingleUint64FieldNumber = 4; private ulong singleUint64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong SingleUint64 { get { return singleUint64_; } set { @@ -366,6 +377,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_sint32" field. public const int SingleSint32FieldNumber = 5; private int singleSint32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int SingleSint32 { get { return singleSint32_; } set { @@ -376,6 +388,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_sint64" field. public const int SingleSint64FieldNumber = 6; private long singleSint64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long SingleSint64 { get { return singleSint64_; } set { @@ -386,6 +399,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_fixed32" field. public const int SingleFixed32FieldNumber = 7; private uint singleFixed32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint SingleFixed32 { get { return singleFixed32_; } set { @@ -396,6 +410,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_fixed64" field. public const int SingleFixed64FieldNumber = 8; private ulong singleFixed64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong SingleFixed64 { get { return singleFixed64_; } set { @@ -406,6 +421,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_sfixed32" field. public const int SingleSfixed32FieldNumber = 9; private int singleSfixed32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int SingleSfixed32 { get { return singleSfixed32_; } set { @@ -416,6 +432,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_sfixed64" field. public const int SingleSfixed64FieldNumber = 10; private long singleSfixed64_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long SingleSfixed64 { get { return singleSfixed64_; } set { @@ -426,6 +443,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_float" field. public const int SingleFloatFieldNumber = 11; private float singleFloat_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public float SingleFloat { get { return singleFloat_; } set { @@ -436,6 +454,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_double" field. public const int SingleDoubleFieldNumber = 12; private double singleDouble_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double SingleDouble { get { return singleDouble_; } set { @@ -446,6 +465,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_bool" field. public const int SingleBoolFieldNumber = 13; private bool singleBool_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool SingleBool { get { return singleBool_; } set { @@ -456,6 +476,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_string" field. public const int SingleStringFieldNumber = 14; private string singleString_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SingleString { get { return singleString_; } set { @@ -466,6 +487,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_bytes" field. public const int SingleBytesFieldNumber = 15; private pb::ByteString singleBytes_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString SingleBytes { get { return singleBytes_; } set { @@ -476,6 +498,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_nested_message" field. public const int SingleNestedMessageFieldNumber = 18; private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage singleNestedMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage SingleNestedMessage { get { return singleNestedMessage_; } set { @@ -486,6 +509,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_foreign_message" field. public const int SingleForeignMessageFieldNumber = 19; private global::Google.Protobuf.TestProtos.ForeignMessage singleForeignMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.ForeignMessage SingleForeignMessage { get { return singleForeignMessage_; } set { @@ -496,6 +520,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_import_message" field. public const int SingleImportMessageFieldNumber = 20; private global::Google.Protobuf.TestProtos.ImportMessage singleImportMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.ImportMessage SingleImportMessage { get { return singleImportMessage_; } set { @@ -506,6 +531,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_nested_enum" field. public const int SingleNestedEnumFieldNumber = 21; private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum singleNestedEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum SingleNestedEnum { get { return singleNestedEnum_; } set { @@ -516,6 +542,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_foreign_enum" field. public const int SingleForeignEnumFieldNumber = 22; private global::Google.Protobuf.TestProtos.ForeignEnum singleForeignEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.ForeignEnum SingleForeignEnum { get { return singleForeignEnum_; } set { @@ -526,6 +553,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_import_enum" field. public const int SingleImportEnumFieldNumber = 23; private global::Google.Protobuf.TestProtos.ImportEnum singleImportEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.ImportEnum SingleImportEnum { get { return singleImportEnum_; } set { @@ -537,8 +565,9 @@ namespace Google.Protobuf.TestProtos { public const int SinglePublicImportMessageFieldNumber = 26; private global::Google.Protobuf.TestProtos.PublicImportMessage singlePublicImportMessage_; /// - /// Defined in unittest_import_public.proto + /// Defined in unittest_import_public.proto /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.PublicImportMessage SinglePublicImportMessage { get { return singlePublicImportMessage_; } set { @@ -552,8 +581,9 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForInt32(250); private readonly pbc::RepeatedField repeatedInt32_ = new pbc::RepeatedField(); /// - /// Repeated + /// Repeated /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedInt32 { get { return repeatedInt32_; } } @@ -563,6 +593,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedInt64_codec = pb::FieldCodec.ForInt64(258); private readonly pbc::RepeatedField repeatedInt64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedInt64 { get { return repeatedInt64_; } } @@ -572,6 +603,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedUint32_codec = pb::FieldCodec.ForUInt32(266); private readonly pbc::RepeatedField repeatedUint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedUint32 { get { return repeatedUint32_; } } @@ -581,6 +613,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedUint64_codec = pb::FieldCodec.ForUInt64(274); private readonly pbc::RepeatedField repeatedUint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedUint64 { get { return repeatedUint64_; } } @@ -590,6 +623,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedSint32_codec = pb::FieldCodec.ForSInt32(282); private readonly pbc::RepeatedField repeatedSint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedSint32 { get { return repeatedSint32_; } } @@ -599,6 +633,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedSint64_codec = pb::FieldCodec.ForSInt64(290); private readonly pbc::RepeatedField repeatedSint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedSint64 { get { return repeatedSint64_; } } @@ -608,6 +643,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedFixed32_codec = pb::FieldCodec.ForFixed32(298); private readonly pbc::RepeatedField repeatedFixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedFixed32 { get { return repeatedFixed32_; } } @@ -617,6 +653,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedFixed64_codec = pb::FieldCodec.ForFixed64(306); private readonly pbc::RepeatedField repeatedFixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedFixed64 { get { return repeatedFixed64_; } } @@ -626,6 +663,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedSfixed32_codec = pb::FieldCodec.ForSFixed32(314); private readonly pbc::RepeatedField repeatedSfixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedSfixed32 { get { return repeatedSfixed32_; } } @@ -635,6 +673,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedSfixed64_codec = pb::FieldCodec.ForSFixed64(322); private readonly pbc::RepeatedField repeatedSfixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedSfixed64 { get { return repeatedSfixed64_; } } @@ -644,6 +683,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedFloat_codec = pb::FieldCodec.ForFloat(330); private readonly pbc::RepeatedField repeatedFloat_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedFloat { get { return repeatedFloat_; } } @@ -653,6 +693,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedDouble_codec = pb::FieldCodec.ForDouble(338); private readonly pbc::RepeatedField repeatedDouble_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedDouble { get { return repeatedDouble_; } } @@ -662,6 +703,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedBool_codec = pb::FieldCodec.ForBool(346); private readonly pbc::RepeatedField repeatedBool_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedBool { get { return repeatedBool_; } } @@ -671,6 +713,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedString_codec = pb::FieldCodec.ForString(354); private readonly pbc::RepeatedField repeatedString_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedString { get { return repeatedString_; } } @@ -680,6 +723,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedBytes_codec = pb::FieldCodec.ForBytes(362); private readonly pbc::RepeatedField repeatedBytes_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedBytes { get { return repeatedBytes_; } } @@ -689,6 +733,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedNestedMessage_codec = pb::FieldCodec.ForMessage(386, global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage.Parser); private readonly pbc::RepeatedField repeatedNestedMessage_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedNestedMessage { get { return repeatedNestedMessage_; } } @@ -698,6 +743,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedForeignMessage_codec = pb::FieldCodec.ForMessage(394, global::Google.Protobuf.TestProtos.ForeignMessage.Parser); private readonly pbc::RepeatedField repeatedForeignMessage_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedForeignMessage { get { return repeatedForeignMessage_; } } @@ -707,6 +753,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedImportMessage_codec = pb::FieldCodec.ForMessage(402, global::Google.Protobuf.TestProtos.ImportMessage.Parser); private readonly pbc::RepeatedField repeatedImportMessage_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedImportMessage { get { return repeatedImportMessage_; } } @@ -716,6 +763,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedNestedEnum_codec = pb::FieldCodec.ForEnum(410, x => (int) x, x => (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum) x); private readonly pbc::RepeatedField repeatedNestedEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedNestedEnum { get { return repeatedNestedEnum_; } } @@ -725,6 +773,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedForeignEnum_codec = pb::FieldCodec.ForEnum(418, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x); private readonly pbc::RepeatedField repeatedForeignEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedForeignEnum { get { return repeatedForeignEnum_; } } @@ -734,6 +783,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedImportEnum_codec = pb::FieldCodec.ForEnum(426, x => (int) x, x => (global::Google.Protobuf.TestProtos.ImportEnum) x); private readonly pbc::RepeatedField repeatedImportEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedImportEnum { get { return repeatedImportEnum_; } } @@ -744,14 +794,16 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForMessage(434, global::Google.Protobuf.TestProtos.PublicImportMessage.Parser); private readonly pbc::RepeatedField repeatedPublicImportMessage_ = new pbc::RepeatedField(); /// - /// Defined in unittest_import_public.proto + /// Defined in unittest_import_public.proto /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedPublicImportMessage { get { return repeatedPublicImportMessage_; } } /// Field number for the "oneof_uint32" field. public const int OneofUint32FieldNumber = 111; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint OneofUint32 { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofUint32 ? (uint) oneofField_ : 0; } set { @@ -762,6 +814,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "oneof_nested_message" field. public const int OneofNestedMessageFieldNumber = 112; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage OneofNestedMessage { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofNestedMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage) oneofField_ : null; } set { @@ -772,6 +825,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "oneof_string" field. public const int OneofStringFieldNumber = 113; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string OneofString { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } set { @@ -782,6 +836,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "oneof_bytes" field. public const int OneofBytesFieldNumber = 114; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString OneofBytes { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } set { @@ -800,19 +855,23 @@ namespace Google.Protobuf.TestProtos { OneofBytes = 114, } private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofFieldOneofCase OneofFieldCase { get { return oneofFieldCase_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearOneofField() { oneofFieldCase_ = OneofFieldOneofCase.None; oneofField_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestAllTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestAllTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -872,6 +931,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (SingleInt32 != 0) hash ^= SingleInt32.GetHashCode(); @@ -926,10 +986,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (SingleInt32 != 0) { output.WriteRawTag(8); @@ -1059,6 +1121,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (SingleInt32 != 0) { @@ -1164,6 +1227,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestAllTypes other) { if (other == null) { return; @@ -1285,6 +1349,7 @@ namespace Google.Protobuf.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1523,7 +1588,7 @@ namespace Google.Protobuf.TestProtos { #region Nested types /// Container for nested types declared in the TestAllTypes message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { public enum NestedEnum { [pbr::OriginalName("NESTED_ENUM_UNSPECIFIED")] Unspecified = 0, @@ -1531,34 +1596,39 @@ namespace Google.Protobuf.TestProtos { [pbr::OriginalName("BAR")] Bar = 2, [pbr::OriginalName("BAZ")] Baz = 3, /// - /// Intentionally negative. + /// Intentionally negative. /// [pbr::OriginalName("NEG")] Neg = -1, } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class NestedMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestAllTypes.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage(NestedMessage other) : this() { bb_ = other.bb_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage Clone() { return new NestedMessage(this); } @@ -1567,10 +1637,11 @@ namespace Google.Protobuf.TestProtos { public const int BbFieldNumber = 1; private int bb_; /// - /// The field name "b" fails to compile in proto1 because it conflicts with - /// a local variable named "b" in one of the generated methods. Doh. - /// This file needs to compile in proto1 to test backwards-compatibility. + /// The field name "b" fails to compile in proto1 because it conflicts with + /// a local variable named "b" in one of the generated methods. Doh. + /// This file needs to compile in proto1 to test backwards-compatibility. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Bb { get { return bb_; } set { @@ -1578,10 +1649,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NestedMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NestedMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -1593,16 +1666,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Bb != 0) hash ^= Bb.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Bb != 0) { output.WriteRawTag(8); @@ -1610,6 +1686,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Bb != 0) { @@ -1618,6 +1695,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NestedMessage other) { if (other == null) { return; @@ -1627,6 +1705,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1650,33 +1729,38 @@ namespace Google.Protobuf.TestProtos { } /// - /// This proto includes a recusively nested message. + /// This proto includes a recusively nested message. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class NestedTestAllTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedTestAllTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTestAllTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTestAllTypes(NestedTestAllTypes other) : this() { Child = other.child_ != null ? other.Child.Clone() : null; Payload = other.payload_ != null ? other.Payload.Clone() : null; repeatedChild_ = other.repeatedChild_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedTestAllTypes Clone() { return new NestedTestAllTypes(this); } @@ -1684,6 +1768,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "child" field. public const int ChildFieldNumber = 1; private global::Google.Protobuf.TestProtos.NestedTestAllTypes child_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.NestedTestAllTypes Child { get { return child_; } set { @@ -1694,6 +1779,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "payload" field. public const int PayloadFieldNumber = 2; private global::Google.Protobuf.TestProtos.TestAllTypes payload_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestAllTypes Payload { get { return payload_; } set { @@ -1706,14 +1792,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedChild_codec = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.TestProtos.NestedTestAllTypes.Parser); private readonly pbc::RepeatedField repeatedChild_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedChild { get { return repeatedChild_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NestedTestAllTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NestedTestAllTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -1727,6 +1816,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (child_ != null) hash ^= Child.GetHashCode(); @@ -1735,10 +1825,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (child_ != null) { output.WriteRawTag(10); @@ -1751,6 +1843,7 @@ namespace Google.Protobuf.TestProtos { repeatedChild_.WriteTo(output, _repeated_repeatedChild_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (child_ != null) { @@ -1763,6 +1856,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NestedTestAllTypes other) { if (other == null) { return; @@ -1782,6 +1876,7 @@ namespace Google.Protobuf.TestProtos { repeatedChild_.Add(other.repeatedChild_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1813,29 +1908,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestDeprecatedFields : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestDeprecatedFields()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestDeprecatedFields() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestDeprecatedFields(TestDeprecatedFields other) : this() { deprecatedInt32_ = other.deprecatedInt32_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestDeprecatedFields Clone() { return new TestDeprecatedFields(this); } @@ -1843,7 +1943,8 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "deprecated_int32" field. public const int DeprecatedInt32FieldNumber = 1; private int deprecatedInt32_; - [global::System.ObsoleteAttribute()] + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int DeprecatedInt32 { get { return deprecatedInt32_; } set { @@ -1851,10 +1952,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestDeprecatedFields); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestDeprecatedFields other) { if (ReferenceEquals(other, null)) { return false; @@ -1866,16 +1969,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (DeprecatedInt32 != 0) hash ^= DeprecatedInt32.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (DeprecatedInt32 != 0) { output.WriteRawTag(8); @@ -1883,6 +1989,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (DeprecatedInt32 != 0) { @@ -1891,6 +1998,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestDeprecatedFields other) { if (other == null) { return; @@ -1900,6 +2008,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1918,32 +2027,37 @@ namespace Google.Protobuf.TestProtos { } /// - /// Define these after TestAllTypes to make sure the compiler can handle - /// that. + /// Define these after TestAllTypes to make sure the compiler can handle + /// that. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ForeignMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ForeignMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[3]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ForeignMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ForeignMessage(ForeignMessage other) : this() { c_ = other.c_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ForeignMessage Clone() { return new ForeignMessage(this); } @@ -1951,6 +2065,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "c" field. public const int CFieldNumber = 1; private int c_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int C { get { return c_; } set { @@ -1958,10 +2073,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ForeignMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ForeignMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -1973,16 +2090,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (C != 0) hash ^= C.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (C != 0) { output.WriteRawTag(8); @@ -1990,6 +2110,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (C != 0) { @@ -1998,6 +2119,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ForeignMessage other) { if (other == null) { return; @@ -2007,6 +2129,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2024,36 +2147,43 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestReservedFields : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestReservedFields()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[4]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReservedFields() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReservedFields(TestReservedFields other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReservedFields Clone() { return new TestReservedFields(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestReservedFields); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestReservedFields other) { if (ReferenceEquals(other, null)) { return false; @@ -2064,29 +2194,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestReservedFields other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2101,31 +2237,36 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test that we can use NestedMessage from outside TestAllTypes. + /// Test that we can use NestedMessage from outside TestAllTypes. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestForeignNested : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestForeignNested()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[5]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestForeignNested() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestForeignNested(TestForeignNested other) : this() { ForeignNested = other.foreignNested_ != null ? other.ForeignNested.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestForeignNested Clone() { return new TestForeignNested(this); } @@ -2133,6 +2274,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "foreign_nested" field. public const int ForeignNestedFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { get { return foreignNested_; } set { @@ -2140,10 +2282,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestForeignNested); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestForeignNested other) { if (ReferenceEquals(other, null)) { return false; @@ -2155,16 +2299,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (foreignNested_ != null) hash ^= ForeignNested.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (foreignNested_ != null) { output.WriteRawTag(10); @@ -2172,6 +2319,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (foreignNested_ != null) { @@ -2180,6 +2328,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestForeignNested other) { if (other == null) { return; @@ -2192,6 +2341,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2213,32 +2363,37 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test that really large tag numbers don't break anything. + /// Test that really large tag numbers don't break anything. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestReallyLargeTagNumber : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestReallyLargeTagNumber()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[6]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReallyLargeTagNumber() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReallyLargeTagNumber(TestReallyLargeTagNumber other) : this() { a_ = other.a_; bb_ = other.bb_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestReallyLargeTagNumber Clone() { return new TestReallyLargeTagNumber(this); } @@ -2247,9 +2402,10 @@ namespace Google.Protobuf.TestProtos { public const int AFieldNumber = 1; private int a_; /// - /// The largest possible tag number is 2^28 - 1, since the wire format uses - /// three bits to communicate wire type. + /// The largest possible tag number is 2^28 - 1, since the wire format uses + /// three bits to communicate wire type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int A { get { return a_; } set { @@ -2260,6 +2416,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "bb" field. public const int BbFieldNumber = 268435455; private int bb_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Bb { get { return bb_; } set { @@ -2267,10 +2424,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestReallyLargeTagNumber); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestReallyLargeTagNumber other) { if (ReferenceEquals(other, null)) { return false; @@ -2283,6 +2442,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (A != 0) hash ^= A.GetHashCode(); @@ -2290,10 +2450,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (A != 0) { output.WriteRawTag(8); @@ -2305,6 +2467,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (A != 0) { @@ -2316,6 +2479,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestReallyLargeTagNumber other) { if (other == null) { return; @@ -2328,6 +2492,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2349,30 +2514,35 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestRecursiveMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestRecursiveMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[7]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestRecursiveMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestRecursiveMessage(TestRecursiveMessage other) : this() { A = other.a_ != null ? other.A.Clone() : null; i_ = other.i_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestRecursiveMessage Clone() { return new TestRecursiveMessage(this); } @@ -2380,6 +2550,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "a" field. public const int AFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestRecursiveMessage a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestRecursiveMessage A { get { return a_; } set { @@ -2390,6 +2561,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "i" field. public const int IFieldNumber = 2; private int i_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int I { get { return i_; } set { @@ -2397,10 +2569,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestRecursiveMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestRecursiveMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -2413,6 +2587,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (a_ != null) hash ^= A.GetHashCode(); @@ -2420,10 +2595,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (a_ != null) { output.WriteRawTag(10); @@ -2435,6 +2612,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (a_ != null) { @@ -2446,6 +2624,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestRecursiveMessage other) { if (other == null) { return; @@ -2461,6 +2640,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2486,31 +2666,36 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test that mutual recursion works. + /// Test that mutual recursion works. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestMutualRecursionA : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMutualRecursionA()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[8]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionA() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionA(TestMutualRecursionA other) : this() { Bb = other.bb_ != null ? other.Bb.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionA Clone() { return new TestMutualRecursionA(this); } @@ -2518,6 +2703,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "bb" field. public const int BbFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMutualRecursionB bb_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestMutualRecursionB Bb { get { return bb_; } set { @@ -2525,10 +2711,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestMutualRecursionA); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestMutualRecursionA other) { if (ReferenceEquals(other, null)) { return false; @@ -2540,16 +2728,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (bb_ != null) hash ^= Bb.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (bb_ != null) { output.WriteRawTag(10); @@ -2557,6 +2748,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (bb_ != null) { @@ -2565,6 +2757,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestMutualRecursionA other) { if (other == null) { return; @@ -2577,6 +2770,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2597,30 +2791,35 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestMutualRecursionB : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestMutualRecursionB()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[9]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionB() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionB(TestMutualRecursionB other) : this() { A = other.a_ != null ? other.A.Clone() : null; optionalInt32_ = other.optionalInt32_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestMutualRecursionB Clone() { return new TestMutualRecursionB(this); } @@ -2628,6 +2827,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "a" field. public const int AFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestMutualRecursionA a_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestMutualRecursionA A { get { return a_; } set { @@ -2638,6 +2838,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "optional_int32" field. public const int OptionalInt32FieldNumber = 2; private int optionalInt32_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OptionalInt32 { get { return optionalInt32_; } set { @@ -2645,10 +2846,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestMutualRecursionB); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestMutualRecursionB other) { if (ReferenceEquals(other, null)) { return false; @@ -2661,6 +2864,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (a_ != null) hash ^= A.GetHashCode(); @@ -2668,10 +2872,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (a_ != null) { output.WriteRawTag(10); @@ -2683,6 +2889,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (a_ != null) { @@ -2694,6 +2901,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestMutualRecursionB other) { if (other == null) { return; @@ -2709,6 +2917,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2733,29 +2942,150 @@ namespace Google.Protobuf.TestProtos { } - /// - /// Test message with CamelCase field names. This violates Protocol Buffer - /// standard style. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - public sealed partial class TestCamelCaseFieldNames : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestCamelCaseFieldNames()); - public static pb::MessageParser Parser { get { return _parser; } } + public sealed partial class TestEnumAllowAlias : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestEnumAllowAlias()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[10]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEnumAllowAlias() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEnumAllowAlias(TestEnumAllowAlias other) : this() { + value_ = other.value_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public TestEnumAllowAlias Clone() { + return new TestEnumAllowAlias(this); + } + + /// Field number for the "value" field. + public const int ValueFieldNumber = 1; + private global::Google.Protobuf.TestProtos.TestEnumWithDupValue value_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.TestProtos.TestEnumWithDupValue Value { + get { return value_; } + set { + value_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as TestEnumAllowAlias); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(TestEnumAllowAlias other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Value != other.Value) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Value != 0) hash ^= Value.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Value != 0) { + output.WriteRawTag(8); + output.WriteEnum((int) Value); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Value != 0) { + size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Value); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(TestEnumAllowAlias other) { + if (other == null) { + return; + } + if (other.Value != 0) { + Value = other.Value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + value_ = (global::Google.Protobuf.TestProtos.TestEnumWithDupValue) input.ReadEnum(); + break; + } + } + } + } + + } + + /// + /// Test message with CamelCase field names. This violates Protocol Buffer + /// standard style. + /// + public sealed partial class TestCamelCaseFieldNames : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestCamelCaseFieldNames()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCamelCaseFieldNames() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCamelCaseFieldNames(TestCamelCaseFieldNames other) : this() { primitiveField_ = other.primitiveField_; stringField_ = other.stringField_; @@ -2767,6 +3097,7 @@ namespace Google.Protobuf.TestProtos { repeatedMessageField_ = other.repeatedMessageField_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCamelCaseFieldNames Clone() { return new TestCamelCaseFieldNames(this); } @@ -2774,6 +3105,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "PrimitiveField" field. public const int PrimitiveFieldFieldNumber = 1; private int primitiveField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int PrimitiveField { get { return primitiveField_; } set { @@ -2784,6 +3116,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "StringField" field. public const int StringFieldFieldNumber = 2; private string stringField_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string StringField { get { return stringField_; } set { @@ -2794,6 +3127,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "EnumField" field. public const int EnumFieldFieldNumber = 3; private global::Google.Protobuf.TestProtos.ForeignEnum enumField_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.ForeignEnum EnumField { get { return enumField_; } set { @@ -2804,6 +3138,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "MessageField" field. public const int MessageFieldFieldNumber = 4; private global::Google.Protobuf.TestProtos.ForeignMessage messageField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.ForeignMessage MessageField { get { return messageField_; } set { @@ -2816,6 +3151,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedPrimitiveField_codec = pb::FieldCodec.ForInt32(58); private readonly pbc::RepeatedField repeatedPrimitiveField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedPrimitiveField { get { return repeatedPrimitiveField_; } } @@ -2825,6 +3161,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedStringField_codec = pb::FieldCodec.ForString(66); private readonly pbc::RepeatedField repeatedStringField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedStringField { get { return repeatedStringField_; } } @@ -2834,6 +3171,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedEnumField_codec = pb::FieldCodec.ForEnum(74, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x); private readonly pbc::RepeatedField repeatedEnumField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedEnumField { get { return repeatedEnumField_; } } @@ -2843,14 +3181,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedMessageField_codec = pb::FieldCodec.ForMessage(82, global::Google.Protobuf.TestProtos.ForeignMessage.Parser); private readonly pbc::RepeatedField repeatedMessageField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedMessageField { get { return repeatedMessageField_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestCamelCaseFieldNames); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestCamelCaseFieldNames other) { if (ReferenceEquals(other, null)) { return false; @@ -2869,6 +3210,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (PrimitiveField != 0) hash ^= PrimitiveField.GetHashCode(); @@ -2882,10 +3224,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (PrimitiveField != 0) { output.WriteRawTag(8); @@ -2909,6 +3253,7 @@ namespace Google.Protobuf.TestProtos { repeatedMessageField_.WriteTo(output, _repeated_repeatedMessageField_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (PrimitiveField != 0) { @@ -2930,6 +3275,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestCamelCaseFieldNames other) { if (other == null) { return; @@ -2955,6 +3301,7 @@ namespace Google.Protobuf.TestProtos { repeatedMessageField_.Add(other.repeatedMessageField_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3006,28 +3353,32 @@ namespace Google.Protobuf.TestProtos { } /// - /// We list fields out of order, to ensure that we're using field number and not - /// field index to determine serialization order. + /// We list fields out of order, to ensure that we're using field number and not + /// field index to determine serialization order. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestFieldOrderings : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestFieldOrderings()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[11]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[12]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestFieldOrderings() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestFieldOrderings(TestFieldOrderings other) : this() { myString_ = other.myString_; myInt_ = other.myInt_; @@ -3035,6 +3386,7 @@ namespace Google.Protobuf.TestProtos { SingleNestedMessage = other.singleNestedMessage_ != null ? other.SingleNestedMessage.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestFieldOrderings Clone() { return new TestFieldOrderings(this); } @@ -3042,6 +3394,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "my_string" field. public const int MyStringFieldNumber = 11; private string myString_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string MyString { get { return myString_; } set { @@ -3052,6 +3405,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "my_int" field. public const int MyIntFieldNumber = 1; private long myInt_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long MyInt { get { return myInt_; } set { @@ -3062,6 +3416,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "my_float" field. public const int MyFloatFieldNumber = 101; private float myFloat_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public float MyFloat { get { return myFloat_; } set { @@ -3072,6 +3427,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "single_nested_message" field. public const int SingleNestedMessageFieldNumber = 200; private global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage singleNestedMessage_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestFieldOrderings.Types.NestedMessage SingleNestedMessage { get { return singleNestedMessage_; } set { @@ -3079,10 +3435,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestFieldOrderings); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestFieldOrderings other) { if (ReferenceEquals(other, null)) { return false; @@ -3097,6 +3455,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (MyString.Length != 0) hash ^= MyString.GetHashCode(); @@ -3106,10 +3465,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (MyInt != 0L) { output.WriteRawTag(8); @@ -3129,6 +3490,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (MyString.Length != 0) { @@ -3146,6 +3508,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestFieldOrderings other) { if (other == null) { return; @@ -3167,6 +3530,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3199,32 +3563,37 @@ namespace Google.Protobuf.TestProtos { #region Nested types /// Container for nested types declared in the TestFieldOrderings message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class NestedMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NestedMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.TestFieldOrderings.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage(NestedMessage other) : this() { oo_ = other.oo_; bb_ = other.bb_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NestedMessage Clone() { return new NestedMessage(this); } @@ -3232,6 +3601,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "oo" field. public const int OoFieldNumber = 2; private long oo_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Oo { get { return oo_; } set { @@ -3243,10 +3613,11 @@ namespace Google.Protobuf.TestProtos { public const int BbFieldNumber = 1; private int bb_; /// - /// The field name "b" fails to compile in proto1 because it conflicts with - /// a local variable named "b" in one of the generated methods. Doh. - /// This file needs to compile in proto1 to test backwards-compatibility. + /// The field name "b" fails to compile in proto1 because it conflicts with + /// a local variable named "b" in one of the generated methods. Doh. + /// This file needs to compile in proto1 to test backwards-compatibility. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Bb { get { return bb_; } set { @@ -3254,10 +3625,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NestedMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NestedMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -3270,6 +3643,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Oo != 0L) hash ^= Oo.GetHashCode(); @@ -3277,10 +3651,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Bb != 0) { output.WriteRawTag(8); @@ -3292,6 +3668,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Oo != 0L) { @@ -3303,6 +3680,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NestedMessage other) { if (other == null) { return; @@ -3315,6 +3693,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3341,29 +3720,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class SparseEnumMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SparseEnumMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[12]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[13]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SparseEnumMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SparseEnumMessage(SparseEnumMessage other) : this() { sparseEnum_ = other.sparseEnum_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SparseEnumMessage Clone() { return new SparseEnumMessage(this); } @@ -3371,6 +3755,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "sparse_enum" field. public const int SparseEnumFieldNumber = 1; private global::Google.Protobuf.TestProtos.TestSparseEnum sparseEnum_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestSparseEnum SparseEnum { get { return sparseEnum_; } set { @@ -3378,10 +3763,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SparseEnumMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(SparseEnumMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -3393,16 +3780,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (SparseEnum != 0) hash ^= SparseEnum.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (SparseEnum != 0) { output.WriteRawTag(8); @@ -3410,6 +3800,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (SparseEnum != 0) { @@ -3418,6 +3809,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(SparseEnumMessage other) { if (other == null) { return; @@ -3427,6 +3819,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3445,31 +3838,36 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test String and Bytes: string is for valid UTF-8 strings + /// Test String and Bytes: string is for valid UTF-8 strings /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class OneString : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneString()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[13]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[14]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneString() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneString(OneString other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneString Clone() { return new OneString(this); } @@ -3477,6 +3875,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private string data_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Data { get { return data_; } set { @@ -3484,10 +3883,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as OneString); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(OneString other) { if (ReferenceEquals(other, null)) { return false; @@ -3499,16 +3900,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data.Length != 0) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data.Length != 0) { output.WriteRawTag(10); @@ -3516,6 +3920,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data.Length != 0) { @@ -3524,6 +3929,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(OneString other) { if (other == null) { return; @@ -3533,6 +3939,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3550,29 +3957,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class MoreString : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MoreString()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[14]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[15]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreString() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreString(MoreString other) : this() { data_ = other.data_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreString Clone() { return new MoreString(this); } @@ -3582,14 +3994,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_data_codec = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField data_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Data { get { return data_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MoreString); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MoreString other) { if (ReferenceEquals(other, null)) { return false; @@ -3601,26 +4016,31 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= data_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { data_.WriteTo(output, _repeated_data_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += data_.CalculateSize(_repeated_data_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MoreString other) { if (other == null) { return; @@ -3628,6 +4048,7 @@ namespace Google.Protobuf.TestProtos { data_.Add(other.data_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3645,29 +4066,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class OneBytes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneBytes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[15]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[16]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneBytes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneBytes(OneBytes other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneBytes Clone() { return new OneBytes(this); } @@ -3675,6 +4101,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private pb::ByteString data_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString Data { get { return data_; } set { @@ -3682,10 +4109,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as OneBytes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(OneBytes other) { if (ReferenceEquals(other, null)) { return false; @@ -3697,16 +4126,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data.Length != 0) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data.Length != 0) { output.WriteRawTag(10); @@ -3714,6 +4146,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data.Length != 0) { @@ -3722,6 +4155,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(OneBytes other) { if (other == null) { return; @@ -3731,6 +4165,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3748,29 +4183,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class MoreBytes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MoreBytes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[16]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[17]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreBytes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreBytes(MoreBytes other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MoreBytes Clone() { return new MoreBytes(this); } @@ -3778,6 +4218,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private pb::ByteString data_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString Data { get { return data_; } set { @@ -3785,10 +4226,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MoreBytes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MoreBytes other) { if (ReferenceEquals(other, null)) { return false; @@ -3800,16 +4243,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data.Length != 0) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data.Length != 0) { output.WriteRawTag(10); @@ -3817,6 +4263,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data.Length != 0) { @@ -3825,6 +4272,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MoreBytes other) { if (other == null) { return; @@ -3834,6 +4282,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3852,31 +4301,36 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test int32, uint32, int64, uint64, and bool are all compatible + /// Test int32, uint32, int64, uint64, and bool are all compatible /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Int32Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int32Message()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[17]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[18]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int32Message() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int32Message(Int32Message other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int32Message Clone() { return new Int32Message(this); } @@ -3884,6 +4338,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private int data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Data { get { return data_; } set { @@ -3891,10 +4346,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Int32Message); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Int32Message other) { if (ReferenceEquals(other, null)) { return false; @@ -3906,16 +4363,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data != 0) { output.WriteRawTag(8); @@ -3923,6 +4383,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data != 0) { @@ -3931,6 +4392,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Int32Message other) { if (other == null) { return; @@ -3940,6 +4402,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -3957,29 +4420,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Uint32Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Uint32Message()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[18]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[19]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint32Message() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint32Message(Uint32Message other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint32Message Clone() { return new Uint32Message(this); } @@ -3987,6 +4455,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private uint data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint Data { get { return data_; } set { @@ -3994,10 +4463,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Uint32Message); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Uint32Message other) { if (ReferenceEquals(other, null)) { return false; @@ -4009,16 +4480,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data != 0) { output.WriteRawTag(8); @@ -4026,6 +4500,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data != 0) { @@ -4034,6 +4509,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Uint32Message other) { if (other == null) { return; @@ -4043,6 +4519,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4060,29 +4537,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Int64Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Int64Message()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[19]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[20]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int64Message() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int64Message(Int64Message other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Int64Message Clone() { return new Int64Message(this); } @@ -4090,6 +4572,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private long data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Data { get { return data_; } set { @@ -4097,10 +4580,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Int64Message); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Int64Message other) { if (ReferenceEquals(other, null)) { return false; @@ -4112,16 +4597,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0L) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data != 0L) { output.WriteRawTag(8); @@ -4129,6 +4617,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data != 0L) { @@ -4137,6 +4626,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Int64Message other) { if (other == null) { return; @@ -4146,6 +4636,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4163,29 +4654,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Uint64Message : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Uint64Message()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[20]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[21]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint64Message() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint64Message(Uint64Message other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Uint64Message Clone() { return new Uint64Message(this); } @@ -4193,6 +4689,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private ulong data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong Data { get { return data_; } set { @@ -4200,10 +4697,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Uint64Message); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Uint64Message other) { if (ReferenceEquals(other, null)) { return false; @@ -4215,16 +4714,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != 0UL) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data != 0UL) { output.WriteRawTag(8); @@ -4232,6 +4734,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data != 0UL) { @@ -4240,6 +4743,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Uint64Message other) { if (other == null) { return; @@ -4249,6 +4753,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4266,29 +4771,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class BoolMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BoolMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[21]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[22]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BoolMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BoolMessage(BoolMessage other) : this() { data_ = other.data_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BoolMessage Clone() { return new BoolMessage(this); } @@ -4296,6 +4806,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "data" field. public const int DataFieldNumber = 1; private bool data_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Data { get { return data_; } set { @@ -4303,10 +4814,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as BoolMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(BoolMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -4318,16 +4831,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Data != false) hash ^= Data.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Data != false) { output.WriteRawTag(8); @@ -4335,6 +4851,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Data != false) { @@ -4343,6 +4860,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(BoolMessage other) { if (other == null) { return; @@ -4352,6 +4870,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4370,27 +4889,31 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test oneofs. + /// Test oneofs. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestOneof : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestOneof()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[22]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[23]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestOneof() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestOneof(TestOneof other) : this() { switch (other.FooCase) { case FooOneofCase.FooInt: @@ -4406,12 +4929,14 @@ namespace Google.Protobuf.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestOneof Clone() { return new TestOneof(this); } /// Field number for the "foo_int" field. public const int FooIntFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int FooInt { get { return fooCase_ == FooOneofCase.FooInt ? (int) foo_ : 0; } set { @@ -4422,6 +4947,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "foo_string" field. public const int FooStringFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FooString { get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; } set { @@ -4432,6 +4958,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "foo_message" field. public const int FooMessageFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.TestProtos.TestAllTypes FooMessage { get { return fooCase_ == FooOneofCase.FooMessage ? (global::Google.Protobuf.TestProtos.TestAllTypes) foo_ : null; } set { @@ -4449,19 +4976,23 @@ namespace Google.Protobuf.TestProtos { FooMessage = 3, } private FooOneofCase fooCase_ = FooOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooOneofCase FooCase { get { return fooCase_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearFoo() { fooCase_ = FooOneofCase.None; foo_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestOneof); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestOneof other) { if (ReferenceEquals(other, null)) { return false; @@ -4476,6 +5007,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (fooCase_ == FooOneofCase.FooInt) hash ^= FooInt.GetHashCode(); @@ -4485,10 +5017,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (fooCase_ == FooOneofCase.FooInt) { output.WriteRawTag(8); @@ -4504,6 +5038,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (fooCase_ == FooOneofCase.FooInt) { @@ -4518,6 +5053,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestOneof other) { if (other == null) { return; @@ -4536,6 +5072,7 @@ namespace Google.Protobuf.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4566,25 +5103,29 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestPackedTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestPackedTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[23]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[24]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestPackedTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestPackedTypes(TestPackedTypes other) : this() { packedInt32_ = other.packedInt32_.Clone(); packedInt64_ = other.packedInt64_.Clone(); @@ -4602,6 +5143,7 @@ namespace Google.Protobuf.TestProtos { packedEnum_ = other.packedEnum_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestPackedTypes Clone() { return new TestPackedTypes(this); } @@ -4611,6 +5153,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedInt32_codec = pb::FieldCodec.ForInt32(722); private readonly pbc::RepeatedField packedInt32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedInt32 { get { return packedInt32_; } } @@ -4620,6 +5163,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedInt64_codec = pb::FieldCodec.ForInt64(730); private readonly pbc::RepeatedField packedInt64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedInt64 { get { return packedInt64_; } } @@ -4629,6 +5173,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedUint32_codec = pb::FieldCodec.ForUInt32(738); private readonly pbc::RepeatedField packedUint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedUint32 { get { return packedUint32_; } } @@ -4638,6 +5183,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedUint64_codec = pb::FieldCodec.ForUInt64(746); private readonly pbc::RepeatedField packedUint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedUint64 { get { return packedUint64_; } } @@ -4647,6 +5193,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedSint32_codec = pb::FieldCodec.ForSInt32(754); private readonly pbc::RepeatedField packedSint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedSint32 { get { return packedSint32_; } } @@ -4656,6 +5203,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedSint64_codec = pb::FieldCodec.ForSInt64(762); private readonly pbc::RepeatedField packedSint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedSint64 { get { return packedSint64_; } } @@ -4665,6 +5213,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedFixed32_codec = pb::FieldCodec.ForFixed32(770); private readonly pbc::RepeatedField packedFixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedFixed32 { get { return packedFixed32_; } } @@ -4674,6 +5223,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedFixed64_codec = pb::FieldCodec.ForFixed64(778); private readonly pbc::RepeatedField packedFixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedFixed64 { get { return packedFixed64_; } } @@ -4683,6 +5233,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedSfixed32_codec = pb::FieldCodec.ForSFixed32(786); private readonly pbc::RepeatedField packedSfixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedSfixed32 { get { return packedSfixed32_; } } @@ -4692,6 +5243,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedSfixed64_codec = pb::FieldCodec.ForSFixed64(794); private readonly pbc::RepeatedField packedSfixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedSfixed64 { get { return packedSfixed64_; } } @@ -4701,6 +5253,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedFloat_codec = pb::FieldCodec.ForFloat(802); private readonly pbc::RepeatedField packedFloat_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedFloat { get { return packedFloat_; } } @@ -4710,6 +5263,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedDouble_codec = pb::FieldCodec.ForDouble(810); private readonly pbc::RepeatedField packedDouble_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedDouble { get { return packedDouble_; } } @@ -4719,6 +5273,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedBool_codec = pb::FieldCodec.ForBool(818); private readonly pbc::RepeatedField packedBool_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedBool { get { return packedBool_; } } @@ -4728,14 +5283,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_packedEnum_codec = pb::FieldCodec.ForEnum(826, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x); private readonly pbc::RepeatedField packedEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PackedEnum { get { return packedEnum_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestPackedTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestPackedTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -4760,6 +5318,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= packedInt32_.GetHashCode(); @@ -4779,10 +5338,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { packedInt32_.WriteTo(output, _repeated_packedInt32_codec); packedInt64_.WriteTo(output, _repeated_packedInt64_codec); @@ -4800,6 +5361,7 @@ namespace Google.Protobuf.TestProtos { packedEnum_.WriteTo(output, _repeated_packedEnum_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += packedInt32_.CalculateSize(_repeated_packedInt32_codec); @@ -4819,6 +5381,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestPackedTypes other) { if (other == null) { return; @@ -4839,6 +5402,7 @@ namespace Google.Protobuf.TestProtos { packedEnum_.Add(other.packedEnum_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4923,28 +5487,32 @@ namespace Google.Protobuf.TestProtos { } /// - /// A message with the same fields as TestPackedTypes, but without packing. Used - /// to test packed <-> unpacked wire compatibility. + /// A message with the same fields as TestPackedTypes, but without packing. Used + /// to test packed <-> unpacked wire compatibility. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestUnpackedTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestUnpackedTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[24]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[25]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestUnpackedTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestUnpackedTypes(TestUnpackedTypes other) : this() { unpackedInt32_ = other.unpackedInt32_.Clone(); unpackedInt64_ = other.unpackedInt64_.Clone(); @@ -4962,6 +5530,7 @@ namespace Google.Protobuf.TestProtos { unpackedEnum_ = other.unpackedEnum_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestUnpackedTypes Clone() { return new TestUnpackedTypes(this); } @@ -4971,6 +5540,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedInt32_codec = pb::FieldCodec.ForInt32(720); private readonly pbc::RepeatedField unpackedInt32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedInt32 { get { return unpackedInt32_; } } @@ -4980,6 +5550,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedInt64_codec = pb::FieldCodec.ForInt64(728); private readonly pbc::RepeatedField unpackedInt64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedInt64 { get { return unpackedInt64_; } } @@ -4989,6 +5560,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedUint32_codec = pb::FieldCodec.ForUInt32(736); private readonly pbc::RepeatedField unpackedUint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedUint32 { get { return unpackedUint32_; } } @@ -4998,6 +5570,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedUint64_codec = pb::FieldCodec.ForUInt64(744); private readonly pbc::RepeatedField unpackedUint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedUint64 { get { return unpackedUint64_; } } @@ -5007,6 +5580,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedSint32_codec = pb::FieldCodec.ForSInt32(752); private readonly pbc::RepeatedField unpackedSint32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedSint32 { get { return unpackedSint32_; } } @@ -5016,6 +5590,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedSint64_codec = pb::FieldCodec.ForSInt64(760); private readonly pbc::RepeatedField unpackedSint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedSint64 { get { return unpackedSint64_; } } @@ -5025,6 +5600,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedFixed32_codec = pb::FieldCodec.ForFixed32(773); private readonly pbc::RepeatedField unpackedFixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedFixed32 { get { return unpackedFixed32_; } } @@ -5034,6 +5610,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedFixed64_codec = pb::FieldCodec.ForFixed64(777); private readonly pbc::RepeatedField unpackedFixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedFixed64 { get { return unpackedFixed64_; } } @@ -5043,6 +5620,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedSfixed32_codec = pb::FieldCodec.ForSFixed32(789); private readonly pbc::RepeatedField unpackedSfixed32_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedSfixed32 { get { return unpackedSfixed32_; } } @@ -5052,6 +5630,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedSfixed64_codec = pb::FieldCodec.ForSFixed64(793); private readonly pbc::RepeatedField unpackedSfixed64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedSfixed64 { get { return unpackedSfixed64_; } } @@ -5061,6 +5640,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedFloat_codec = pb::FieldCodec.ForFloat(805); private readonly pbc::RepeatedField unpackedFloat_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedFloat { get { return unpackedFloat_; } } @@ -5070,6 +5650,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedDouble_codec = pb::FieldCodec.ForDouble(809); private readonly pbc::RepeatedField unpackedDouble_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedDouble { get { return unpackedDouble_; } } @@ -5079,6 +5660,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedBool_codec = pb::FieldCodec.ForBool(816); private readonly pbc::RepeatedField unpackedBool_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedBool { get { return unpackedBool_; } } @@ -5088,14 +5670,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_unpackedEnum_codec = pb::FieldCodec.ForEnum(824, x => (int) x, x => (global::Google.Protobuf.TestProtos.ForeignEnum) x); private readonly pbc::RepeatedField unpackedEnum_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UnpackedEnum { get { return unpackedEnum_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestUnpackedTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestUnpackedTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -5120,6 +5705,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= unpackedInt32_.GetHashCode(); @@ -5139,10 +5725,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { unpackedInt32_.WriteTo(output, _repeated_unpackedInt32_codec); unpackedInt64_.WriteTo(output, _repeated_unpackedInt64_codec); @@ -5160,6 +5748,7 @@ namespace Google.Protobuf.TestProtos { unpackedEnum_.WriteTo(output, _repeated_unpackedEnum_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += unpackedInt32_.CalculateSize(_repeated_unpackedInt32_codec); @@ -5179,6 +5768,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestUnpackedTypes other) { if (other == null) { return; @@ -5199,6 +5789,7 @@ namespace Google.Protobuf.TestProtos { unpackedEnum_.Add(other.unpackedEnum_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5282,25 +5873,29 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestRepeatedScalarDifferentTagSizes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[25]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[26]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestRepeatedScalarDifferentTagSizes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestRepeatedScalarDifferentTagSizes(TestRepeatedScalarDifferentTagSizes other) : this() { repeatedFixed32_ = other.repeatedFixed32_.Clone(); repeatedInt32_ = other.repeatedInt32_.Clone(); @@ -5310,6 +5905,7 @@ namespace Google.Protobuf.TestProtos { repeatedUint64_ = other.repeatedUint64_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestRepeatedScalarDifferentTagSizes Clone() { return new TestRepeatedScalarDifferentTagSizes(this); } @@ -5320,10 +5916,11 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForFixed32(98); private readonly pbc::RepeatedField repeatedFixed32_ = new pbc::RepeatedField(); /// - /// Parsing repeated fixed size values used to fail. This message needs to be - /// used in order to get a tag of the right size; all of the repeated fields - /// in TestAllTypes didn't trigger the check. + /// Parsing repeated fixed size values used to fail. This message needs to be + /// used in order to get a tag of the right size; all of the repeated fields + /// in TestAllTypes didn't trigger the check. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedFixed32 { get { return repeatedFixed32_; } } @@ -5334,8 +5931,9 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForInt32(106); private readonly pbc::RepeatedField repeatedInt32_ = new pbc::RepeatedField(); /// - /// Check for a varint type, just for good measure. + /// Check for a varint type, just for good measure. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedInt32 { get { return repeatedInt32_; } } @@ -5346,8 +5944,9 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForFixed64(16370); private readonly pbc::RepeatedField repeatedFixed64_ = new pbc::RepeatedField(); /// - /// These have two-byte tags. + /// These have two-byte tags. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedFixed64 { get { return repeatedFixed64_; } } @@ -5357,6 +5956,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedInt64_codec = pb::FieldCodec.ForInt64(16378); private readonly pbc::RepeatedField repeatedInt64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedInt64 { get { return repeatedInt64_; } } @@ -5367,8 +5967,9 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForFloat(2097138); private readonly pbc::RepeatedField repeatedFloat_ = new pbc::RepeatedField(); /// - /// Three byte tags. + /// Three byte tags. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedFloat { get { return repeatedFloat_; } } @@ -5378,14 +5979,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_repeatedUint64_codec = pb::FieldCodec.ForUInt64(2097146); private readonly pbc::RepeatedField repeatedUint64_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField RepeatedUint64 { get { return repeatedUint64_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestRepeatedScalarDifferentTagSizes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestRepeatedScalarDifferentTagSizes other) { if (ReferenceEquals(other, null)) { return false; @@ -5402,6 +6006,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= repeatedFixed32_.GetHashCode(); @@ -5413,10 +6018,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { repeatedFixed32_.WriteTo(output, _repeated_repeatedFixed32_codec); repeatedInt32_.WriteTo(output, _repeated_repeatedInt32_codec); @@ -5426,6 +6033,7 @@ namespace Google.Protobuf.TestProtos { repeatedUint64_.WriteTo(output, _repeated_repeatedUint64_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += repeatedFixed32_.CalculateSize(_repeated_repeatedFixed32_codec); @@ -5437,6 +6045,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestRepeatedScalarDifferentTagSizes other) { if (other == null) { return; @@ -5449,6 +6058,7 @@ namespace Google.Protobuf.TestProtos { repeatedUint64_.Add(other.repeatedUint64_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5492,29 +6102,34 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestCommentInjectionMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestCommentInjectionMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[26]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[27]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCommentInjectionMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCommentInjectionMessage(TestCommentInjectionMessage other) : this() { a_ = other.a_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestCommentInjectionMessage Clone() { return new TestCommentInjectionMessage(this); } @@ -5523,8 +6138,9 @@ namespace Google.Protobuf.TestProtos { public const int AFieldNumber = 1; private string a_ = ""; /// - /// */ <- This should not close the generated doc comment + /// */ <- This should not close the generated doc comment /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string A { get { return a_; } set { @@ -5532,10 +6148,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestCommentInjectionMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestCommentInjectionMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -5547,16 +6165,19 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (A.Length != 0) hash ^= A.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (A.Length != 0) { output.WriteRawTag(10); @@ -5564,6 +6185,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (A.Length != 0) { @@ -5572,6 +6194,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestCommentInjectionMessage other) { if (other == null) { return; @@ -5581,6 +6204,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5599,38 +6223,45 @@ namespace Google.Protobuf.TestProtos { } /// - /// Test that RPC services work. + /// Test that RPC services work. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FooRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[27]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[28]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooRequest() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooRequest(FooRequest other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooRequest Clone() { return new FooRequest(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FooRequest); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FooRequest other) { if (ReferenceEquals(other, null)) { return false; @@ -5641,29 +6272,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FooRequest other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5677,36 +6314,43 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FooResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[28]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[29]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooResponse() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooResponse(FooResponse other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooResponse Clone() { return new FooResponse(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FooResponse); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FooResponse other) { if (ReferenceEquals(other, null)) { return false; @@ -5717,29 +6361,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FooResponse other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5753,36 +6403,43 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FooClientMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooClientMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[29]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[30]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooClientMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooClientMessage(FooClientMessage other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooClientMessage Clone() { return new FooClientMessage(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FooClientMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FooClientMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -5793,29 +6450,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FooClientMessage other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5829,36 +6492,43 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FooServerMessage : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FooServerMessage()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[30]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[31]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooServerMessage() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooServerMessage(FooServerMessage other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FooServerMessage Clone() { return new FooServerMessage(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FooServerMessage); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FooServerMessage other) { if (ReferenceEquals(other, null)) { return false; @@ -5869,29 +6539,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FooServerMessage other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5905,36 +6581,43 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class BarRequest : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BarRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[31]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[32]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarRequest() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarRequest(BarRequest other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarRequest Clone() { return new BarRequest(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as BarRequest); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(BarRequest other) { if (ReferenceEquals(other, null)) { return false; @@ -5945,29 +6628,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(BarRequest other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5981,36 +6670,43 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class BarResponse : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BarResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[32]; } + get { return global::Google.Protobuf.TestProtos.UnittestProto3Reflection.Descriptor.MessageTypes[33]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarResponse() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarResponse(BarResponse other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public BarResponse Clone() { return new BarResponse(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as BarResponse); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(BarResponse other) { if (ReferenceEquals(other, null)) { return false; @@ -6021,29 +6717,35 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(BarResponse other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs index ae12f4a4b9..2c7f0e0e1e 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.TestProtos { /// Holder for reflection information generated from google/protobuf/unittest_well_known_types.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class UnittestWellKnownTypesReflection { #region Descriptor @@ -174,29 +173,33 @@ namespace Google.Protobuf.TestProtos { } #region Messages /// - /// Test that we can include all well-known types. - /// Each wrapper type is included separately, as languages - /// map handle different wrappers in different ways. + /// Test that we can include all well-known types. + /// Each wrapper type is included separately, as languages + /// map handle different wrappers in different ways. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class TestWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TestWellKnownTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestWellKnownTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestWellKnownTypes(TestWellKnownTypes other) : this() { AnyField = other.anyField_ != null ? other.AnyField.Clone() : null; ApiField = other.apiField_ != null ? other.ApiField.Clone() : null; @@ -219,6 +222,7 @@ namespace Google.Protobuf.TestProtos { ValueField = other.valueField_ != null ? other.ValueField.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TestWellKnownTypes Clone() { return new TestWellKnownTypes(this); } @@ -226,6 +230,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "any_field" field. public const int AnyFieldFieldNumber = 1; private global::Google.Protobuf.WellKnownTypes.Any anyField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Any AnyField { get { return anyField_; } set { @@ -236,6 +241,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "api_field" field. public const int ApiFieldFieldNumber = 2; private global::Google.Protobuf.WellKnownTypes.Api apiField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Api ApiField { get { return apiField_; } set { @@ -246,6 +252,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "duration_field" field. public const int DurationFieldFieldNumber = 3; private global::Google.Protobuf.WellKnownTypes.Duration durationField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Duration DurationField { get { return durationField_; } set { @@ -256,6 +263,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "empty_field" field. public const int EmptyFieldFieldNumber = 4; private global::Google.Protobuf.WellKnownTypes.Empty emptyField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Empty EmptyField { get { return emptyField_; } set { @@ -266,6 +274,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "field_mask_field" field. public const int FieldMaskFieldFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.FieldMask fieldMaskField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField { get { return fieldMaskField_; } set { @@ -276,6 +285,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "source_context_field" field. public const int SourceContextFieldFieldNumber = 6; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContextField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField { get { return sourceContextField_; } set { @@ -286,6 +296,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "struct_field" field. public const int StructFieldFieldNumber = 7; private global::Google.Protobuf.WellKnownTypes.Struct structField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Struct StructField { get { return structField_; } set { @@ -296,6 +307,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "timestamp_field" field. public const int TimestampFieldFieldNumber = 8; private global::Google.Protobuf.WellKnownTypes.Timestamp timestampField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField { get { return timestampField_; } set { @@ -306,6 +318,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "type_field" field. public const int TypeFieldFieldNumber = 9; private global::Google.Protobuf.WellKnownTypes.Type typeField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Type TypeField { get { return typeField_; } set { @@ -317,6 +330,7 @@ namespace Google.Protobuf.TestProtos { public const int DoubleFieldFieldNumber = 10; private static readonly pb::FieldCodec _single_doubleField_codec = pb::FieldCodec.ForStructWrapper(82); private double? doubleField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double? DoubleField { get { return doubleField_; } set { @@ -328,6 +342,7 @@ namespace Google.Protobuf.TestProtos { public const int FloatFieldFieldNumber = 11; private static readonly pb::FieldCodec _single_floatField_codec = pb::FieldCodec.ForStructWrapper(90); private float? floatField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public float? FloatField { get { return floatField_; } set { @@ -339,6 +354,7 @@ namespace Google.Protobuf.TestProtos { public const int Int64FieldFieldNumber = 12; private static readonly pb::FieldCodec _single_int64Field_codec = pb::FieldCodec.ForStructWrapper(98); private long? int64Field_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long? Int64Field { get { return int64Field_; } set { @@ -350,6 +366,7 @@ namespace Google.Protobuf.TestProtos { public const int Uint64FieldFieldNumber = 13; private static readonly pb::FieldCodec _single_uint64Field_codec = pb::FieldCodec.ForStructWrapper(106); private ulong? uint64Field_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong? Uint64Field { get { return uint64Field_; } set { @@ -361,6 +378,7 @@ namespace Google.Protobuf.TestProtos { public const int Int32FieldFieldNumber = 14; private static readonly pb::FieldCodec _single_int32Field_codec = pb::FieldCodec.ForStructWrapper(114); private int? int32Field_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int? Int32Field { get { return int32Field_; } set { @@ -372,6 +390,7 @@ namespace Google.Protobuf.TestProtos { public const int Uint32FieldFieldNumber = 15; private static readonly pb::FieldCodec _single_uint32Field_codec = pb::FieldCodec.ForStructWrapper(122); private uint? uint32Field_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint? Uint32Field { get { return uint32Field_; } set { @@ -383,6 +402,7 @@ namespace Google.Protobuf.TestProtos { public const int BoolFieldFieldNumber = 16; private static readonly pb::FieldCodec _single_boolField_codec = pb::FieldCodec.ForStructWrapper(130); private bool? boolField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool? BoolField { get { return boolField_; } set { @@ -394,6 +414,7 @@ namespace Google.Protobuf.TestProtos { public const int StringFieldFieldNumber = 17; private static readonly pb::FieldCodec _single_stringField_codec = pb::FieldCodec.ForClassWrapper(138); private string stringField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string StringField { get { return stringField_; } set { @@ -405,6 +426,7 @@ namespace Google.Protobuf.TestProtos { public const int BytesFieldFieldNumber = 18; private static readonly pb::FieldCodec _single_bytesField_codec = pb::FieldCodec.ForClassWrapper(146); private pb::ByteString bytesField_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString BytesField { get { return bytesField_; } set { @@ -416,8 +438,9 @@ namespace Google.Protobuf.TestProtos { public const int ValueFieldFieldNumber = 19; private global::Google.Protobuf.WellKnownTypes.Value valueField_; /// - /// Part of struct, but useful to be able to test separately + /// Part of struct, but useful to be able to test separately /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Value ValueField { get { return valueField_; } set { @@ -425,10 +448,12 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TestWellKnownTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TestWellKnownTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -458,6 +483,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (anyField_ != null) hash ^= AnyField.GetHashCode(); @@ -482,10 +508,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (anyField_ != null) { output.WriteRawTag(10); @@ -556,6 +584,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (anyField_ != null) { @@ -618,6 +647,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TestWellKnownTypes other) { if (other == null) { return; @@ -729,6 +759,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -876,27 +907,31 @@ namespace Google.Protobuf.TestProtos { } /// - /// A repeated field for each well-known type. + /// A repeated field for each well-known type. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class RepeatedWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new RepeatedWellKnownTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public RepeatedWellKnownTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public RepeatedWellKnownTypes(RepeatedWellKnownTypes other) : this() { anyField_ = other.anyField_.Clone(); apiField_ = other.apiField_.Clone(); @@ -918,6 +953,7 @@ namespace Google.Protobuf.TestProtos { bytesField_ = other.bytesField_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public RepeatedWellKnownTypes Clone() { return new RepeatedWellKnownTypes(this); } @@ -927,6 +963,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_anyField_codec = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Any.Parser); private readonly pbc::RepeatedField anyField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField AnyField { get { return anyField_; } } @@ -936,6 +973,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_apiField_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser); private readonly pbc::RepeatedField apiField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField ApiField { get { return apiField_; } } @@ -945,6 +983,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_durationField_codec = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Duration.Parser); private readonly pbc::RepeatedField durationField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField DurationField { get { return durationField_; } } @@ -954,6 +993,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_emptyField_codec = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Empty.Parser); private readonly pbc::RepeatedField emptyField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField EmptyField { get { return emptyField_; } } @@ -963,6 +1003,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_fieldMaskField_codec = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser); private readonly pbc::RepeatedField fieldMaskField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField FieldMaskField { get { return fieldMaskField_; } } @@ -972,6 +1013,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_sourceContextField_codec = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser); private readonly pbc::RepeatedField sourceContextField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField SourceContextField { get { return sourceContextField_; } } @@ -981,6 +1023,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_structField_codec = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.WellKnownTypes.Struct.Parser); private readonly pbc::RepeatedField structField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField StructField { get { return structField_; } } @@ -990,6 +1033,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_timestampField_codec = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser); private readonly pbc::RepeatedField timestampField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField TimestampField { get { return timestampField_; } } @@ -999,6 +1043,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_typeField_codec = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Type.Parser); private readonly pbc::RepeatedField typeField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField TypeField { get { return typeField_; } } @@ -1009,8 +1054,9 @@ namespace Google.Protobuf.TestProtos { = pb::FieldCodec.ForStructWrapper(82); private readonly pbc::RepeatedField doubleField_ = new pbc::RepeatedField(); /// - /// These don't actually make a lot of sense, but they're not prohibited... + /// These don't actually make a lot of sense, but they're not prohibited... /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField DoubleField { get { return doubleField_; } } @@ -1020,6 +1066,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_floatField_codec = pb::FieldCodec.ForStructWrapper(90); private readonly pbc::RepeatedField floatField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField FloatField { get { return floatField_; } } @@ -1029,6 +1076,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_int64Field_codec = pb::FieldCodec.ForStructWrapper(98); private readonly pbc::RepeatedField int64Field_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Int64Field { get { return int64Field_; } } @@ -1038,6 +1086,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_uint64Field_codec = pb::FieldCodec.ForStructWrapper(106); private readonly pbc::RepeatedField uint64Field_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Uint64Field { get { return uint64Field_; } } @@ -1047,6 +1096,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_int32Field_codec = pb::FieldCodec.ForStructWrapper(114); private readonly pbc::RepeatedField int32Field_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Int32Field { get { return int32Field_; } } @@ -1056,6 +1106,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_uint32Field_codec = pb::FieldCodec.ForStructWrapper(122); private readonly pbc::RepeatedField uint32Field_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Uint32Field { get { return uint32Field_; } } @@ -1065,6 +1116,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_boolField_codec = pb::FieldCodec.ForStructWrapper(130); private readonly pbc::RepeatedField boolField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField BoolField { get { return boolField_; } } @@ -1074,6 +1126,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_stringField_codec = pb::FieldCodec.ForClassWrapper(138); private readonly pbc::RepeatedField stringField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField StringField { get { return stringField_; } } @@ -1083,14 +1136,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pb::FieldCodec _repeated_bytesField_codec = pb::FieldCodec.ForClassWrapper(146); private readonly pbc::RepeatedField bytesField_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField BytesField { get { return bytesField_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as RepeatedWellKnownTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(RepeatedWellKnownTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -1119,6 +1175,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= anyField_.GetHashCode(); @@ -1142,10 +1199,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { anyField_.WriteTo(output, _repeated_anyField_codec); apiField_.WriteTo(output, _repeated_apiField_codec); @@ -1167,6 +1226,7 @@ namespace Google.Protobuf.TestProtos { bytesField_.WriteTo(output, _repeated_bytesField_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += anyField_.CalculateSize(_repeated_anyField_codec); @@ -1190,6 +1250,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(RepeatedWellKnownTypes other) { if (other == null) { return; @@ -1214,6 +1275,7 @@ namespace Google.Protobuf.TestProtos { bytesField_.Add(other.bytesField_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1299,25 +1361,29 @@ namespace Google.Protobuf.TestProtos { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class OneofWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofWellKnownTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofWellKnownTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofWellKnownTypes(OneofWellKnownTypes other) : this() { switch (other.OneofFieldCase) { case OneofFieldOneofCase.AnyField: @@ -1378,12 +1444,14 @@ namespace Google.Protobuf.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofWellKnownTypes Clone() { return new OneofWellKnownTypes(this); } /// Field number for the "any_field" field. public const int AnyFieldFieldNumber = 1; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Any AnyField { get { return oneofFieldCase_ == OneofFieldOneofCase.AnyField ? (global::Google.Protobuf.WellKnownTypes.Any) oneofField_ : null; } set { @@ -1394,6 +1462,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "api_field" field. public const int ApiFieldFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Api ApiField { get { return oneofFieldCase_ == OneofFieldOneofCase.ApiField ? (global::Google.Protobuf.WellKnownTypes.Api) oneofField_ : null; } set { @@ -1404,6 +1473,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "duration_field" field. public const int DurationFieldFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Duration DurationField { get { return oneofFieldCase_ == OneofFieldOneofCase.DurationField ? (global::Google.Protobuf.WellKnownTypes.Duration) oneofField_ : null; } set { @@ -1414,6 +1484,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "empty_field" field. public const int EmptyFieldFieldNumber = 4; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Empty EmptyField { get { return oneofFieldCase_ == OneofFieldOneofCase.EmptyField ? (global::Google.Protobuf.WellKnownTypes.Empty) oneofField_ : null; } set { @@ -1424,6 +1495,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "field_mask_field" field. public const int FieldMaskFieldFieldNumber = 5; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.FieldMask FieldMaskField { get { return oneofFieldCase_ == OneofFieldOneofCase.FieldMaskField ? (global::Google.Protobuf.WellKnownTypes.FieldMask) oneofField_ : null; } set { @@ -1434,6 +1506,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "source_context_field" field. public const int SourceContextFieldFieldNumber = 6; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContextField { get { return oneofFieldCase_ == OneofFieldOneofCase.SourceContextField ? (global::Google.Protobuf.WellKnownTypes.SourceContext) oneofField_ : null; } set { @@ -1444,6 +1517,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "struct_field" field. public const int StructFieldFieldNumber = 7; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Struct StructField { get { return oneofFieldCase_ == OneofFieldOneofCase.StructField ? (global::Google.Protobuf.WellKnownTypes.Struct) oneofField_ : null; } set { @@ -1454,6 +1528,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "timestamp_field" field. public const int TimestampFieldFieldNumber = 8; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Timestamp TimestampField { get { return oneofFieldCase_ == OneofFieldOneofCase.TimestampField ? (global::Google.Protobuf.WellKnownTypes.Timestamp) oneofField_ : null; } set { @@ -1464,6 +1539,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "type_field" field. public const int TypeFieldFieldNumber = 9; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Type TypeField { get { return oneofFieldCase_ == OneofFieldOneofCase.TypeField ? (global::Google.Protobuf.WellKnownTypes.Type) oneofField_ : null; } set { @@ -1475,6 +1551,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "double_field" field. public const int DoubleFieldFieldNumber = 10; private static readonly pb::FieldCodec _oneof_doubleField_codec = pb::FieldCodec.ForStructWrapper(82); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double? DoubleField { get { return oneofFieldCase_ == OneofFieldOneofCase.DoubleField ? (double?) oneofField_ : (double?) null; } set { @@ -1486,6 +1563,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "float_field" field. public const int FloatFieldFieldNumber = 11; private static readonly pb::FieldCodec _oneof_floatField_codec = pb::FieldCodec.ForStructWrapper(90); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public float? FloatField { get { return oneofFieldCase_ == OneofFieldOneofCase.FloatField ? (float?) oneofField_ : (float?) null; } set { @@ -1497,6 +1575,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "int64_field" field. public const int Int64FieldFieldNumber = 12; private static readonly pb::FieldCodec _oneof_int64Field_codec = pb::FieldCodec.ForStructWrapper(98); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long? Int64Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Int64Field ? (long?) oneofField_ : (long?) null; } set { @@ -1508,6 +1587,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "uint64_field" field. public const int Uint64FieldFieldNumber = 13; private static readonly pb::FieldCodec _oneof_uint64Field_codec = pb::FieldCodec.ForStructWrapper(106); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong? Uint64Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Uint64Field ? (ulong?) oneofField_ : (ulong?) null; } set { @@ -1519,6 +1599,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "int32_field" field. public const int Int32FieldFieldNumber = 14; private static readonly pb::FieldCodec _oneof_int32Field_codec = pb::FieldCodec.ForStructWrapper(114); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int? Int32Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Int32Field ? (int?) oneofField_ : (int?) null; } set { @@ -1530,6 +1611,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "uint32_field" field. public const int Uint32FieldFieldNumber = 15; private static readonly pb::FieldCodec _oneof_uint32Field_codec = pb::FieldCodec.ForStructWrapper(122); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public uint? Uint32Field { get { return oneofFieldCase_ == OneofFieldOneofCase.Uint32Field ? (uint?) oneofField_ : (uint?) null; } set { @@ -1541,6 +1623,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "bool_field" field. public const int BoolFieldFieldNumber = 16; private static readonly pb::FieldCodec _oneof_boolField_codec = pb::FieldCodec.ForStructWrapper(130); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool? BoolField { get { return oneofFieldCase_ == OneofFieldOneofCase.BoolField ? (bool?) oneofField_ : (bool?) null; } set { @@ -1552,6 +1635,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "string_field" field. public const int StringFieldFieldNumber = 17; private static readonly pb::FieldCodec _oneof_stringField_codec = pb::FieldCodec.ForClassWrapper(138); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string StringField { get { return oneofFieldCase_ == OneofFieldOneofCase.StringField ? (string) oneofField_ : (string) null; } set { @@ -1563,6 +1647,7 @@ namespace Google.Protobuf.TestProtos { /// Field number for the "bytes_field" field. public const int BytesFieldFieldNumber = 18; private static readonly pb::FieldCodec _oneof_bytesField_codec = pb::FieldCodec.ForClassWrapper(146); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString BytesField { get { return oneofFieldCase_ == OneofFieldOneofCase.BytesField ? (pb::ByteString) oneofField_ : (pb::ByteString) null; } set { @@ -1595,19 +1680,23 @@ namespace Google.Protobuf.TestProtos { BytesField = 18, } private OneofFieldOneofCase oneofFieldCase_ = OneofFieldOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofFieldOneofCase OneofFieldCase { get { return oneofFieldCase_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearOneofField() { oneofFieldCase_ = OneofFieldOneofCase.None; oneofField_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as OneofWellKnownTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(OneofWellKnownTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -1637,6 +1726,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) hash ^= AnyField.GetHashCode(); @@ -1661,10 +1751,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) { output.WriteRawTag(10); @@ -1731,6 +1823,7 @@ namespace Google.Protobuf.TestProtos { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (oneofFieldCase_ == OneofFieldOneofCase.AnyField) { @@ -1790,6 +1883,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(OneofWellKnownTypes other) { if (other == null) { return; @@ -1853,6 +1947,7 @@ namespace Google.Protobuf.TestProtos { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1984,29 +2079,33 @@ namespace Google.Protobuf.TestProtos { } /// - /// A map field for each well-known type. We only - /// need to worry about the value part of the map being the - /// well-known types, as messages can't be map keys. + /// A map field for each well-known type. We only + /// need to worry about the value part of the map being the + /// well-known types, as messages can't be map keys. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class MapWellKnownTypes : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MapWellKnownTypes()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.TestProtos.UnittestWellKnownTypesReflection.Descriptor.MessageTypes[3]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MapWellKnownTypes() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MapWellKnownTypes(MapWellKnownTypes other) : this() { anyField_ = other.anyField_.Clone(); apiField_ = other.apiField_.Clone(); @@ -2028,6 +2127,7 @@ namespace Google.Protobuf.TestProtos { bytesField_ = other.bytesField_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MapWellKnownTypes Clone() { return new MapWellKnownTypes(this); } @@ -2037,6 +2137,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_anyField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Any.Parser), 10); private readonly pbc::MapField anyField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField AnyField { get { return anyField_; } } @@ -2046,6 +2147,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_apiField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Api.Parser), 18); private readonly pbc::MapField apiField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField ApiField { get { return apiField_; } } @@ -2055,6 +2157,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_durationField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Duration.Parser), 26); private readonly pbc::MapField durationField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField DurationField { get { return durationField_; } } @@ -2064,6 +2167,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_emptyField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Empty.Parser), 34); private readonly pbc::MapField emptyField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField EmptyField { get { return emptyField_; } } @@ -2073,6 +2177,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_fieldMaskField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.FieldMask.Parser), 42); private readonly pbc::MapField fieldMaskField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField FieldMaskField { get { return fieldMaskField_; } } @@ -2082,6 +2187,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_sourceContextField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.SourceContext.Parser), 50); private readonly pbc::MapField sourceContextField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField SourceContextField { get { return sourceContextField_; } } @@ -2091,6 +2197,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_structField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Struct.Parser), 58); private readonly pbc::MapField structField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField StructField { get { return structField_; } } @@ -2100,6 +2207,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_timestampField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Timestamp.Parser), 66); private readonly pbc::MapField timestampField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField TimestampField { get { return timestampField_; } } @@ -2109,6 +2217,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_typeField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Type.Parser), 74); private readonly pbc::MapField typeField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField TypeField { get { return typeField_; } } @@ -2118,6 +2227,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_doubleField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 82); private readonly pbc::MapField doubleField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField DoubleField { get { return doubleField_; } } @@ -2127,6 +2237,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_floatField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 90); private readonly pbc::MapField floatField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField FloatField { get { return floatField_; } } @@ -2136,6 +2247,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_int64Field_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 98); private readonly pbc::MapField int64Field_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Int64Field { get { return int64Field_; } } @@ -2145,6 +2257,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_uint64Field_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 106); private readonly pbc::MapField uint64Field_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Uint64Field { get { return uint64Field_; } } @@ -2154,6 +2267,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_int32Field_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 114); private readonly pbc::MapField int32Field_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Int32Field { get { return int32Field_; } } @@ -2163,6 +2277,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_uint32Field_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 122); private readonly pbc::MapField uint32Field_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Uint32Field { get { return uint32Field_; } } @@ -2172,6 +2287,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_boolField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForStructWrapper(18), 130); private readonly pbc::MapField boolField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField BoolField { get { return boolField_; } } @@ -2181,6 +2297,7 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_stringField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper(18), 138); private readonly pbc::MapField stringField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField StringField { get { return stringField_; } } @@ -2190,14 +2307,17 @@ namespace Google.Protobuf.TestProtos { private static readonly pbc::MapField.Codec _map_bytesField_codec = new pbc::MapField.Codec(pb::FieldCodec.ForInt32(8), pb::FieldCodec.ForClassWrapper(18), 146); private readonly pbc::MapField bytesField_ = new pbc::MapField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField BytesField { get { return bytesField_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MapWellKnownTypes); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MapWellKnownTypes other) { if (ReferenceEquals(other, null)) { return false; @@ -2226,6 +2346,7 @@ namespace Google.Protobuf.TestProtos { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= AnyField.GetHashCode(); @@ -2249,10 +2370,12 @@ namespace Google.Protobuf.TestProtos { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { anyField_.WriteTo(output, _map_anyField_codec); apiField_.WriteTo(output, _map_apiField_codec); @@ -2274,6 +2397,7 @@ namespace Google.Protobuf.TestProtos { bytesField_.WriteTo(output, _map_bytesField_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += anyField_.CalculateSize(_map_anyField_codec); @@ -2297,6 +2421,7 @@ namespace Google.Protobuf.TestProtos { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MapWellKnownTypes other) { if (other == null) { return; @@ -2321,6 +2446,7 @@ namespace Google.Protobuf.TestProtos { bytesField_.Add(other.bytesField_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs index f21be7d9b9..a3edd5950c 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/AnyTest.cs @@ -90,13 +90,41 @@ namespace Google.Protobuf.WellKnownTypes Assert.AreEqual(message, unpacked); } + [Test] + public void TryUnpack_WrongType() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + Assert.False(any.TryUnpack(out TestOneof unpacked)); + Assert.Null(unpacked); + } + + [Test] + public void TryUnpack_RightType() + { + var message = SampleMessages.CreateFullTestAllTypes(); + var any = Any.Pack(message); + Assert.IsTrue(any.TryUnpack(out TestAllTypes unpacked)); + Assert.AreEqual(message, unpacked); + } + [Test] public void ToString_WithValues() { var message = SampleMessages.CreateFullTestAllTypes(); var any = Any.Pack(message); var text = any.ToString(); - Assert.That(text, Is.StringContaining("\"@value\": \"" + message.ToByteString().ToBase64() + "\"")); + Assert.That(text, Does.Contain("\"@value\": \"" + message.ToByteString().ToBase64() + "\"")); + } + + [Test] + [TestCase("proto://foo.bar", "foo.bar")] + [TestCase("/foo/bar/baz", "baz")] + [TestCase("foobar", "")] + public void GetTypeName(string typeUrl, string expectedTypeName) + { + var any = new Any { TypeUrl = typeUrl }; + Assert.AreEqual(expectedTypeName, Any.GetTypeName(typeUrl)); } [Test] diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs index 89bc82759c..1d9908b4d3 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/WellKnownTypes/FieldMaskTest.cs @@ -46,8 +46,8 @@ namespace Google.Protobuf.WellKnownTypes var mask = new FieldMask { Paths = { input } }; var text = mask.ToString(); // More specific test below - Assert.That(text, Is.StringContaining("@warning")); - Assert.That(text, Is.StringContaining(input)); + Assert.That(text, Does.Contain("@warning")); + Assert.That(text, Does.Contain(input)); } [Test] diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/packages.config b/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/packages.config deleted file mode 100644 index c76539928c..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf.Test/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteArray.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteArray.cs index b19962794b..69b6ef8d63 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteArray.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteArray.cs @@ -1,79 +1,79 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; - -namespace Google.Protobuf -{ - /// - /// Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy - /// - internal static class ByteArray - { - /// - /// The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy - /// - private const int CopyThreshold = 12; - - /// - /// Determines which copy routine to use based on the number of bytes to be copied. - /// - internal static void Copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count) - { - if (count > CopyThreshold) - { - Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count); - } - else - { - int stop = srcOffset + count; - for (int i = srcOffset; i < stop; i++) - { - dst[dstOffset++] = src[i]; - } - } - } - - /// - /// Reverses the order of bytes in the array - /// - internal static void Reverse(byte[] bytes) - { - for (int first = 0, last = bytes.Length - 1; first < last; first++, last--) - { - byte temp = bytes[first]; - bytes[first] = bytes[last]; - bytes[last] = temp; - } - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; + +namespace Google.Protobuf +{ + /// + /// Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy + /// + internal static class ByteArray + { + /// + /// The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy + /// + private const int CopyThreshold = 12; + + /// + /// Determines which copy routine to use based on the number of bytes to be copied. + /// + internal static void Copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count) + { + if (count > CopyThreshold) + { + Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count); + } + else + { + int stop = srcOffset + count; + for (int i = srcOffset; i < stop; i++) + { + dst[dstOffset++] = src[i]; + } + } + } + + /// + /// Reverses the order of bytes in the array + /// + internal static void Reverse(byte[] bytes) + { + for (int first = 0, last = bytes.Length - 1; first < last; first++, last--) + { + byte temp = bytes[first]; + bytes[first] = bytes[last]; + bytes[last] = temp; + } + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteString.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteString.cs old mode 100644 new mode 100755 index 11ad6216dd..4abdb7182c --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteString.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/ByteString.cs @@ -1,345 +1,401 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace Google.Protobuf -{ - /// - /// Immutable array of bytes. - /// - public sealed class ByteString : IEnumerable, IEquatable - { - private static readonly ByteString empty = new ByteString(new byte[0]); - - private readonly byte[] bytes; - - /// - /// Unsafe operations that can cause IO Failure and/or other catestrophic side-effects. - /// - internal static class Unsafe - { - /// - /// Constructs a new ByteString from the given byte array. The array is - /// *not* copied, and must not be modified after this constructor is called. - /// - internal static ByteString FromBytes(byte[] bytes) - { - return new ByteString(bytes); - } - - /// - /// Provides direct, unrestricted access to the bytes contained in this instance. - /// You must not modify or resize the byte array returned by this method. - /// - internal static byte[] GetBuffer(ByteString bytes) - { - return bytes.bytes; - } - } - - /// - /// Internal use only. Ensure that the provided array is not mutated and belongs to this instance. - /// - internal static ByteString AttachBytes(byte[] bytes) - { - return new ByteString(bytes); - } - - /// - /// Constructs a new ByteString from the given byte array. The array is - /// *not* copied, and must not be modified after this constructor is called. - /// - private ByteString(byte[] bytes) - { - this.bytes = bytes; - } - - /// - /// Returns an empty ByteString. - /// - public static ByteString Empty - { - get { return empty; } - } - - /// - /// Returns the length of this ByteString in bytes. - /// - public int Length - { - get { return bytes.Length; } - } - - /// - /// Returns true if this byte string is empty, false otherwise. - /// - public bool IsEmpty - { - get { return Length == 0; } - } - - /// - /// Converts this into a byte array. - /// - /// The data is copied - changes to the returned array will not be reflected in this ByteString. - /// A byte array with the same data as this ByteString. - public byte[] ToByteArray() - { - return (byte[]) bytes.Clone(); - } - - /// - /// Converts this into a standard base64 representation. - /// - /// A base64 representation of this ByteString. - public string ToBase64() - { - return Convert.ToBase64String(bytes); - } - - /// - /// Constructs a from the Base64 Encoded String. - /// - public static ByteString FromBase64(string bytes) - { - // By handling the empty string explicitly, we not only optimize but we fix a - // problem on CF 2.0. See issue 61 for details. - return bytes == "" ? Empty : new ByteString(Convert.FromBase64String(bytes)); - } - - /// - /// Constructs a from the given array. The contents - /// are copied, so further modifications to the array will not - /// be reflected in the returned ByteString. - /// This method can also be invoked in ByteString.CopyFrom(0xaa, 0xbb, ...) form - /// which is primarily useful for testing. - /// - public static ByteString CopyFrom(params byte[] bytes) - { - return new ByteString((byte[]) bytes.Clone()); - } - - /// - /// Constructs a from a portion of a byte array. - /// - public static ByteString CopyFrom(byte[] bytes, int offset, int count) - { - byte[] portion = new byte[count]; - ByteArray.Copy(bytes, offset, portion, 0, count); - return new ByteString(portion); - } - - /// - /// Creates a new by encoding the specified text with - /// the given encoding. - /// - public static ByteString CopyFrom(string text, Encoding encoding) - { - return new ByteString(encoding.GetBytes(text)); - } - - /// - /// Creates a new by encoding the specified text in UTF-8. - /// - public static ByteString CopyFromUtf8(string text) - { - return CopyFrom(text, Encoding.UTF8); - } - - /// - /// Retuns the byte at the given index. - /// - public byte this[int index] - { - get { return bytes[index]; } - } - - /// - /// Converts this into a string by applying the given encoding. - /// - /// - /// This method should only be used to convert binary data which was the result of encoding - /// text with the given encoding. - /// - /// The encoding to use to decode the binary data into text. - /// The result of decoding the binary data with the given decoding. - public string ToString(Encoding encoding) - { - return encoding.GetString(bytes, 0, bytes.Length); - } - - /// - /// Converts this into a string by applying the UTF-8 encoding. - /// - /// - /// This method should only be used to convert binary data which was the result of encoding - /// text with UTF-8. - /// - /// The result of decoding the binary data with the given decoding. - public string ToStringUtf8() - { - return ToString(Encoding.UTF8); - } - - /// - /// Returns an iterator over the bytes in this . - /// - /// An iterator over the bytes in this object. - public IEnumerator GetEnumerator() - { - return ((IEnumerable) bytes).GetEnumerator(); - } - - /// - /// Returns an iterator over the bytes in this . - /// - /// An iterator over the bytes in this object. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - /// - /// Creates a CodedInputStream from this ByteString's data. - /// - public CodedInputStream CreateCodedInput() - { - // We trust CodedInputStream not to reveal the provided byte array or modify it - return new CodedInputStream(bytes); - } - - /// - /// Compares two byte strings for equality. - /// - /// The first byte string to compare. - /// The second byte string to compare. - /// true if the byte strings are equal; false otherwise. - public static bool operator ==(ByteString lhs, ByteString rhs) - { - if (ReferenceEquals(lhs, rhs)) - { - return true; - } - if (ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null)) - { - return false; - } - if (lhs.bytes.Length != rhs.bytes.Length) - { - return false; - } - for (int i = 0; i < lhs.Length; i++) - { - if (rhs.bytes[i] != lhs.bytes[i]) - { - return false; - } - } - return true; - } - - /// - /// Compares two byte strings for inequality. - /// - /// The first byte string to compare. - /// The second byte string to compare. - /// false if the byte strings are equal; true otherwise. - public static bool operator !=(ByteString lhs, ByteString rhs) - { - return !(lhs == rhs); - } - - /// - /// Compares this byte string with another object. - /// - /// The object to compare this with. - /// true if refers to an equal ; false otherwise. - public override bool Equals(object obj) - { - return this == (obj as ByteString); - } - - /// - /// Returns a hash code for this object. Two equal byte strings - /// will return the same hash code. - /// - /// A hash code for this object. - public override int GetHashCode() - { - int ret = 23; - foreach (byte b in bytes) - { - ret = (ret << 8) | b; - } - return ret; - } - - /// - /// Compares this byte string with another. - /// - /// The to compare this with. - /// true if refers to an equal byte string; false otherwise. - public bool Equals(ByteString other) - { - return this == other; - } - - /// - /// Used internally by CodedOutputStream to avoid creating a copy for the write - /// - internal void WriteRawBytesTo(CodedOutputStream outputStream) - { - outputStream.WriteRawBytes(bytes, 0, bytes.Length); - } - - /// - /// Copies the entire byte array to the destination array provided at the offset specified. - /// - public void CopyTo(byte[] array, int position) - { - ByteArray.Copy(bytes, 0, array, position, bytes.Length); - } - - /// - /// Writes the entire byte array to the provided stream - /// - public void WriteTo(Stream outputStream) - { - outputStream.Write(bytes, 0, bytes.Length); - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text; +#if !NET35 +using System.Threading; +using System.Threading.Tasks; +#endif +#if NET35 +using Google.Protobuf.Compatibility; +#endif + +namespace Google.Protobuf +{ + /// + /// Immutable array of bytes. + /// + public sealed class ByteString : IEnumerable, IEquatable + { + private static readonly ByteString empty = new ByteString(new byte[0]); + + private readonly byte[] bytes; + + /// + /// Unsafe operations that can cause IO Failure and/or other catestrophic side-effects. + /// + internal static class Unsafe + { + /// + /// Constructs a new ByteString from the given byte array. The array is + /// *not* copied, and must not be modified after this constructor is called. + /// + internal static ByteString FromBytes(byte[] bytes) + { + return new ByteString(bytes); + } + + /// + /// Provides direct, unrestricted access to the bytes contained in this instance. + /// You must not modify or resize the byte array returned by this method. + /// + internal static byte[] GetBuffer(ByteString bytes) + { + return bytes.bytes; + } + } + + /// + /// Internal use only. Ensure that the provided array is not mutated and belongs to this instance. + /// + internal static ByteString AttachBytes(byte[] bytes) + { + return new ByteString(bytes); + } + + /// + /// Constructs a new ByteString from the given byte array. The array is + /// *not* copied, and must not be modified after this constructor is called. + /// + private ByteString(byte[] bytes) + { + this.bytes = bytes; + } + + /// + /// Returns an empty ByteString. + /// + public static ByteString Empty + { + get { return empty; } + } + + /// + /// Returns the length of this ByteString in bytes. + /// + public int Length + { + get { return bytes.Length; } + } + + /// + /// Returns true if this byte string is empty, false otherwise. + /// + public bool IsEmpty + { + get { return Length == 0; } + } + + /// + /// Converts this into a byte array. + /// + /// The data is copied - changes to the returned array will not be reflected in this ByteString. + /// A byte array with the same data as this ByteString. + public byte[] ToByteArray() + { + return (byte[]) bytes.Clone(); + } + + /// + /// Converts this into a standard base64 representation. + /// + /// A base64 representation of this ByteString. + public string ToBase64() + { + return Convert.ToBase64String(bytes); + } + + /// + /// Constructs a from the Base64 Encoded String. + /// + public static ByteString FromBase64(string bytes) + { + // By handling the empty string explicitly, we not only optimize but we fix a + // problem on CF 2.0. See issue 61 for details. + return bytes == "" ? Empty : new ByteString(Convert.FromBase64String(bytes)); + } + + /// + /// Constructs a from data in the given stream, synchronously. + /// + /// If successful, will be read completely, from the position + /// at the start of the call. + /// The stream to copy into a ByteString. + /// A ByteString with content read from the given stream. + public static ByteString FromStream(Stream stream) + { + ProtoPreconditions.CheckNotNull(stream, nameof(stream)); + int capacity = stream.CanSeek ? checked((int) (stream.Length - stream.Position)) : 0; + var memoryStream = new MemoryStream(capacity); + stream.CopyTo(memoryStream); +#if NETSTANDARD1_0 + byte[] bytes = memoryStream.ToArray(); +#else + // Avoid an extra copy if we can. + byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray(); +#endif + return AttachBytes(bytes); + } + +#if !NET35 + /// + /// Constructs a from data in the given stream, asynchronously. + /// + /// If successful, will be read completely, from the position + /// at the start of the call. + /// The stream to copy into a ByteString. + /// The cancellation token to use when reading from the stream, if any. + /// A ByteString with content read from the given stream. + public async static Task FromStreamAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken)) + { + ProtoPreconditions.CheckNotNull(stream, nameof(stream)); + int capacity = stream.CanSeek ? checked((int) (stream.Length - stream.Position)) : 0; + var memoryStream = new MemoryStream(capacity); + // We have to specify the buffer size here, as there's no overload accepting the cancellation token + // alone. But it's documented to use 81920 by default if not specified. + await stream.CopyToAsync(memoryStream, 81920, cancellationToken); +#if NETSTANDARD1_0 + byte[] bytes = memoryStream.ToArray(); +#else + // Avoid an extra copy if we can. + byte[] bytes = memoryStream.Length == memoryStream.Capacity ? memoryStream.GetBuffer() : memoryStream.ToArray(); +#endif + return AttachBytes(bytes); + } +#endif + + /// + /// Constructs a from the given array. The contents + /// are copied, so further modifications to the array will not + /// be reflected in the returned ByteString. + /// This method can also be invoked in ByteString.CopyFrom(0xaa, 0xbb, ...) form + /// which is primarily useful for testing. + /// + public static ByteString CopyFrom(params byte[] bytes) + { + return new ByteString((byte[]) bytes.Clone()); + } + + /// + /// Constructs a from a portion of a byte array. + /// + public static ByteString CopyFrom(byte[] bytes, int offset, int count) + { + byte[] portion = new byte[count]; + ByteArray.Copy(bytes, offset, portion, 0, count); + return new ByteString(portion); + } + + /// + /// Creates a new by encoding the specified text with + /// the given encoding. + /// + public static ByteString CopyFrom(string text, Encoding encoding) + { + return new ByteString(encoding.GetBytes(text)); + } + + /// + /// Creates a new by encoding the specified text in UTF-8. + /// + public static ByteString CopyFromUtf8(string text) + { + return CopyFrom(text, Encoding.UTF8); + } + + /// + /// Retuns the byte at the given index. + /// + public byte this[int index] + { + get { return bytes[index]; } + } + + /// + /// Converts this into a string by applying the given encoding. + /// + /// + /// This method should only be used to convert binary data which was the result of encoding + /// text with the given encoding. + /// + /// The encoding to use to decode the binary data into text. + /// The result of decoding the binary data with the given decoding. + public string ToString(Encoding encoding) + { + return encoding.GetString(bytes, 0, bytes.Length); + } + + /// + /// Converts this into a string by applying the UTF-8 encoding. + /// + /// + /// This method should only be used to convert binary data which was the result of encoding + /// text with UTF-8. + /// + /// The result of decoding the binary data with the given decoding. + public string ToStringUtf8() + { + return ToString(Encoding.UTF8); + } + + /// + /// Returns an iterator over the bytes in this . + /// + /// An iterator over the bytes in this object. + public IEnumerator GetEnumerator() + { + return ((IEnumerable) bytes).GetEnumerator(); + } + + /// + /// Returns an iterator over the bytes in this . + /// + /// An iterator over the bytes in this object. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Creates a CodedInputStream from this ByteString's data. + /// + public CodedInputStream CreateCodedInput() + { + // We trust CodedInputStream not to reveal the provided byte array or modify it + return new CodedInputStream(bytes); + } + + /// + /// Compares two byte strings for equality. + /// + /// The first byte string to compare. + /// The second byte string to compare. + /// true if the byte strings are equal; false otherwise. + public static bool operator ==(ByteString lhs, ByteString rhs) + { + if (ReferenceEquals(lhs, rhs)) + { + return true; + } + if (ReferenceEquals(lhs, null) || ReferenceEquals(rhs, null)) + { + return false; + } + if (lhs.bytes.Length != rhs.bytes.Length) + { + return false; + } + for (int i = 0; i < lhs.Length; i++) + { + if (rhs.bytes[i] != lhs.bytes[i]) + { + return false; + } + } + return true; + } + + /// + /// Compares two byte strings for inequality. + /// + /// The first byte string to compare. + /// The second byte string to compare. + /// false if the byte strings are equal; true otherwise. + public static bool operator !=(ByteString lhs, ByteString rhs) + { + return !(lhs == rhs); + } + + /// + /// Compares this byte string with another object. + /// + /// The object to compare this with. + /// true if refers to an equal ; false otherwise. + public override bool Equals(object obj) + { + return this == (obj as ByteString); + } + + /// + /// Returns a hash code for this object. Two equal byte strings + /// will return the same hash code. + /// + /// A hash code for this object. + public override int GetHashCode() + { + int ret = 23; + foreach (byte b in bytes) + { + ret = (ret * 31) + b; + } + return ret; + } + + /// + /// Compares this byte string with another. + /// + /// The to compare this with. + /// true if refers to an equal byte string; false otherwise. + public bool Equals(ByteString other) + { + return this == other; + } + + /// + /// Used internally by CodedOutputStream to avoid creating a copy for the write + /// + internal void WriteRawBytesTo(CodedOutputStream outputStream) + { + outputStream.WriteRawBytes(bytes, 0, bytes.Length); + } + + /// + /// Copies the entire byte array to the destination array provided at the offset specified. + /// + public void CopyTo(byte[] array, int position) + { + ByteArray.Copy(bytes, 0, array, position, bytes.Length); + } + + /// + /// Writes the entire byte array to the provided stream + /// + public void WriteTo(Stream outputStream) + { + outputStream.Write(bytes, 0, bytes.Length); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedInputStream.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedInputStream.cs index 3484457f64..84f90a2551 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedInputStream.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedInputStream.cs @@ -1,1277 +1,1276 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using Google.Protobuf.Collections; -using System; -using System.Collections.Generic; -using System.IO; - -namespace Google.Protobuf -{ - /// - /// Reads and decodes protocol message fields. - /// - /// - /// - /// This class is generally used by generated code to read appropriate - /// primitives from the stream. It effectively encapsulates the lowest - /// levels of protocol buffer format. - /// - /// - /// Repeated fields and map fields are not handled by this class; use - /// and to serialize such fields. - /// - /// - public sealed class CodedInputStream : IDisposable - { - /// - /// Whether to leave the underlying stream open when disposing of this stream. - /// This is always true when there's no stream. - /// - private readonly bool leaveOpen; - - /// - /// Buffer of data read from the stream or provided at construction time. - /// - private readonly byte[] buffer; - - /// - /// The index of the buffer at which we need to refill from the stream (if there is one). - /// - private int bufferSize; - - private int bufferSizeAfterLimit = 0; - /// - /// The position within the current buffer (i.e. the next byte to read) - /// - private int bufferPos = 0; - - /// - /// The stream to read further input from, or null if the byte array buffer was provided - /// directly on construction, with no further data available. - /// - private readonly Stream input; - - /// - /// The last tag we read. 0 indicates we've read to the end of the stream - /// (or haven't read anything yet). - /// - private uint lastTag = 0; - - /// - /// The next tag, used to store the value read by PeekTag. - /// - private uint nextTag = 0; - private bool hasNextTag = false; - - internal const int DefaultRecursionLimit = 64; - internal const int DefaultSizeLimit = 64 << 20; // 64MB - internal const int BufferSize = 4096; - - /// - /// The total number of bytes read before the current buffer. The - /// total bytes read up to the current position can be computed as - /// totalBytesRetired + bufferPos. - /// - private int totalBytesRetired = 0; - - /// - /// The absolute position of the end of the current message. - /// - private int currentLimit = int.MaxValue; - - private int recursionDepth = 0; - - private readonly int recursionLimit; - private readonly int sizeLimit; - - #region Construction - // Note that the checks are performed such that we don't end up checking obviously-valid things - // like non-null references for arrays we've just created. - - /// - /// Creates a new CodedInputStream reading data from the given byte array. - /// - public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length) - { - } - - /// - /// Creates a new that reads from the given byte array slice. - /// - public CodedInputStream(byte[] buffer, int offset, int length) - : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length) - { - if (offset < 0 || offset > buffer.Length) - { - throw new ArgumentOutOfRangeException("offset", "Offset must be within the buffer"); - } - if (length < 0 || offset + length > buffer.Length) - { - throw new ArgumentOutOfRangeException("length", "Length must be non-negative and within the buffer"); - } - } - - /// - /// Creates a new reading data from the given stream, which will be disposed - /// when the returned object is disposed. - /// - /// The stream to read from. - public CodedInputStream(Stream input) : this(input, false) - { - } - - /// - /// Creates a new reading data from the given stream. - /// - /// The stream to read from. - /// true to leave open when the returned - /// is disposed; false to dispose of the given stream when the - /// returned object is disposed. - public CodedInputStream(Stream input, bool leaveOpen) - : this(ProtoPreconditions.CheckNotNull(input, "input"), new byte[BufferSize], 0, 0) - { - this.leaveOpen = leaveOpen; - } - - /// - /// Creates a new CodedInputStream reading data from the given - /// stream and buffer, using the default limits. - /// - internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize) - { - this.input = input; - this.buffer = buffer; - this.bufferPos = bufferPos; - this.bufferSize = bufferSize; - this.sizeLimit = DefaultSizeLimit; - this.recursionLimit = DefaultRecursionLimit; - } - - /// - /// Creates a new CodedInputStream reading data from the given - /// stream and buffer, using the specified limits. - /// - /// - /// This chains to the version with the default limits instead of vice versa to avoid - /// having to check that the default values are valid every time. - /// - internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit) - : this(input, buffer, bufferPos, bufferSize) - { - if (sizeLimit <= 0) - { - throw new ArgumentOutOfRangeException("sizeLimit", "Size limit must be positive"); - } - if (recursionLimit <= 0) - { - throw new ArgumentOutOfRangeException("recursionLimit!", "Recursion limit must be positive"); - } - this.sizeLimit = sizeLimit; - this.recursionLimit = recursionLimit; - } - #endregion - - /// - /// Creates a with the specified size and recursion limits, reading - /// from an input stream. - /// - /// - /// This method exists separately from the constructor to reduce the number of constructor overloads. - /// It is likely to be used considerably less frequently than the constructors, as the default limits - /// are suitable for most use cases. - /// - /// The input stream to read from - /// The total limit of data to read from the stream. - /// The maximum recursion depth to allow while reading. - /// A CodedInputStream reading from with the specified size - /// and recursion limits. - public static CodedInputStream CreateWithLimits(Stream input, int sizeLimit, int recursionLimit) - { - return new CodedInputStream(input, new byte[BufferSize], 0, 0, sizeLimit, recursionLimit); - } - - /// - /// Returns the current position in the input stream, or the position in the input buffer - /// - public long Position - { - get - { - if (input != null) - { - return input.Position - ((bufferSize + bufferSizeAfterLimit) - bufferPos); - } - return bufferPos; - } - } - - /// - /// Returns the last tag read, or 0 if no tags have been read or we've read beyond - /// the end of the stream. - /// - internal uint LastTag { get { return lastTag; } } - - /// - /// Returns the size limit for this stream. - /// - /// - /// This limit is applied when reading from the underlying stream, as a sanity check. It is - /// not applied when reading from a byte array data source without an underlying stream. - /// The default value is 64MB. - /// - /// - /// The size limit. - /// - public int SizeLimit { get { return sizeLimit; } } - - /// - /// Returns the recursion limit for this stream. This limit is applied whilst reading messages, - /// to avoid maliciously-recursive data. - /// - /// - /// The default limit is 64. - /// - /// - /// The recursion limit for this stream. - /// - public int RecursionLimit { get { return recursionLimit; } } - - /// - /// Disposes of this instance, potentially closing any underlying stream. - /// - /// - /// As there is no flushing to perform here, disposing of a which - /// was constructed with the leaveOpen option parameter set to true (or one which - /// was constructed to read from a byte array) has no effect. - /// - public void Dispose() - { - if (!leaveOpen) - { - input.Dispose(); - } - } - - #region Validation - /// - /// Verifies that the last call to ReadTag() returned tag 0 - in other words, - /// we've reached the end of the stream when we expected to. - /// - /// The - /// tag read was not the one specified - internal void CheckReadEndOfStreamTag() - { - if (lastTag != 0) - { - throw InvalidProtocolBufferException.MoreDataAvailable(); - } - } - #endregion - - #region Reading of tags etc - - /// - /// Peeks at the next field tag. This is like calling , but the - /// tag is not consumed. (So a subsequent call to will return the - /// same value.) - /// - public uint PeekTag() - { - if (hasNextTag) - { - return nextTag; - } - - uint savedLast = lastTag; - nextTag = ReadTag(); - hasNextTag = true; - lastTag = savedLast; // Undo the side effect of ReadTag - return nextTag; - } - - /// - /// Reads a field tag, returning the tag of 0 for "end of stream". - /// - /// - /// If this method returns 0, it doesn't necessarily mean the end of all - /// the data in this CodedInputStream; it may be the end of the logical stream - /// for an embedded message, for example. - /// - /// The next field tag, or 0 for end of stream. (0 is never a valid tag.) - public uint ReadTag() - { - if (hasNextTag) - { - lastTag = nextTag; - hasNextTag = false; - return lastTag; - } - - // Optimize for the incredibly common case of having at least two bytes left in the buffer, - // and those two bytes being enough to get the tag. This will be true for fields up to 4095. - if (bufferPos + 2 <= bufferSize) - { - int tmp = buffer[bufferPos++]; - if (tmp < 128) - { - lastTag = (uint)tmp; - } - else - { - int result = tmp & 0x7f; - if ((tmp = buffer[bufferPos++]) < 128) - { - result |= tmp << 7; - lastTag = (uint) result; - } - else - { - // Nope, rewind and go the potentially slow route. - bufferPos -= 2; - lastTag = ReadRawVarint32(); - } - } - } - else - { - if (IsAtEnd) - { - lastTag = 0; - return 0; // This is the only case in which we return 0. - } - - lastTag = ReadRawVarint32(); - } - if (lastTag == 0) - { - // If we actually read zero, that's not a valid tag. - throw InvalidProtocolBufferException.InvalidTag(); - } - return lastTag; - } - - /// - /// Skips the data for the field with the tag we've just read. - /// This should be called directly after , when - /// the caller wishes to skip an unknown field. - /// - /// - /// This method throws if the last-read tag was an end-group tag. - /// If a caller wishes to skip a group, they should skip the whole group, by calling this method after reading the - /// start-group tag. This behavior allows callers to call this method on any field they don't understand, correctly - /// resulting in an error if an end-group tag has not been paired with an earlier start-group tag. - /// - /// The last tag was an end-group tag - /// The last read operation read to the end of the logical stream - public void SkipLastField() - { - if (lastTag == 0) - { - throw new InvalidOperationException("SkipLastField cannot be called at the end of a stream"); - } - switch (WireFormat.GetTagWireType(lastTag)) - { - case WireFormat.WireType.StartGroup: - SkipGroup(lastTag); - break; - case WireFormat.WireType.EndGroup: - throw new InvalidProtocolBufferException( - "SkipLastField called on an end-group tag, indicating that the corresponding start-group was missing"); - case WireFormat.WireType.Fixed32: - ReadFixed32(); - break; - case WireFormat.WireType.Fixed64: - ReadFixed64(); - break; - case WireFormat.WireType.LengthDelimited: - var length = ReadLength(); - SkipRawBytes(length); - break; - case WireFormat.WireType.Varint: - ReadRawVarint32(); - break; - } - } - - private void SkipGroup(uint startGroupTag) - { - // Note: Currently we expect this to be the way that groups are read. We could put the recursion - // depth changes into the ReadTag method instead, potentially... - recursionDepth++; - if (recursionDepth >= recursionLimit) - { - throw InvalidProtocolBufferException.RecursionLimitExceeded(); - } - uint tag; - while (true) - { - tag = ReadTag(); - if (tag == 0) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - // Can't call SkipLastField for this case- that would throw. - if (WireFormat.GetTagWireType(tag) == WireFormat.WireType.EndGroup) - { - break; - } - // This recursion will allow us to handle nested groups. - SkipLastField(); - } - int startField = WireFormat.GetTagFieldNumber(startGroupTag); - int endField = WireFormat.GetTagFieldNumber(tag); - if (startField != endField) - { - throw new InvalidProtocolBufferException( - $"Mismatched end-group tag. Started with field {startField}; ended with field {endField}"); - } - recursionDepth--; - } - - /// - /// Reads a double field from the stream. - /// - public double ReadDouble() - { - return BitConverter.Int64BitsToDouble((long) ReadRawLittleEndian64()); - } - - /// - /// Reads a float field from the stream. - /// - public float ReadFloat() - { - if (BitConverter.IsLittleEndian && 4 <= bufferSize - bufferPos) - { - float ret = BitConverter.ToSingle(buffer, bufferPos); - bufferPos += 4; - return ret; - } - else - { - byte[] rawBytes = ReadRawBytes(4); - if (!BitConverter.IsLittleEndian) - { - ByteArray.Reverse(rawBytes); - } - return BitConverter.ToSingle(rawBytes, 0); - } - } - - /// - /// Reads a uint64 field from the stream. - /// - public ulong ReadUInt64() - { - return ReadRawVarint64(); - } - - /// - /// Reads an int64 field from the stream. - /// - public long ReadInt64() - { - return (long) ReadRawVarint64(); - } - - /// - /// Reads an int32 field from the stream. - /// - public int ReadInt32() - { - return (int) ReadRawVarint32(); - } - - /// - /// Reads a fixed64 field from the stream. - /// - public ulong ReadFixed64() - { - return ReadRawLittleEndian64(); - } - - /// - /// Reads a fixed32 field from the stream. - /// - public uint ReadFixed32() - { - return ReadRawLittleEndian32(); - } - - /// - /// Reads a bool field from the stream. - /// - public bool ReadBool() - { - return ReadRawVarint32() != 0; - } - - /// - /// Reads a string field from the stream. - /// - public string ReadString() - { - int length = ReadLength(); - // No need to read any data for an empty string. - if (length == 0) - { - return ""; - } - if (length <= bufferSize - bufferPos) - { - // Fast path: We already have the bytes in a contiguous buffer, so - // just copy directly from it. - String result = CodedOutputStream.Utf8Encoding.GetString(buffer, bufferPos, length); - bufferPos += length; - return result; - } - // Slow path: Build a byte array first then copy it. - return CodedOutputStream.Utf8Encoding.GetString(ReadRawBytes(length), 0, length); - } - - /// - /// Reads an embedded message field value from the stream. - /// - public void ReadMessage(IMessage builder) - { - int length = ReadLength(); - if (recursionDepth >= recursionLimit) - { - throw InvalidProtocolBufferException.RecursionLimitExceeded(); - } - int oldLimit = PushLimit(length); - ++recursionDepth; - builder.MergeFrom(this); - CheckReadEndOfStreamTag(); - // Check that we've read exactly as much data as expected. - if (!ReachedLimit) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - --recursionDepth; - PopLimit(oldLimit); - } - - /// - /// Reads a bytes field value from the stream. - /// - public ByteString ReadBytes() - { - int length = ReadLength(); - if (length <= bufferSize - bufferPos && length > 0) - { - // Fast path: We already have the bytes in a contiguous buffer, so - // just copy directly from it. - ByteString result = ByteString.CopyFrom(buffer, bufferPos, length); - bufferPos += length; - return result; - } - else - { - // Slow path: Build a byte array and attach it to a new ByteString. - return ByteString.AttachBytes(ReadRawBytes(length)); - } - } - - /// - /// Reads a uint32 field value from the stream. - /// - public uint ReadUInt32() - { - return ReadRawVarint32(); - } - - /// - /// Reads an enum field value from the stream. If the enum is valid for type T, - /// then the ref value is set and it returns true. Otherwise the unknown output - /// value is set and this method returns false. - /// - public int ReadEnum() - { - // Currently just a pass-through, but it's nice to separate it logically from WriteInt32. - return (int) ReadRawVarint32(); - } - - /// - /// Reads an sfixed32 field value from the stream. - /// - public int ReadSFixed32() - { - return (int) ReadRawLittleEndian32(); - } - - /// - /// Reads an sfixed64 field value from the stream. - /// - public long ReadSFixed64() - { - return (long) ReadRawLittleEndian64(); - } - - /// - /// Reads an sint32 field value from the stream. - /// - public int ReadSInt32() - { - return DecodeZigZag32(ReadRawVarint32()); - } - - /// - /// Reads an sint64 field value from the stream. - /// - public long ReadSInt64() - { - return DecodeZigZag64(ReadRawVarint64()); - } - - /// - /// Reads a length for length-delimited data. - /// - /// - /// This is internally just reading a varint, but this method exists - /// to make the calling code clearer. - /// - public int ReadLength() - { - return (int) ReadRawVarint32(); - } - - /// - /// Peeks at the next tag in the stream. If it matches , - /// the tag is consumed and the method returns true; otherwise, the - /// stream is left in the original position and the method returns false. - /// - public bool MaybeConsumeTag(uint tag) - { - if (PeekTag() == tag) - { - hasNextTag = false; - return true; - } - return false; - } - - #endregion - - #region Underlying reading primitives - - /// - /// Same code as ReadRawVarint32, but read each byte individually, checking for - /// buffer overflow. - /// - private uint SlowReadRawVarint32() - { - int tmp = ReadRawByte(); - if (tmp < 128) - { - return (uint) tmp; - } - int result = tmp & 0x7f; - if ((tmp = ReadRawByte()) < 128) - { - result |= tmp << 7; - } - else - { - result |= (tmp & 0x7f) << 7; - if ((tmp = ReadRawByte()) < 128) - { - result |= tmp << 14; - } - else - { - result |= (tmp & 0x7f) << 14; - if ((tmp = ReadRawByte()) < 128) - { - result |= tmp << 21; - } - else - { - result |= (tmp & 0x7f) << 21; - result |= (tmp = ReadRawByte()) << 28; - if (tmp >= 128) - { - // Discard upper 32 bits. - for (int i = 0; i < 5; i++) - { - if (ReadRawByte() < 128) - { - return (uint) result; - } - } - throw InvalidProtocolBufferException.MalformedVarint(); - } - } - } - } - return (uint) result; - } - - /// - /// Reads a raw Varint from the stream. If larger than 32 bits, discard the upper bits. - /// This method is optimised for the case where we've got lots of data in the buffer. - /// That means we can check the size just once, then just read directly from the buffer - /// without constant rechecking of the buffer length. - /// - internal uint ReadRawVarint32() - { - if (bufferPos + 5 > bufferSize) - { - return SlowReadRawVarint32(); - } - - int tmp = buffer[bufferPos++]; - if (tmp < 128) - { - return (uint) tmp; - } - int result = tmp & 0x7f; - if ((tmp = buffer[bufferPos++]) < 128) - { - result |= tmp << 7; - } - else - { - result |= (tmp & 0x7f) << 7; - if ((tmp = buffer[bufferPos++]) < 128) - { - result |= tmp << 14; - } - else - { - result |= (tmp & 0x7f) << 14; - if ((tmp = buffer[bufferPos++]) < 128) - { - result |= tmp << 21; - } - else - { - result |= (tmp & 0x7f) << 21; - result |= (tmp = buffer[bufferPos++]) << 28; - if (tmp >= 128) - { - // Discard upper 32 bits. - // Note that this has to use ReadRawByte() as we only ensure we've - // got at least 5 bytes at the start of the method. This lets us - // use the fast path in more cases, and we rarely hit this section of code. - for (int i = 0; i < 5; i++) - { - if (ReadRawByte() < 128) - { - return (uint) result; - } - } - throw InvalidProtocolBufferException.MalformedVarint(); - } - } - } - } - return (uint) result; - } - - /// - /// Reads a varint from the input one byte at a time, so that it does not - /// read any bytes after the end of the varint. If you simply wrapped the - /// stream in a CodedInputStream and used ReadRawVarint32(Stream) - /// then you would probably end up reading past the end of the varint since - /// CodedInputStream buffers its input. - /// - /// - /// - internal static uint ReadRawVarint32(Stream input) - { - int result = 0; - int offset = 0; - for (; offset < 32; offset += 7) - { - int b = input.ReadByte(); - if (b == -1) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - result |= (b & 0x7f) << offset; - if ((b & 0x80) == 0) - { - return (uint) result; - } - } - // Keep reading up to 64 bits. - for (; offset < 64; offset += 7) - { - int b = input.ReadByte(); - if (b == -1) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - if ((b & 0x80) == 0) - { - return (uint) result; - } - } - throw InvalidProtocolBufferException.MalformedVarint(); - } - - /// - /// Reads a raw varint from the stream. - /// - internal ulong ReadRawVarint64() - { - int shift = 0; - ulong result = 0; - while (shift < 64) - { - byte b = ReadRawByte(); - result |= (ulong) (b & 0x7F) << shift; - if ((b & 0x80) == 0) - { - return result; - } - shift += 7; - } - throw InvalidProtocolBufferException.MalformedVarint(); - } - - /// - /// Reads a 32-bit little-endian integer from the stream. - /// - internal uint ReadRawLittleEndian32() - { - uint b1 = ReadRawByte(); - uint b2 = ReadRawByte(); - uint b3 = ReadRawByte(); - uint b4 = ReadRawByte(); - return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24); - } - - /// - /// Reads a 64-bit little-endian integer from the stream. - /// - internal ulong ReadRawLittleEndian64() - { - ulong b1 = ReadRawByte(); - ulong b2 = ReadRawByte(); - ulong b3 = ReadRawByte(); - ulong b4 = ReadRawByte(); - ulong b5 = ReadRawByte(); - ulong b6 = ReadRawByte(); - ulong b7 = ReadRawByte(); - ulong b8 = ReadRawByte(); - return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) - | (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56); - } - - /// - /// Decode a 32-bit value with ZigZag encoding. - /// - /// - /// ZigZag encodes signed integers into values that can be efficiently - /// encoded with varint. (Otherwise, negative values must be - /// sign-extended to 64 bits to be varint encoded, thus always taking - /// 10 bytes on the wire.) - /// - internal static int DecodeZigZag32(uint n) - { - return (int)(n >> 1) ^ -(int)(n & 1); - } - - /// - /// Decode a 32-bit value with ZigZag encoding. - /// - /// - /// ZigZag encodes signed integers into values that can be efficiently - /// encoded with varint. (Otherwise, negative values must be - /// sign-extended to 64 bits to be varint encoded, thus always taking - /// 10 bytes on the wire.) - /// - internal static long DecodeZigZag64(ulong n) - { - return (long)(n >> 1) ^ -(long)(n & 1); - } - #endregion - - #region Internal reading and buffer management - - /// - /// Sets currentLimit to (current position) + byteLimit. This is called - /// when descending into a length-delimited embedded message. The previous - /// limit is returned. - /// - /// The old limit. - internal int PushLimit(int byteLimit) - { - if (byteLimit < 0) - { - throw InvalidProtocolBufferException.NegativeSize(); - } - byteLimit += totalBytesRetired + bufferPos; - int oldLimit = currentLimit; - if (byteLimit > oldLimit) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - currentLimit = byteLimit; - - RecomputeBufferSizeAfterLimit(); - - return oldLimit; - } - - private void RecomputeBufferSizeAfterLimit() - { - bufferSize += bufferSizeAfterLimit; - int bufferEnd = totalBytesRetired + bufferSize; - if (bufferEnd > currentLimit) - { - // Limit is in current buffer. - bufferSizeAfterLimit = bufferEnd - currentLimit; - bufferSize -= bufferSizeAfterLimit; - } - else - { - bufferSizeAfterLimit = 0; - } - } - - /// - /// Discards the current limit, returning the previous limit. - /// - internal void PopLimit(int oldLimit) - { - currentLimit = oldLimit; - RecomputeBufferSizeAfterLimit(); - } - - /// - /// Returns whether or not all the data before the limit has been read. - /// - /// - internal bool ReachedLimit - { - get - { - if (currentLimit == int.MaxValue) - { - return false; - } - int currentAbsolutePosition = totalBytesRetired + bufferPos; - return currentAbsolutePosition >= currentLimit; - } - } - - /// - /// Returns true if the stream has reached the end of the input. This is the - /// case if either the end of the underlying input source has been reached or - /// the stream has reached a limit created using PushLimit. - /// - public bool IsAtEnd - { - get { return bufferPos == bufferSize && !RefillBuffer(false); } - } - - /// - /// Called when buffer is empty to read more bytes from the - /// input. If is true, RefillBuffer() gurantees that - /// either there will be at least one byte in the buffer when it returns - /// or it will throw an exception. If is false, - /// RefillBuffer() returns false if no more bytes were available. - /// - /// - /// - private bool RefillBuffer(bool mustSucceed) - { - if (bufferPos < bufferSize) - { - throw new InvalidOperationException("RefillBuffer() called when buffer wasn't empty."); - } - - if (totalBytesRetired + bufferSize == currentLimit) - { - // Oops, we hit a limit. - if (mustSucceed) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - else - { - return false; - } - } - - totalBytesRetired += bufferSize; - - bufferPos = 0; - bufferSize = (input == null) ? 0 : input.Read(buffer, 0, buffer.Length); - if (bufferSize < 0) - { - throw new InvalidOperationException("Stream.Read returned a negative count"); - } - if (bufferSize == 0) - { - if (mustSucceed) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - else - { - return false; - } - } - else - { - RecomputeBufferSizeAfterLimit(); - int totalBytesRead = - totalBytesRetired + bufferSize + bufferSizeAfterLimit; - if (totalBytesRead > sizeLimit || totalBytesRead < 0) - { - throw InvalidProtocolBufferException.SizeLimitExceeded(); - } - return true; - } - } - - /// - /// Read one byte from the input. - /// - /// - /// the end of the stream or the current limit was reached - /// - internal byte ReadRawByte() - { - if (bufferPos == bufferSize) - { - RefillBuffer(true); - } - return buffer[bufferPos++]; - } - - /// - /// Reads a fixed size of bytes from the input. - /// - /// - /// the end of the stream or the current limit was reached - /// - internal byte[] ReadRawBytes(int size) - { - if (size < 0) - { - throw InvalidProtocolBufferException.NegativeSize(); - } - - if (totalBytesRetired + bufferPos + size > currentLimit) - { - // Read to the end of the stream (up to the current limit) anyway. - SkipRawBytes(currentLimit - totalBytesRetired - bufferPos); - // Then fail. - throw InvalidProtocolBufferException.TruncatedMessage(); - } - - if (size <= bufferSize - bufferPos) - { - // We have all the bytes we need already. - byte[] bytes = new byte[size]; - ByteArray.Copy(buffer, bufferPos, bytes, 0, size); - bufferPos += size; - return bytes; - } - else if (size < buffer.Length) - { - // Reading more bytes than are in the buffer, but not an excessive number - // of bytes. We can safely allocate the resulting array ahead of time. - - // First copy what we have. - byte[] bytes = new byte[size]; - int pos = bufferSize - bufferPos; - ByteArray.Copy(buffer, bufferPos, bytes, 0, pos); - bufferPos = bufferSize; - - // We want to use RefillBuffer() and then copy from the buffer into our - // byte array rather than reading directly into our byte array because - // the input may be unbuffered. - RefillBuffer(true); - - while (size - pos > bufferSize) - { - Buffer.BlockCopy(buffer, 0, bytes, pos, bufferSize); - pos += bufferSize; - bufferPos = bufferSize; - RefillBuffer(true); - } - - ByteArray.Copy(buffer, 0, bytes, pos, size - pos); - bufferPos = size - pos; - - return bytes; - } - else - { - // The size is very large. For security reasons, we can't allocate the - // entire byte array yet. The size comes directly from the input, so a - // maliciously-crafted message could provide a bogus very large size in - // order to trick the app into allocating a lot of memory. We avoid this - // by allocating and reading only a small chunk at a time, so that the - // malicious message must actually *be* extremely large to cause - // problems. Meanwhile, we limit the allowed size of a message elsewhere. - - // Remember the buffer markers since we'll have to copy the bytes out of - // it later. - int originalBufferPos = bufferPos; - int originalBufferSize = bufferSize; - - // Mark the current buffer consumed. - totalBytesRetired += bufferSize; - bufferPos = 0; - bufferSize = 0; - - // Read all the rest of the bytes we need. - int sizeLeft = size - (originalBufferSize - originalBufferPos); - List chunks = new List(); - - while (sizeLeft > 0) - { - byte[] chunk = new byte[Math.Min(sizeLeft, buffer.Length)]; - int pos = 0; - while (pos < chunk.Length) - { - int n = (input == null) ? -1 : input.Read(chunk, pos, chunk.Length - pos); - if (n <= 0) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - totalBytesRetired += n; - pos += n; - } - sizeLeft -= chunk.Length; - chunks.Add(chunk); - } - - // OK, got everything. Now concatenate it all into one buffer. - byte[] bytes = new byte[size]; - - // Start by copying the leftover bytes from this.buffer. - int newPos = originalBufferSize - originalBufferPos; - ByteArray.Copy(buffer, originalBufferPos, bytes, 0, newPos); - - // And now all the chunks. - foreach (byte[] chunk in chunks) - { - Buffer.BlockCopy(chunk, 0, bytes, newPos, chunk.Length); - newPos += chunk.Length; - } - - // Done. - return bytes; - } - } - - /// - /// Reads and discards bytes. - /// - /// the end of the stream - /// or the current limit was reached - private void SkipRawBytes(int size) - { - if (size < 0) - { - throw InvalidProtocolBufferException.NegativeSize(); - } - - if (totalBytesRetired + bufferPos + size > currentLimit) - { - // Read to the end of the stream anyway. - SkipRawBytes(currentLimit - totalBytesRetired - bufferPos); - // Then fail. - throw InvalidProtocolBufferException.TruncatedMessage(); - } - - if (size <= bufferSize - bufferPos) - { - // We have all the bytes we need already. - bufferPos += size; - } - else - { - // Skipping more bytes than are in the buffer. First skip what we have. - int pos = bufferSize - bufferPos; - - // ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize) - // totalBytesRetired += pos; - totalBytesRetired += bufferSize; - - bufferPos = 0; - bufferSize = 0; - - // Then skip directly from the InputStream for the rest. - if (pos < size) - { - if (input == null) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - SkipImpl(size - pos); - totalBytesRetired += size - pos; - } - } - } - - /// - /// Abstraction of skipping to cope with streams which can't really skip. - /// - private void SkipImpl(int amountToSkip) - { - if (input.CanSeek) - { - long previousPosition = input.Position; - input.Position += amountToSkip; - if (input.Position != previousPosition + amountToSkip) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - } - else - { - byte[] skipBuffer = new byte[Math.Min(1024, amountToSkip)]; - while (amountToSkip > 0) - { - int bytesRead = input.Read(skipBuffer, 0, Math.Min(skipBuffer.Length, amountToSkip)); - if (bytesRead <= 0) - { - throw InvalidProtocolBufferException.TruncatedMessage(); - } - amountToSkip -= bytesRead; - } - } - } - - #endregion - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Collections; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Google.Protobuf +{ + /// + /// Reads and decodes protocol message fields. + /// + /// + /// + /// This class is generally used by generated code to read appropriate + /// primitives from the stream. It effectively encapsulates the lowest + /// levels of protocol buffer format. + /// + /// + /// Repeated fields and map fields are not handled by this class; use + /// and to serialize such fields. + /// + /// + public sealed class CodedInputStream : IDisposable + { + /// + /// Whether to leave the underlying stream open when disposing of this stream. + /// This is always true when there's no stream. + /// + private readonly bool leaveOpen; + + /// + /// Buffer of data read from the stream or provided at construction time. + /// + private readonly byte[] buffer; + + /// + /// The index of the buffer at which we need to refill from the stream (if there is one). + /// + private int bufferSize; + + private int bufferSizeAfterLimit = 0; + /// + /// The position within the current buffer (i.e. the next byte to read) + /// + private int bufferPos = 0; + + /// + /// The stream to read further input from, or null if the byte array buffer was provided + /// directly on construction, with no further data available. + /// + private readonly Stream input; + + /// + /// The last tag we read. 0 indicates we've read to the end of the stream + /// (or haven't read anything yet). + /// + private uint lastTag = 0; + + /// + /// The next tag, used to store the value read by PeekTag. + /// + private uint nextTag = 0; + private bool hasNextTag = false; + + internal const int DefaultRecursionLimit = 64; + internal const int DefaultSizeLimit = 64 << 20; // 64MB + internal const int BufferSize = 4096; + + /// + /// The total number of bytes read before the current buffer. The + /// total bytes read up to the current position can be computed as + /// totalBytesRetired + bufferPos. + /// + private int totalBytesRetired = 0; + + /// + /// The absolute position of the end of the current message. + /// + private int currentLimit = int.MaxValue; + + private int recursionDepth = 0; + + private readonly int recursionLimit; + private readonly int sizeLimit; + + #region Construction + // Note that the checks are performed such that we don't end up checking obviously-valid things + // like non-null references for arrays we've just created. + + /// + /// Creates a new CodedInputStream reading data from the given byte array. + /// + public CodedInputStream(byte[] buffer) : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length, true) + { + } + + /// + /// Creates a new that reads from the given byte array slice. + /// + public CodedInputStream(byte[] buffer, int offset, int length) + : this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length, true) + { + if (offset < 0 || offset > buffer.Length) + { + throw new ArgumentOutOfRangeException("offset", "Offset must be within the buffer"); + } + if (length < 0 || offset + length > buffer.Length) + { + throw new ArgumentOutOfRangeException("length", "Length must be non-negative and within the buffer"); + } + } + + /// + /// Creates a new reading data from the given stream, which will be disposed + /// when the returned object is disposed. + /// + /// The stream to read from. + public CodedInputStream(Stream input) : this(input, false) + { + } + + /// + /// Creates a new reading data from the given stream. + /// + /// The stream to read from. + /// true to leave open when the returned + /// is disposed; false to dispose of the given stream when the + /// returned object is disposed. + public CodedInputStream(Stream input, bool leaveOpen) + : this(ProtoPreconditions.CheckNotNull(input, "input"), new byte[BufferSize], 0, 0, leaveOpen) + { + } + + /// + /// Creates a new CodedInputStream reading data from the given + /// stream and buffer, using the default limits. + /// + internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, bool leaveOpen) + { + this.input = input; + this.buffer = buffer; + this.bufferPos = bufferPos; + this.bufferSize = bufferSize; + this.sizeLimit = DefaultSizeLimit; + this.recursionLimit = DefaultRecursionLimit; + this.leaveOpen = leaveOpen; + } + + /// + /// Creates a new CodedInputStream reading data from the given + /// stream and buffer, using the specified limits. + /// + /// + /// This chains to the version with the default limits instead of vice versa to avoid + /// having to check that the default values are valid every time. + /// + internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit, bool leaveOpen) + : this(input, buffer, bufferPos, bufferSize, leaveOpen) + { + if (sizeLimit <= 0) + { + throw new ArgumentOutOfRangeException("sizeLimit", "Size limit must be positive"); + } + if (recursionLimit <= 0) + { + throw new ArgumentOutOfRangeException("recursionLimit!", "Recursion limit must be positive"); + } + this.sizeLimit = sizeLimit; + this.recursionLimit = recursionLimit; + } + #endregion + + /// + /// Creates a with the specified size and recursion limits, reading + /// from an input stream. + /// + /// + /// This method exists separately from the constructor to reduce the number of constructor overloads. + /// It is likely to be used considerably less frequently than the constructors, as the default limits + /// are suitable for most use cases. + /// + /// The input stream to read from + /// The total limit of data to read from the stream. + /// The maximum recursion depth to allow while reading. + /// A CodedInputStream reading from with the specified size + /// and recursion limits. + public static CodedInputStream CreateWithLimits(Stream input, int sizeLimit, int recursionLimit) + { + // Note: we may want an overload accepting leaveOpen + return new CodedInputStream(input, new byte[BufferSize], 0, 0, sizeLimit, recursionLimit, false); + } + + /// + /// Returns the current position in the input stream, or the position in the input buffer + /// + public long Position + { + get + { + if (input != null) + { + return input.Position - ((bufferSize + bufferSizeAfterLimit) - bufferPos); + } + return bufferPos; + } + } + + /// + /// Returns the last tag read, or 0 if no tags have been read or we've read beyond + /// the end of the stream. + /// + internal uint LastTag { get { return lastTag; } } + + /// + /// Returns the size limit for this stream. + /// + /// + /// This limit is applied when reading from the underlying stream, as a sanity check. It is + /// not applied when reading from a byte array data source without an underlying stream. + /// The default value is 64MB. + /// + /// + /// The size limit. + /// + public int SizeLimit { get { return sizeLimit; } } + + /// + /// Returns the recursion limit for this stream. This limit is applied whilst reading messages, + /// to avoid maliciously-recursive data. + /// + /// + /// The default limit is 64. + /// + /// + /// The recursion limit for this stream. + /// + public int RecursionLimit { get { return recursionLimit; } } + + /// + /// Disposes of this instance, potentially closing any underlying stream. + /// + /// + /// As there is no flushing to perform here, disposing of a which + /// was constructed with the leaveOpen option parameter set to true (or one which + /// was constructed to read from a byte array) has no effect. + /// + public void Dispose() + { + if (!leaveOpen) + { + input.Dispose(); + } + } + + #region Validation + /// + /// Verifies that the last call to ReadTag() returned tag 0 - in other words, + /// we've reached the end of the stream when we expected to. + /// + /// The + /// tag read was not the one specified + internal void CheckReadEndOfStreamTag() + { + if (lastTag != 0) + { + throw InvalidProtocolBufferException.MoreDataAvailable(); + } + } + #endregion + + #region Reading of tags etc + + /// + /// Peeks at the next field tag. This is like calling , but the + /// tag is not consumed. (So a subsequent call to will return the + /// same value.) + /// + public uint PeekTag() + { + if (hasNextTag) + { + return nextTag; + } + + uint savedLast = lastTag; + nextTag = ReadTag(); + hasNextTag = true; + lastTag = savedLast; // Undo the side effect of ReadTag + return nextTag; + } + + /// + /// Reads a field tag, returning the tag of 0 for "end of stream". + /// + /// + /// If this method returns 0, it doesn't necessarily mean the end of all + /// the data in this CodedInputStream; it may be the end of the logical stream + /// for an embedded message, for example. + /// + /// The next field tag, or 0 for end of stream. (0 is never a valid tag.) + public uint ReadTag() + { + if (hasNextTag) + { + lastTag = nextTag; + hasNextTag = false; + return lastTag; + } + + // Optimize for the incredibly common case of having at least two bytes left in the buffer, + // and those two bytes being enough to get the tag. This will be true for fields up to 4095. + if (bufferPos + 2 <= bufferSize) + { + int tmp = buffer[bufferPos++]; + if (tmp < 128) + { + lastTag = (uint)tmp; + } + else + { + int result = tmp & 0x7f; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 7; + lastTag = (uint) result; + } + else + { + // Nope, rewind and go the potentially slow route. + bufferPos -= 2; + lastTag = ReadRawVarint32(); + } + } + } + else + { + if (IsAtEnd) + { + lastTag = 0; + return 0; // This is the only case in which we return 0. + } + + lastTag = ReadRawVarint32(); + } + if (lastTag == 0) + { + // If we actually read zero, that's not a valid tag. + throw InvalidProtocolBufferException.InvalidTag(); + } + return lastTag; + } + + /// + /// Skips the data for the field with the tag we've just read. + /// This should be called directly after , when + /// the caller wishes to skip an unknown field. + /// + /// + /// This method throws if the last-read tag was an end-group tag. + /// If a caller wishes to skip a group, they should skip the whole group, by calling this method after reading the + /// start-group tag. This behavior allows callers to call this method on any field they don't understand, correctly + /// resulting in an error if an end-group tag has not been paired with an earlier start-group tag. + /// + /// The last tag was an end-group tag + /// The last read operation read to the end of the logical stream + public void SkipLastField() + { + if (lastTag == 0) + { + throw new InvalidOperationException("SkipLastField cannot be called at the end of a stream"); + } + switch (WireFormat.GetTagWireType(lastTag)) + { + case WireFormat.WireType.StartGroup: + SkipGroup(lastTag); + break; + case WireFormat.WireType.EndGroup: + throw new InvalidProtocolBufferException( + "SkipLastField called on an end-group tag, indicating that the corresponding start-group was missing"); + case WireFormat.WireType.Fixed32: + ReadFixed32(); + break; + case WireFormat.WireType.Fixed64: + ReadFixed64(); + break; + case WireFormat.WireType.LengthDelimited: + var length = ReadLength(); + SkipRawBytes(length); + break; + case WireFormat.WireType.Varint: + ReadRawVarint32(); + break; + } + } + + private void SkipGroup(uint startGroupTag) + { + // Note: Currently we expect this to be the way that groups are read. We could put the recursion + // depth changes into the ReadTag method instead, potentially... + recursionDepth++; + if (recursionDepth >= recursionLimit) + { + throw InvalidProtocolBufferException.RecursionLimitExceeded(); + } + uint tag; + while (true) + { + tag = ReadTag(); + if (tag == 0) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + // Can't call SkipLastField for this case- that would throw. + if (WireFormat.GetTagWireType(tag) == WireFormat.WireType.EndGroup) + { + break; + } + // This recursion will allow us to handle nested groups. + SkipLastField(); + } + int startField = WireFormat.GetTagFieldNumber(startGroupTag); + int endField = WireFormat.GetTagFieldNumber(tag); + if (startField != endField) + { + throw new InvalidProtocolBufferException( + $"Mismatched end-group tag. Started with field {startField}; ended with field {endField}"); + } + recursionDepth--; + } + + /// + /// Reads a double field from the stream. + /// + public double ReadDouble() + { + return BitConverter.Int64BitsToDouble((long) ReadRawLittleEndian64()); + } + + /// + /// Reads a float field from the stream. + /// + public float ReadFloat() + { + if (BitConverter.IsLittleEndian && 4 <= bufferSize - bufferPos) + { + float ret = BitConverter.ToSingle(buffer, bufferPos); + bufferPos += 4; + return ret; + } + else + { + byte[] rawBytes = ReadRawBytes(4); + if (!BitConverter.IsLittleEndian) + { + ByteArray.Reverse(rawBytes); + } + return BitConverter.ToSingle(rawBytes, 0); + } + } + + /// + /// Reads a uint64 field from the stream. + /// + public ulong ReadUInt64() + { + return ReadRawVarint64(); + } + + /// + /// Reads an int64 field from the stream. + /// + public long ReadInt64() + { + return (long) ReadRawVarint64(); + } + + /// + /// Reads an int32 field from the stream. + /// + public int ReadInt32() + { + return (int) ReadRawVarint32(); + } + + /// + /// Reads a fixed64 field from the stream. + /// + public ulong ReadFixed64() + { + return ReadRawLittleEndian64(); + } + + /// + /// Reads a fixed32 field from the stream. + /// + public uint ReadFixed32() + { + return ReadRawLittleEndian32(); + } + + /// + /// Reads a bool field from the stream. + /// + public bool ReadBool() + { + return ReadRawVarint32() != 0; + } + + /// + /// Reads a string field from the stream. + /// + public string ReadString() + { + int length = ReadLength(); + // No need to read any data for an empty string. + if (length == 0) + { + return ""; + } + if (length <= bufferSize - bufferPos) + { + // Fast path: We already have the bytes in a contiguous buffer, so + // just copy directly from it. + String result = CodedOutputStream.Utf8Encoding.GetString(buffer, bufferPos, length); + bufferPos += length; + return result; + } + // Slow path: Build a byte array first then copy it. + return CodedOutputStream.Utf8Encoding.GetString(ReadRawBytes(length), 0, length); + } + + /// + /// Reads an embedded message field value from the stream. + /// + public void ReadMessage(IMessage builder) + { + int length = ReadLength(); + if (recursionDepth >= recursionLimit) + { + throw InvalidProtocolBufferException.RecursionLimitExceeded(); + } + int oldLimit = PushLimit(length); + ++recursionDepth; + builder.MergeFrom(this); + CheckReadEndOfStreamTag(); + // Check that we've read exactly as much data as expected. + if (!ReachedLimit) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + --recursionDepth; + PopLimit(oldLimit); + } + + /// + /// Reads a bytes field value from the stream. + /// + public ByteString ReadBytes() + { + int length = ReadLength(); + if (length <= bufferSize - bufferPos && length > 0) + { + // Fast path: We already have the bytes in a contiguous buffer, so + // just copy directly from it. + ByteString result = ByteString.CopyFrom(buffer, bufferPos, length); + bufferPos += length; + return result; + } + else + { + // Slow path: Build a byte array and attach it to a new ByteString. + return ByteString.AttachBytes(ReadRawBytes(length)); + } + } + + /// + /// Reads a uint32 field value from the stream. + /// + public uint ReadUInt32() + { + return ReadRawVarint32(); + } + + /// + /// Reads an enum field value from the stream. + /// + public int ReadEnum() + { + // Currently just a pass-through, but it's nice to separate it logically from WriteInt32. + return (int) ReadRawVarint32(); + } + + /// + /// Reads an sfixed32 field value from the stream. + /// + public int ReadSFixed32() + { + return (int) ReadRawLittleEndian32(); + } + + /// + /// Reads an sfixed64 field value from the stream. + /// + public long ReadSFixed64() + { + return (long) ReadRawLittleEndian64(); + } + + /// + /// Reads an sint32 field value from the stream. + /// + public int ReadSInt32() + { + return DecodeZigZag32(ReadRawVarint32()); + } + + /// + /// Reads an sint64 field value from the stream. + /// + public long ReadSInt64() + { + return DecodeZigZag64(ReadRawVarint64()); + } + + /// + /// Reads a length for length-delimited data. + /// + /// + /// This is internally just reading a varint, but this method exists + /// to make the calling code clearer. + /// + public int ReadLength() + { + return (int) ReadRawVarint32(); + } + + /// + /// Peeks at the next tag in the stream. If it matches , + /// the tag is consumed and the method returns true; otherwise, the + /// stream is left in the original position and the method returns false. + /// + public bool MaybeConsumeTag(uint tag) + { + if (PeekTag() == tag) + { + hasNextTag = false; + return true; + } + return false; + } + + #endregion + + #region Underlying reading primitives + + /// + /// Same code as ReadRawVarint32, but read each byte individually, checking for + /// buffer overflow. + /// + private uint SlowReadRawVarint32() + { + int tmp = ReadRawByte(); + if (tmp < 128) + { + return (uint) tmp; + } + int result = tmp & 0x7f; + if ((tmp = ReadRawByte()) < 128) + { + result |= tmp << 7; + } + else + { + result |= (tmp & 0x7f) << 7; + if ((tmp = ReadRawByte()) < 128) + { + result |= tmp << 14; + } + else + { + result |= (tmp & 0x7f) << 14; + if ((tmp = ReadRawByte()) < 128) + { + result |= tmp << 21; + } + else + { + result |= (tmp & 0x7f) << 21; + result |= (tmp = ReadRawByte()) << 28; + if (tmp >= 128) + { + // Discard upper 32 bits. + for (int i = 0; i < 5; i++) + { + if (ReadRawByte() < 128) + { + return (uint) result; + } + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + } + } + } + return (uint) result; + } + + /// + /// Reads a raw Varint from the stream. If larger than 32 bits, discard the upper bits. + /// This method is optimised for the case where we've got lots of data in the buffer. + /// That means we can check the size just once, then just read directly from the buffer + /// without constant rechecking of the buffer length. + /// + internal uint ReadRawVarint32() + { + if (bufferPos + 5 > bufferSize) + { + return SlowReadRawVarint32(); + } + + int tmp = buffer[bufferPos++]; + if (tmp < 128) + { + return (uint) tmp; + } + int result = tmp & 0x7f; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 7; + } + else + { + result |= (tmp & 0x7f) << 7; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 14; + } + else + { + result |= (tmp & 0x7f) << 14; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 21; + } + else + { + result |= (tmp & 0x7f) << 21; + result |= (tmp = buffer[bufferPos++]) << 28; + if (tmp >= 128) + { + // Discard upper 32 bits. + // Note that this has to use ReadRawByte() as we only ensure we've + // got at least 5 bytes at the start of the method. This lets us + // use the fast path in more cases, and we rarely hit this section of code. + for (int i = 0; i < 5; i++) + { + if (ReadRawByte() < 128) + { + return (uint) result; + } + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + } + } + } + return (uint) result; + } + + /// + /// Reads a varint from the input one byte at a time, so that it does not + /// read any bytes after the end of the varint. If you simply wrapped the + /// stream in a CodedInputStream and used ReadRawVarint32(Stream) + /// then you would probably end up reading past the end of the varint since + /// CodedInputStream buffers its input. + /// + /// + /// + internal static uint ReadRawVarint32(Stream input) + { + int result = 0; + int offset = 0; + for (; offset < 32; offset += 7) + { + int b = input.ReadByte(); + if (b == -1) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + result |= (b & 0x7f) << offset; + if ((b & 0x80) == 0) + { + return (uint) result; + } + } + // Keep reading up to 64 bits. + for (; offset < 64; offset += 7) + { + int b = input.ReadByte(); + if (b == -1) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + if ((b & 0x80) == 0) + { + return (uint) result; + } + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + + /// + /// Reads a raw varint from the stream. + /// + internal ulong ReadRawVarint64() + { + int shift = 0; + ulong result = 0; + while (shift < 64) + { + byte b = ReadRawByte(); + result |= (ulong) (b & 0x7F) << shift; + if ((b & 0x80) == 0) + { + return result; + } + shift += 7; + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + + /// + /// Reads a 32-bit little-endian integer from the stream. + /// + internal uint ReadRawLittleEndian32() + { + uint b1 = ReadRawByte(); + uint b2 = ReadRawByte(); + uint b3 = ReadRawByte(); + uint b4 = ReadRawByte(); + return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24); + } + + /// + /// Reads a 64-bit little-endian integer from the stream. + /// + internal ulong ReadRawLittleEndian64() + { + ulong b1 = ReadRawByte(); + ulong b2 = ReadRawByte(); + ulong b3 = ReadRawByte(); + ulong b4 = ReadRawByte(); + ulong b5 = ReadRawByte(); + ulong b6 = ReadRawByte(); + ulong b7 = ReadRawByte(); + ulong b8 = ReadRawByte(); + return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) + | (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56); + } + + /// + /// Decode a 32-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + internal static int DecodeZigZag32(uint n) + { + return (int)(n >> 1) ^ -(int)(n & 1); + } + + /// + /// Decode a 32-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + internal static long DecodeZigZag64(ulong n) + { + return (long)(n >> 1) ^ -(long)(n & 1); + } + #endregion + + #region Internal reading and buffer management + + /// + /// Sets currentLimit to (current position) + byteLimit. This is called + /// when descending into a length-delimited embedded message. The previous + /// limit is returned. + /// + /// The old limit. + internal int PushLimit(int byteLimit) + { + if (byteLimit < 0) + { + throw InvalidProtocolBufferException.NegativeSize(); + } + byteLimit += totalBytesRetired + bufferPos; + int oldLimit = currentLimit; + if (byteLimit > oldLimit) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + currentLimit = byteLimit; + + RecomputeBufferSizeAfterLimit(); + + return oldLimit; + } + + private void RecomputeBufferSizeAfterLimit() + { + bufferSize += bufferSizeAfterLimit; + int bufferEnd = totalBytesRetired + bufferSize; + if (bufferEnd > currentLimit) + { + // Limit is in current buffer. + bufferSizeAfterLimit = bufferEnd - currentLimit; + bufferSize -= bufferSizeAfterLimit; + } + else + { + bufferSizeAfterLimit = 0; + } + } + + /// + /// Discards the current limit, returning the previous limit. + /// + internal void PopLimit(int oldLimit) + { + currentLimit = oldLimit; + RecomputeBufferSizeAfterLimit(); + } + + /// + /// Returns whether or not all the data before the limit has been read. + /// + /// + internal bool ReachedLimit + { + get + { + if (currentLimit == int.MaxValue) + { + return false; + } + int currentAbsolutePosition = totalBytesRetired + bufferPos; + return currentAbsolutePosition >= currentLimit; + } + } + + /// + /// Returns true if the stream has reached the end of the input. This is the + /// case if either the end of the underlying input source has been reached or + /// the stream has reached a limit created using PushLimit. + /// + public bool IsAtEnd + { + get { return bufferPos == bufferSize && !RefillBuffer(false); } + } + + /// + /// Called when buffer is empty to read more bytes from the + /// input. If is true, RefillBuffer() gurantees that + /// either there will be at least one byte in the buffer when it returns + /// or it will throw an exception. If is false, + /// RefillBuffer() returns false if no more bytes were available. + /// + /// + /// + private bool RefillBuffer(bool mustSucceed) + { + if (bufferPos < bufferSize) + { + throw new InvalidOperationException("RefillBuffer() called when buffer wasn't empty."); + } + + if (totalBytesRetired + bufferSize == currentLimit) + { + // Oops, we hit a limit. + if (mustSucceed) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + else + { + return false; + } + } + + totalBytesRetired += bufferSize; + + bufferPos = 0; + bufferSize = (input == null) ? 0 : input.Read(buffer, 0, buffer.Length); + if (bufferSize < 0) + { + throw new InvalidOperationException("Stream.Read returned a negative count"); + } + if (bufferSize == 0) + { + if (mustSucceed) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + else + { + return false; + } + } + else + { + RecomputeBufferSizeAfterLimit(); + int totalBytesRead = + totalBytesRetired + bufferSize + bufferSizeAfterLimit; + if (totalBytesRead > sizeLimit || totalBytesRead < 0) + { + throw InvalidProtocolBufferException.SizeLimitExceeded(); + } + return true; + } + } + + /// + /// Read one byte from the input. + /// + /// + /// the end of the stream or the current limit was reached + /// + internal byte ReadRawByte() + { + if (bufferPos == bufferSize) + { + RefillBuffer(true); + } + return buffer[bufferPos++]; + } + + /// + /// Reads a fixed size of bytes from the input. + /// + /// + /// the end of the stream or the current limit was reached + /// + internal byte[] ReadRawBytes(int size) + { + if (size < 0) + { + throw InvalidProtocolBufferException.NegativeSize(); + } + + if (totalBytesRetired + bufferPos + size > currentLimit) + { + // Read to the end of the stream (up to the current limit) anyway. + SkipRawBytes(currentLimit - totalBytesRetired - bufferPos); + // Then fail. + throw InvalidProtocolBufferException.TruncatedMessage(); + } + + if (size <= bufferSize - bufferPos) + { + // We have all the bytes we need already. + byte[] bytes = new byte[size]; + ByteArray.Copy(buffer, bufferPos, bytes, 0, size); + bufferPos += size; + return bytes; + } + else if (size < buffer.Length) + { + // Reading more bytes than are in the buffer, but not an excessive number + // of bytes. We can safely allocate the resulting array ahead of time. + + // First copy what we have. + byte[] bytes = new byte[size]; + int pos = bufferSize - bufferPos; + ByteArray.Copy(buffer, bufferPos, bytes, 0, pos); + bufferPos = bufferSize; + + // We want to use RefillBuffer() and then copy from the buffer into our + // byte array rather than reading directly into our byte array because + // the input may be unbuffered. + RefillBuffer(true); + + while (size - pos > bufferSize) + { + Buffer.BlockCopy(buffer, 0, bytes, pos, bufferSize); + pos += bufferSize; + bufferPos = bufferSize; + RefillBuffer(true); + } + + ByteArray.Copy(buffer, 0, bytes, pos, size - pos); + bufferPos = size - pos; + + return bytes; + } + else + { + // The size is very large. For security reasons, we can't allocate the + // entire byte array yet. The size comes directly from the input, so a + // maliciously-crafted message could provide a bogus very large size in + // order to trick the app into allocating a lot of memory. We avoid this + // by allocating and reading only a small chunk at a time, so that the + // malicious message must actually *be* extremely large to cause + // problems. Meanwhile, we limit the allowed size of a message elsewhere. + + // Remember the buffer markers since we'll have to copy the bytes out of + // it later. + int originalBufferPos = bufferPos; + int originalBufferSize = bufferSize; + + // Mark the current buffer consumed. + totalBytesRetired += bufferSize; + bufferPos = 0; + bufferSize = 0; + + // Read all the rest of the bytes we need. + int sizeLeft = size - (originalBufferSize - originalBufferPos); + List chunks = new List(); + + while (sizeLeft > 0) + { + byte[] chunk = new byte[Math.Min(sizeLeft, buffer.Length)]; + int pos = 0; + while (pos < chunk.Length) + { + int n = (input == null) ? -1 : input.Read(chunk, pos, chunk.Length - pos); + if (n <= 0) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + totalBytesRetired += n; + pos += n; + } + sizeLeft -= chunk.Length; + chunks.Add(chunk); + } + + // OK, got everything. Now concatenate it all into one buffer. + byte[] bytes = new byte[size]; + + // Start by copying the leftover bytes from this.buffer. + int newPos = originalBufferSize - originalBufferPos; + ByteArray.Copy(buffer, originalBufferPos, bytes, 0, newPos); + + // And now all the chunks. + foreach (byte[] chunk in chunks) + { + Buffer.BlockCopy(chunk, 0, bytes, newPos, chunk.Length); + newPos += chunk.Length; + } + + // Done. + return bytes; + } + } + + /// + /// Reads and discards bytes. + /// + /// the end of the stream + /// or the current limit was reached + private void SkipRawBytes(int size) + { + if (size < 0) + { + throw InvalidProtocolBufferException.NegativeSize(); + } + + if (totalBytesRetired + bufferPos + size > currentLimit) + { + // Read to the end of the stream anyway. + SkipRawBytes(currentLimit - totalBytesRetired - bufferPos); + // Then fail. + throw InvalidProtocolBufferException.TruncatedMessage(); + } + + if (size <= bufferSize - bufferPos) + { + // We have all the bytes we need already. + bufferPos += size; + } + else + { + // Skipping more bytes than are in the buffer. First skip what we have. + int pos = bufferSize - bufferPos; + + // ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize) + // totalBytesRetired += pos; + totalBytesRetired += bufferSize; + + bufferPos = 0; + bufferSize = 0; + + // Then skip directly from the InputStream for the rest. + if (pos < size) + { + if (input == null) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + SkipImpl(size - pos); + totalBytesRetired += size - pos; + } + } + } + + /// + /// Abstraction of skipping to cope with streams which can't really skip. + /// + private void SkipImpl(int amountToSkip) + { + if (input.CanSeek) + { + long previousPosition = input.Position; + input.Position += amountToSkip; + if (input.Position != previousPosition + amountToSkip) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + } + else + { + byte[] skipBuffer = new byte[Math.Min(1024, amountToSkip)]; + while (amountToSkip > 0) + { + int bytesRead = input.Read(skipBuffer, 0, Math.Min(skipBuffer.Length, amountToSkip)); + if (bytesRead <= 0) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + amountToSkip -= bytesRead; + } + } + } + + #endregion + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs index e22937c13d..bf221c9c0a 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.ComputeSize.cs @@ -1,304 +1,304 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; - -namespace Google.Protobuf -{ - // This part of CodedOutputStream provides all the static entry points that are used - // by generated code and internally to compute the size of messages prior to being - // written to an instance of CodedOutputStream. - public sealed partial class CodedOutputStream - { - private const int LittleEndian64Size = 8; - private const int LittleEndian32Size = 4; - - /// - /// Computes the number of bytes that would be needed to encode a - /// double field, including the tag. - /// - public static int ComputeDoubleSize(double value) - { - return LittleEndian64Size; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// float field, including the tag. - /// - public static int ComputeFloatSize(float value) - { - return LittleEndian32Size; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// uint64 field, including the tag. - /// - public static int ComputeUInt64Size(ulong value) - { - return ComputeRawVarint64Size(value); - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// int64 field, including the tag. - /// - public static int ComputeInt64Size(long value) - { - return ComputeRawVarint64Size((ulong) value); - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// int32 field, including the tag. - /// - public static int ComputeInt32Size(int value) - { - if (value >= 0) - { - return ComputeRawVarint32Size((uint) value); - } - else - { - // Must sign-extend. - return 10; - } - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// fixed64 field, including the tag. - /// - public static int ComputeFixed64Size(ulong value) - { - return LittleEndian64Size; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// fixed32 field, including the tag. - /// - public static int ComputeFixed32Size(uint value) - { - return LittleEndian32Size; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// bool field, including the tag. - /// - public static int ComputeBoolSize(bool value) - { - return 1; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// string field, including the tag. - /// - public static int ComputeStringSize(String value) - { - int byteArraySize = Utf8Encoding.GetByteCount(value); - return ComputeLengthSize(byteArraySize) + byteArraySize; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// group field, including the tag. - /// - public static int ComputeGroupSize(IMessage value) - { - return value.CalculateSize(); - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// embedded message field, including the tag. - /// - public static int ComputeMessageSize(IMessage value) - { - int size = value.CalculateSize(); - return ComputeLengthSize(size) + size; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// bytes field, including the tag. - /// - public static int ComputeBytesSize(ByteString value) - { - return ComputeLengthSize(value.Length) + value.Length; - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// uint32 field, including the tag. - /// - public static int ComputeUInt32Size(uint value) - { - return ComputeRawVarint32Size(value); - } - - /// - /// Computes the number of bytes that would be needed to encode a - /// enum field, including the tag. The caller is responsible for - /// converting the enum value to its numeric value. - /// - public static int ComputeEnumSize(int value) - { - // Currently just a pass-through, but it's nice to separate it logically. - return ComputeInt32Size(value); - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// sfixed32 field, including the tag. - /// - public static int ComputeSFixed32Size(int value) - { - return LittleEndian32Size; - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// sfixed64 field, including the tag. - /// - public static int ComputeSFixed64Size(long value) - { - return LittleEndian64Size; - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// sint32 field, including the tag. - /// - public static int ComputeSInt32Size(int value) - { - return ComputeRawVarint32Size(EncodeZigZag32(value)); - } - - /// - /// Computes the number of bytes that would be needed to encode an - /// sint64 field, including the tag. - /// - public static int ComputeSInt64Size(long value) - { - return ComputeRawVarint64Size(EncodeZigZag64(value)); - } - - /// - /// Computes the number of bytes that would be needed to encode a length, - /// as written by . - /// - public static int ComputeLengthSize(int length) - { - return ComputeRawVarint32Size((uint) length); - } - - /// - /// Computes the number of bytes that would be needed to encode a varint. - /// - public static int ComputeRawVarint32Size(uint value) - { - if ((value & (0xffffffff << 7)) == 0) - { - return 1; - } - if ((value & (0xffffffff << 14)) == 0) - { - return 2; - } - if ((value & (0xffffffff << 21)) == 0) - { - return 3; - } - if ((value & (0xffffffff << 28)) == 0) - { - return 4; - } - return 5; - } - - /// - /// Computes the number of bytes that would be needed to encode a varint. - /// - public static int ComputeRawVarint64Size(ulong value) - { - if ((value & (0xffffffffffffffffL << 7)) == 0) - { - return 1; - } - if ((value & (0xffffffffffffffffL << 14)) == 0) - { - return 2; - } - if ((value & (0xffffffffffffffffL << 21)) == 0) - { - return 3; - } - if ((value & (0xffffffffffffffffL << 28)) == 0) - { - return 4; - } - if ((value & (0xffffffffffffffffL << 35)) == 0) - { - return 5; - } - if ((value & (0xffffffffffffffffL << 42)) == 0) - { - return 6; - } - if ((value & (0xffffffffffffffffL << 49)) == 0) - { - return 7; - } - if ((value & (0xffffffffffffffffL << 56)) == 0) - { - return 8; - } - if ((value & (0xffffffffffffffffL << 63)) == 0) - { - return 9; - } - return 10; - } - - /// - /// Computes the number of bytes that would be needed to encode a tag. - /// - public static int ComputeTagSize(int fieldNumber) - { - return ComputeRawVarint32Size(WireFormat.MakeTag(fieldNumber, 0)); - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; + +namespace Google.Protobuf +{ + // This part of CodedOutputStream provides all the static entry points that are used + // by generated code and internally to compute the size of messages prior to being + // written to an instance of CodedOutputStream. + public sealed partial class CodedOutputStream + { + private const int LittleEndian64Size = 8; + private const int LittleEndian32Size = 4; + + /// + /// Computes the number of bytes that would be needed to encode a + /// double field, including the tag. + /// + public static int ComputeDoubleSize(double value) + { + return LittleEndian64Size; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// float field, including the tag. + /// + public static int ComputeFloatSize(float value) + { + return LittleEndian32Size; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// uint64 field, including the tag. + /// + public static int ComputeUInt64Size(ulong value) + { + return ComputeRawVarint64Size(value); + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// int64 field, including the tag. + /// + public static int ComputeInt64Size(long value) + { + return ComputeRawVarint64Size((ulong) value); + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// int32 field, including the tag. + /// + public static int ComputeInt32Size(int value) + { + if (value >= 0) + { + return ComputeRawVarint32Size((uint) value); + } + else + { + // Must sign-extend. + return 10; + } + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// fixed64 field, including the tag. + /// + public static int ComputeFixed64Size(ulong value) + { + return LittleEndian64Size; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// fixed32 field, including the tag. + /// + public static int ComputeFixed32Size(uint value) + { + return LittleEndian32Size; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// bool field, including the tag. + /// + public static int ComputeBoolSize(bool value) + { + return 1; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// string field, including the tag. + /// + public static int ComputeStringSize(String value) + { + int byteArraySize = Utf8Encoding.GetByteCount(value); + return ComputeLengthSize(byteArraySize) + byteArraySize; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// group field, including the tag. + /// + public static int ComputeGroupSize(IMessage value) + { + return value.CalculateSize(); + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// embedded message field, including the tag. + /// + public static int ComputeMessageSize(IMessage value) + { + int size = value.CalculateSize(); + return ComputeLengthSize(size) + size; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// bytes field, including the tag. + /// + public static int ComputeBytesSize(ByteString value) + { + return ComputeLengthSize(value.Length) + value.Length; + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// uint32 field, including the tag. + /// + public static int ComputeUInt32Size(uint value) + { + return ComputeRawVarint32Size(value); + } + + /// + /// Computes the number of bytes that would be needed to encode a + /// enum field, including the tag. The caller is responsible for + /// converting the enum value to its numeric value. + /// + public static int ComputeEnumSize(int value) + { + // Currently just a pass-through, but it's nice to separate it logically. + return ComputeInt32Size(value); + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// sfixed32 field, including the tag. + /// + public static int ComputeSFixed32Size(int value) + { + return LittleEndian32Size; + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// sfixed64 field, including the tag. + /// + public static int ComputeSFixed64Size(long value) + { + return LittleEndian64Size; + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// sint32 field, including the tag. + /// + public static int ComputeSInt32Size(int value) + { + return ComputeRawVarint32Size(EncodeZigZag32(value)); + } + + /// + /// Computes the number of bytes that would be needed to encode an + /// sint64 field, including the tag. + /// + public static int ComputeSInt64Size(long value) + { + return ComputeRawVarint64Size(EncodeZigZag64(value)); + } + + /// + /// Computes the number of bytes that would be needed to encode a length, + /// as written by . + /// + public static int ComputeLengthSize(int length) + { + return ComputeRawVarint32Size((uint) length); + } + + /// + /// Computes the number of bytes that would be needed to encode a varint. + /// + public static int ComputeRawVarint32Size(uint value) + { + if ((value & (0xffffffff << 7)) == 0) + { + return 1; + } + if ((value & (0xffffffff << 14)) == 0) + { + return 2; + } + if ((value & (0xffffffff << 21)) == 0) + { + return 3; + } + if ((value & (0xffffffff << 28)) == 0) + { + return 4; + } + return 5; + } + + /// + /// Computes the number of bytes that would be needed to encode a varint. + /// + public static int ComputeRawVarint64Size(ulong value) + { + if ((value & (0xffffffffffffffffL << 7)) == 0) + { + return 1; + } + if ((value & (0xffffffffffffffffL << 14)) == 0) + { + return 2; + } + if ((value & (0xffffffffffffffffL << 21)) == 0) + { + return 3; + } + if ((value & (0xffffffffffffffffL << 28)) == 0) + { + return 4; + } + if ((value & (0xffffffffffffffffL << 35)) == 0) + { + return 5; + } + if ((value & (0xffffffffffffffffL << 42)) == 0) + { + return 6; + } + if ((value & (0xffffffffffffffffL << 49)) == 0) + { + return 7; + } + if ((value & (0xffffffffffffffffL << 56)) == 0) + { + return 8; + } + if ((value & (0xffffffffffffffffL << 63)) == 0) + { + return 9; + } + return 10; + } + + /// + /// Computes the number of bytes that would be needed to encode a tag. + /// + public static int ComputeTagSize(int fieldNumber) + { + return ComputeRawVarint32Size(WireFormat.MakeTag(fieldNumber, 0)); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.cs index 827f0398cf..6211aac32c 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/CodedOutputStream.cs @@ -1,761 +1,761 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using Google.Protobuf.Collections; -using System; -using System.IO; -using System.Text; - -namespace Google.Protobuf -{ - /// - /// Encodes and writes protocol message fields. - /// - /// - /// - /// This class is generally used by generated code to write appropriate - /// primitives to the stream. It effectively encapsulates the lowest - /// levels of protocol buffer format. Unlike some other implementations, - /// this does not include combined "write tag and value" methods. Generated - /// code knows the exact byte representations of the tags they're going to write, - /// so there's no need to re-encode them each time. Manually-written code calling - /// this class should just call one of the WriteTag overloads before each value. - /// - /// - /// Repeated fields and map fields are not handled by this class; use RepeatedField<T> - /// and MapField<TKey, TValue> to serialize such fields. - /// - /// - public sealed partial class CodedOutputStream : IDisposable - { - // "Local" copy of Encoding.UTF8, for efficiency. (Yes, it makes a difference.) - internal static readonly Encoding Utf8Encoding = Encoding.UTF8; - - /// - /// The buffer size used by CreateInstance(Stream). - /// - public static readonly int DefaultBufferSize = 4096; - - private readonly bool leaveOpen; - private readonly byte[] buffer; - private readonly int limit; - private int position; - private readonly Stream output; - - #region Construction - /// - /// Creates a new CodedOutputStream that writes directly to the given - /// byte array. If more bytes are written than fit in the array, - /// OutOfSpaceException will be thrown. - /// - public CodedOutputStream(byte[] flatArray) : this(flatArray, 0, flatArray.Length) - { - } - - /// - /// Creates a new CodedOutputStream that writes directly to the given - /// byte array slice. If more bytes are written than fit in the array, - /// OutOfSpaceException will be thrown. - /// - private CodedOutputStream(byte[] buffer, int offset, int length) - { - this.output = null; - this.buffer = buffer; - this.position = offset; - this.limit = offset + length; - leaveOpen = true; // Simple way of avoiding trying to dispose of a null reference - } - - private CodedOutputStream(Stream output, byte[] buffer, bool leaveOpen) - { - this.output = ProtoPreconditions.CheckNotNull(output, nameof(output)); - this.buffer = buffer; - this.position = 0; - this.limit = buffer.Length; - this.leaveOpen = leaveOpen; - } - - /// - /// Creates a new which write to the given stream, and disposes of that - /// stream when the returned CodedOutputStream is disposed. - /// - /// The stream to write to. It will be disposed when the returned CodedOutputStream is disposed. - public CodedOutputStream(Stream output) : this(output, DefaultBufferSize, false) - { - } - - /// - /// Creates a new CodedOutputStream which write to the given stream and uses - /// the specified buffer size. - /// - /// The stream to write to. It will be disposed when the returned CodedOutputStream is disposed. - /// The size of buffer to use internally. - public CodedOutputStream(Stream output, int bufferSize) : this(output, new byte[bufferSize], false) - { - } - - /// - /// Creates a new CodedOutputStream which write to the given stream. - /// - /// The stream to write to. - /// If true, is left open when the returned CodedOutputStream is disposed; - /// if false, the provided stream is disposed as well. - public CodedOutputStream(Stream output, bool leaveOpen) : this(output, DefaultBufferSize, leaveOpen) - { - } - - /// - /// Creates a new CodedOutputStream which write to the given stream and uses - /// the specified buffer size. - /// - /// The stream to write to. - /// The size of buffer to use internally. - /// If true, is left open when the returned CodedOutputStream is disposed; - /// if false, the provided stream is disposed as well. - public CodedOutputStream(Stream output, int bufferSize, bool leaveOpen) : this(output, new byte[bufferSize], leaveOpen) - { - } - #endregion - - /// - /// Returns the current position in the stream, or the position in the output buffer - /// - public long Position - { - get - { - if (output != null) - { - return output.Position + position; - } - return position; - } - } - - #region Writing of values (not including tags) - - /// - /// Writes a double field value, without a tag, to the stream. - /// - /// The value to write - public void WriteDouble(double value) - { - WriteRawLittleEndian64((ulong)BitConverter.DoubleToInt64Bits(value)); - } - - /// - /// Writes a float field value, without a tag, to the stream. - /// - /// The value to write - public void WriteFloat(float value) - { - byte[] rawBytes = BitConverter.GetBytes(value); - if (!BitConverter.IsLittleEndian) - { - ByteArray.Reverse(rawBytes); - } - - if (limit - position >= 4) - { - buffer[position++] = rawBytes[0]; - buffer[position++] = rawBytes[1]; - buffer[position++] = rawBytes[2]; - buffer[position++] = rawBytes[3]; - } - else - { - WriteRawBytes(rawBytes, 0, 4); - } - } - - /// - /// Writes a uint64 field value, without a tag, to the stream. - /// - /// The value to write - public void WriteUInt64(ulong value) - { - WriteRawVarint64(value); - } - - /// - /// Writes an int64 field value, without a tag, to the stream. - /// - /// The value to write - public void WriteInt64(long value) - { - WriteRawVarint64((ulong) value); - } - - /// - /// Writes an int32 field value, without a tag, to the stream. - /// - /// The value to write - public void WriteInt32(int value) - { - if (value >= 0) - { - WriteRawVarint32((uint) value); - } - else - { - // Must sign-extend. - WriteRawVarint64((ulong) value); - } - } - - /// - /// Writes a fixed64 field value, without a tag, to the stream. - /// - /// The value to write - public void WriteFixed64(ulong value) - { - WriteRawLittleEndian64(value); - } - - /// - /// Writes a fixed32 field value, without a tag, to the stream. - /// - /// The value to write - public void WriteFixed32(uint value) - { - WriteRawLittleEndian32(value); - } - - /// - /// Writes a bool field value, without a tag, to the stream. - /// - /// The value to write - public void WriteBool(bool value) - { - WriteRawByte(value ? (byte) 1 : (byte) 0); - } - - /// - /// Writes a string field value, without a tag, to the stream. - /// The data is length-prefixed. - /// - /// The value to write - public void WriteString(string value) - { - // Optimise the case where we have enough space to write - // the string directly to the buffer, which should be common. - int length = Utf8Encoding.GetByteCount(value); - WriteLength(length); - if (limit - position >= length) - { - if (length == value.Length) // Must be all ASCII... - { - for (int i = 0; i < length; i++) - { - buffer[position + i] = (byte)value[i]; - } - } - else - { - Utf8Encoding.GetBytes(value, 0, value.Length, buffer, position); - } - position += length; - } - else - { - byte[] bytes = Utf8Encoding.GetBytes(value); - WriteRawBytes(bytes); - } - } - - /// - /// Writes a message, without a tag, to the stream. - /// The data is length-prefixed. - /// - /// The value to write - public void WriteMessage(IMessage value) - { - WriteLength(value.CalculateSize()); - value.WriteTo(this); - } - - /// - /// Write a byte string, without a tag, to the stream. - /// The data is length-prefixed. - /// - /// The value to write - public void WriteBytes(ByteString value) - { - WriteLength(value.Length); - value.WriteRawBytesTo(this); - } - - /// - /// Writes a uint32 value, without a tag, to the stream. - /// - /// The value to write - public void WriteUInt32(uint value) - { - WriteRawVarint32(value); - } - - /// - /// Writes an enum value, without a tag, to the stream. - /// - /// The value to write - public void WriteEnum(int value) - { - WriteInt32(value); - } - - /// - /// Writes an sfixed32 value, without a tag, to the stream. - /// - /// The value to write. - public void WriteSFixed32(int value) - { - WriteRawLittleEndian32((uint) value); - } - - /// - /// Writes an sfixed64 value, without a tag, to the stream. - /// - /// The value to write - public void WriteSFixed64(long value) - { - WriteRawLittleEndian64((ulong) value); - } - - /// - /// Writes an sint32 value, without a tag, to the stream. - /// - /// The value to write - public void WriteSInt32(int value) - { - WriteRawVarint32(EncodeZigZag32(value)); - } - - /// - /// Writes an sint64 value, without a tag, to the stream. - /// - /// The value to write - public void WriteSInt64(long value) - { - WriteRawVarint64(EncodeZigZag64(value)); - } - - /// - /// Writes a length (in bytes) for length-delimited data. - /// - /// - /// This method simply writes a rawint, but exists for clarity in calling code. - /// - /// Length value, in bytes. - public void WriteLength(int length) - { - WriteRawVarint32((uint) length); - } - - #endregion - - #region Raw tag writing - /// - /// Encodes and writes a tag. - /// - /// The number of the field to write the tag for - /// The wire format type of the tag to write - public void WriteTag(int fieldNumber, WireFormat.WireType type) - { - WriteRawVarint32(WireFormat.MakeTag(fieldNumber, type)); - } - - /// - /// Writes an already-encoded tag. - /// - /// The encoded tag - public void WriteTag(uint tag) - { - WriteRawVarint32(tag); - } - - /// - /// Writes the given single-byte tag directly to the stream. - /// - /// The encoded tag - public void WriteRawTag(byte b1) - { - WriteRawByte(b1); - } - - /// - /// Writes the given two-byte tag directly to the stream. - /// - /// The first byte of the encoded tag - /// The second byte of the encoded tag - public void WriteRawTag(byte b1, byte b2) - { - WriteRawByte(b1); - WriteRawByte(b2); - } - - /// - /// Writes the given three-byte tag directly to the stream. - /// - /// The first byte of the encoded tag - /// The second byte of the encoded tag - /// The third byte of the encoded tag - public void WriteRawTag(byte b1, byte b2, byte b3) - { - WriteRawByte(b1); - WriteRawByte(b2); - WriteRawByte(b3); - } - - /// - /// Writes the given four-byte tag directly to the stream. - /// - /// The first byte of the encoded tag - /// The second byte of the encoded tag - /// The third byte of the encoded tag - /// The fourth byte of the encoded tag - public void WriteRawTag(byte b1, byte b2, byte b3, byte b4) - { - WriteRawByte(b1); - WriteRawByte(b2); - WriteRawByte(b3); - WriteRawByte(b4); - } - - /// - /// Writes the given five-byte tag directly to the stream. - /// - /// The first byte of the encoded tag - /// The second byte of the encoded tag - /// The third byte of the encoded tag - /// The fourth byte of the encoded tag - /// The fifth byte of the encoded tag - public void WriteRawTag(byte b1, byte b2, byte b3, byte b4, byte b5) - { - WriteRawByte(b1); - WriteRawByte(b2); - WriteRawByte(b3); - WriteRawByte(b4); - WriteRawByte(b5); - } - #endregion - - #region Underlying writing primitives - /// - /// Writes a 32 bit value as a varint. The fast route is taken when - /// there's enough buffer space left to whizz through without checking - /// for each byte; otherwise, we resort to calling WriteRawByte each time. - /// - internal void WriteRawVarint32(uint value) - { - // Optimize for the common case of a single byte value - if (value < 128 && position < limit) - { - buffer[position++] = (byte)value; - return; - } - - while (value > 127 && position < limit) - { - buffer[position++] = (byte) ((value & 0x7F) | 0x80); - value >>= 7; - } - while (value > 127) - { - WriteRawByte((byte) ((value & 0x7F) | 0x80)); - value >>= 7; - } - if (position < limit) - { - buffer[position++] = (byte) value; - } - else - { - WriteRawByte((byte) value); - } - } - - internal void WriteRawVarint64(ulong value) - { - while (value > 127 && position < limit) - { - buffer[position++] = (byte) ((value & 0x7F) | 0x80); - value >>= 7; - } - while (value > 127) - { - WriteRawByte((byte) ((value & 0x7F) | 0x80)); - value >>= 7; - } - if (position < limit) - { - buffer[position++] = (byte) value; - } - else - { - WriteRawByte((byte) value); - } - } - - internal void WriteRawLittleEndian32(uint value) - { - if (position + 4 > limit) - { - WriteRawByte((byte) value); - WriteRawByte((byte) (value >> 8)); - WriteRawByte((byte) (value >> 16)); - WriteRawByte((byte) (value >> 24)); - } - else - { - buffer[position++] = ((byte) value); - buffer[position++] = ((byte) (value >> 8)); - buffer[position++] = ((byte) (value >> 16)); - buffer[position++] = ((byte) (value >> 24)); - } - } - - internal void WriteRawLittleEndian64(ulong value) - { - if (position + 8 > limit) - { - WriteRawByte((byte) value); - WriteRawByte((byte) (value >> 8)); - WriteRawByte((byte) (value >> 16)); - WriteRawByte((byte) (value >> 24)); - WriteRawByte((byte) (value >> 32)); - WriteRawByte((byte) (value >> 40)); - WriteRawByte((byte) (value >> 48)); - WriteRawByte((byte) (value >> 56)); - } - else - { - buffer[position++] = ((byte) value); - buffer[position++] = ((byte) (value >> 8)); - buffer[position++] = ((byte) (value >> 16)); - buffer[position++] = ((byte) (value >> 24)); - buffer[position++] = ((byte) (value >> 32)); - buffer[position++] = ((byte) (value >> 40)); - buffer[position++] = ((byte) (value >> 48)); - buffer[position++] = ((byte) (value >> 56)); - } - } - - internal void WriteRawByte(byte value) - { - if (position == limit) - { - RefreshBuffer(); - } - - buffer[position++] = value; - } - - internal void WriteRawByte(uint value) - { - WriteRawByte((byte) value); - } - - /// - /// Writes out an array of bytes. - /// - internal void WriteRawBytes(byte[] value) - { - WriteRawBytes(value, 0, value.Length); - } - - /// - /// Writes out part of an array of bytes. - /// - internal void WriteRawBytes(byte[] value, int offset, int length) - { - if (limit - position >= length) - { - ByteArray.Copy(value, offset, buffer, position, length); - // We have room in the current buffer. - position += length; - } - else - { - // Write extends past current buffer. Fill the rest of this buffer and - // flush. - int bytesWritten = limit - position; - ByteArray.Copy(value, offset, buffer, position, bytesWritten); - offset += bytesWritten; - length -= bytesWritten; - position = limit; - RefreshBuffer(); - - // Now deal with the rest. - // Since we have an output stream, this is our buffer - // and buffer offset == 0 - if (length <= limit) - { - // Fits in new buffer. - ByteArray.Copy(value, offset, buffer, 0, length); - position = length; - } - else - { - // Write is very big. Let's do it all at once. - output.Write(value, offset, length); - } - } - } - - #endregion - - /// - /// Encode a 32-bit value with ZigZag encoding. - /// - /// - /// ZigZag encodes signed integers into values that can be efficiently - /// encoded with varint. (Otherwise, negative values must be - /// sign-extended to 64 bits to be varint encoded, thus always taking - /// 10 bytes on the wire.) - /// - internal static uint EncodeZigZag32(int n) - { - // Note: the right-shift must be arithmetic - return (uint) ((n << 1) ^ (n >> 31)); - } - - /// - /// Encode a 64-bit value with ZigZag encoding. - /// - /// - /// ZigZag encodes signed integers into values that can be efficiently - /// encoded with varint. (Otherwise, negative values must be - /// sign-extended to 64 bits to be varint encoded, thus always taking - /// 10 bytes on the wire.) - /// - internal static ulong EncodeZigZag64(long n) - { - return (ulong) ((n << 1) ^ (n >> 63)); - } - - private void RefreshBuffer() - { - if (output == null) - { - // We're writing to a single buffer. - throw new OutOfSpaceException(); - } - - // Since we have an output stream, this is our buffer - // and buffer offset == 0 - output.Write(buffer, 0, position); - position = 0; - } - - /// - /// Indicates that a CodedOutputStream wrapping a flat byte array - /// ran out of space. - /// - public sealed class OutOfSpaceException : IOException - { - internal OutOfSpaceException() - : base("CodedOutputStream was writing to a flat byte array and ran out of space.") - { - } - } - - /// - /// Flushes any buffered data and optionally closes the underlying stream, if any. - /// - /// - /// - /// By default, any underlying stream is closed by this method. To configure this behaviour, - /// use a constructor overload with a leaveOpen parameter. If this instance does not - /// have an underlying stream, this method does nothing. - /// - /// - /// For the sake of efficiency, calling this method does not prevent future write calls - but - /// if a later write ends up writing to a stream which has been disposed, that is likely to - /// fail. It is recommend that you not call any other methods after this. - /// - /// - public void Dispose() - { - Flush(); - if (!leaveOpen) - { - output.Dispose(); - } - } - - /// - /// Flushes any buffered data to the underlying stream (if there is one). - /// - public void Flush() - { - if (output != null) - { - RefreshBuffer(); - } - } - - /// - /// Verifies that SpaceLeft returns zero. It's common to create a byte array - /// that is exactly big enough to hold a message, then write to it with - /// a CodedOutputStream. Calling CheckNoSpaceLeft after writing verifies that - /// the message was actually as big as expected, which can help bugs. - /// - public void CheckNoSpaceLeft() - { - if (SpaceLeft != 0) - { - throw new InvalidOperationException("Did not write as much data as expected."); - } - } - - /// - /// If writing to a flat array, returns the space left in the array. Otherwise, - /// throws an InvalidOperationException. - /// - public int SpaceLeft - { - get - { - if (output == null) - { - return limit - position; - } - else - { - throw new InvalidOperationException( - "SpaceLeft can only be called on CodedOutputStreams that are " + - "writing to a flat array."); - } - } - } - } -} +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using Google.Protobuf.Collections; +using System; +using System.IO; +using System.Text; + +namespace Google.Protobuf +{ + /// + /// Encodes and writes protocol message fields. + /// + /// + /// + /// This class is generally used by generated code to write appropriate + /// primitives to the stream. It effectively encapsulates the lowest + /// levels of protocol buffer format. Unlike some other implementations, + /// this does not include combined "write tag and value" methods. Generated + /// code knows the exact byte representations of the tags they're going to write, + /// so there's no need to re-encode them each time. Manually-written code calling + /// this class should just call one of the WriteTag overloads before each value. + /// + /// + /// Repeated fields and map fields are not handled by this class; use RepeatedField<T> + /// and MapField<TKey, TValue> to serialize such fields. + /// + /// + public sealed partial class CodedOutputStream : IDisposable + { + // "Local" copy of Encoding.UTF8, for efficiency. (Yes, it makes a difference.) + internal static readonly Encoding Utf8Encoding = Encoding.UTF8; + + /// + /// The buffer size used by CreateInstance(Stream). + /// + public static readonly int DefaultBufferSize = 4096; + + private readonly bool leaveOpen; + private readonly byte[] buffer; + private readonly int limit; + private int position; + private readonly Stream output; + + #region Construction + /// + /// Creates a new CodedOutputStream that writes directly to the given + /// byte array. If more bytes are written than fit in the array, + /// OutOfSpaceException will be thrown. + /// + public CodedOutputStream(byte[] flatArray) : this(flatArray, 0, flatArray.Length) + { + } + + /// + /// Creates a new CodedOutputStream that writes directly to the given + /// byte array slice. If more bytes are written than fit in the array, + /// OutOfSpaceException will be thrown. + /// + private CodedOutputStream(byte[] buffer, int offset, int length) + { + this.output = null; + this.buffer = buffer; + this.position = offset; + this.limit = offset + length; + leaveOpen = true; // Simple way of avoiding trying to dispose of a null reference + } + + private CodedOutputStream(Stream output, byte[] buffer, bool leaveOpen) + { + this.output = ProtoPreconditions.CheckNotNull(output, nameof(output)); + this.buffer = buffer; + this.position = 0; + this.limit = buffer.Length; + this.leaveOpen = leaveOpen; + } + + /// + /// Creates a new which write to the given stream, and disposes of that + /// stream when the returned CodedOutputStream is disposed. + /// + /// The stream to write to. It will be disposed when the returned CodedOutputStream is disposed. + public CodedOutputStream(Stream output) : this(output, DefaultBufferSize, false) + { + } + + /// + /// Creates a new CodedOutputStream which write to the given stream and uses + /// the specified buffer size. + /// + /// The stream to write to. It will be disposed when the returned CodedOutputStream is disposed. + /// The size of buffer to use internally. + public CodedOutputStream(Stream output, int bufferSize) : this(output, new byte[bufferSize], false) + { + } + + /// + /// Creates a new CodedOutputStream which write to the given stream. + /// + /// The stream to write to. + /// If true, is left open when the returned CodedOutputStream is disposed; + /// if false, the provided stream is disposed as well. + public CodedOutputStream(Stream output, bool leaveOpen) : this(output, DefaultBufferSize, leaveOpen) + { + } + + /// + /// Creates a new CodedOutputStream which write to the given stream and uses + /// the specified buffer size. + /// + /// The stream to write to. + /// The size of buffer to use internally. + /// If true, is left open when the returned CodedOutputStream is disposed; + /// if false, the provided stream is disposed as well. + public CodedOutputStream(Stream output, int bufferSize, bool leaveOpen) : this(output, new byte[bufferSize], leaveOpen) + { + } + #endregion + + /// + /// Returns the current position in the stream, or the position in the output buffer + /// + public long Position + { + get + { + if (output != null) + { + return output.Position + position; + } + return position; + } + } + + #region Writing of values (not including tags) + + /// + /// Writes a double field value, without a tag, to the stream. + /// + /// The value to write + public void WriteDouble(double value) + { + WriteRawLittleEndian64((ulong)BitConverter.DoubleToInt64Bits(value)); + } + + /// + /// Writes a float field value, without a tag, to the stream. + /// + /// The value to write + public void WriteFloat(float value) + { + byte[] rawBytes = BitConverter.GetBytes(value); + if (!BitConverter.IsLittleEndian) + { + ByteArray.Reverse(rawBytes); + } + + if (limit - position >= 4) + { + buffer[position++] = rawBytes[0]; + buffer[position++] = rawBytes[1]; + buffer[position++] = rawBytes[2]; + buffer[position++] = rawBytes[3]; + } + else + { + WriteRawBytes(rawBytes, 0, 4); + } + } + + /// + /// Writes a uint64 field value, without a tag, to the stream. + /// + /// The value to write + public void WriteUInt64(ulong value) + { + WriteRawVarint64(value); + } + + /// + /// Writes an int64 field value, without a tag, to the stream. + /// + /// The value to write + public void WriteInt64(long value) + { + WriteRawVarint64((ulong) value); + } + + /// + /// Writes an int32 field value, without a tag, to the stream. + /// + /// The value to write + public void WriteInt32(int value) + { + if (value >= 0) + { + WriteRawVarint32((uint) value); + } + else + { + // Must sign-extend. + WriteRawVarint64((ulong) value); + } + } + + /// + /// Writes a fixed64 field value, without a tag, to the stream. + /// + /// The value to write + public void WriteFixed64(ulong value) + { + WriteRawLittleEndian64(value); + } + + /// + /// Writes a fixed32 field value, without a tag, to the stream. + /// + /// The value to write + public void WriteFixed32(uint value) + { + WriteRawLittleEndian32(value); + } + + /// + /// Writes a bool field value, without a tag, to the stream. + /// + /// The value to write + public void WriteBool(bool value) + { + WriteRawByte(value ? (byte) 1 : (byte) 0); + } + + /// + /// Writes a string field value, without a tag, to the stream. + /// The data is length-prefixed. + /// + /// The value to write + public void WriteString(string value) + { + // Optimise the case where we have enough space to write + // the string directly to the buffer, which should be common. + int length = Utf8Encoding.GetByteCount(value); + WriteLength(length); + if (limit - position >= length) + { + if (length == value.Length) // Must be all ASCII... + { + for (int i = 0; i < length; i++) + { + buffer[position + i] = (byte)value[i]; + } + } + else + { + Utf8Encoding.GetBytes(value, 0, value.Length, buffer, position); + } + position += length; + } + else + { + byte[] bytes = Utf8Encoding.GetBytes(value); + WriteRawBytes(bytes); + } + } + + /// + /// Writes a message, without a tag, to the stream. + /// The data is length-prefixed. + /// + /// The value to write + public void WriteMessage(IMessage value) + { + WriteLength(value.CalculateSize()); + value.WriteTo(this); + } + + /// + /// Write a byte string, without a tag, to the stream. + /// The data is length-prefixed. + /// + /// The value to write + public void WriteBytes(ByteString value) + { + WriteLength(value.Length); + value.WriteRawBytesTo(this); + } + + /// + /// Writes a uint32 value, without a tag, to the stream. + /// + /// The value to write + public void WriteUInt32(uint value) + { + WriteRawVarint32(value); + } + + /// + /// Writes an enum value, without a tag, to the stream. + /// + /// The value to write + public void WriteEnum(int value) + { + WriteInt32(value); + } + + /// + /// Writes an sfixed32 value, without a tag, to the stream. + /// + /// The value to write. + public void WriteSFixed32(int value) + { + WriteRawLittleEndian32((uint) value); + } + + /// + /// Writes an sfixed64 value, without a tag, to the stream. + /// + /// The value to write + public void WriteSFixed64(long value) + { + WriteRawLittleEndian64((ulong) value); + } + + /// + /// Writes an sint32 value, without a tag, to the stream. + /// + /// The value to write + public void WriteSInt32(int value) + { + WriteRawVarint32(EncodeZigZag32(value)); + } + + /// + /// Writes an sint64 value, without a tag, to the stream. + /// + /// The value to write + public void WriteSInt64(long value) + { + WriteRawVarint64(EncodeZigZag64(value)); + } + + /// + /// Writes a length (in bytes) for length-delimited data. + /// + /// + /// This method simply writes a rawint, but exists for clarity in calling code. + /// + /// Length value, in bytes. + public void WriteLength(int length) + { + WriteRawVarint32((uint) length); + } + + #endregion + + #region Raw tag writing + /// + /// Encodes and writes a tag. + /// + /// The number of the field to write the tag for + /// The wire format type of the tag to write + public void WriteTag(int fieldNumber, WireFormat.WireType type) + { + WriteRawVarint32(WireFormat.MakeTag(fieldNumber, type)); + } + + /// + /// Writes an already-encoded tag. + /// + /// The encoded tag + public void WriteTag(uint tag) + { + WriteRawVarint32(tag); + } + + /// + /// Writes the given single-byte tag directly to the stream. + /// + /// The encoded tag + public void WriteRawTag(byte b1) + { + WriteRawByte(b1); + } + + /// + /// Writes the given two-byte tag directly to the stream. + /// + /// The first byte of the encoded tag + /// The second byte of the encoded tag + public void WriteRawTag(byte b1, byte b2) + { + WriteRawByte(b1); + WriteRawByte(b2); + } + + /// + /// Writes the given three-byte tag directly to the stream. + /// + /// The first byte of the encoded tag + /// The second byte of the encoded tag + /// The third byte of the encoded tag + public void WriteRawTag(byte b1, byte b2, byte b3) + { + WriteRawByte(b1); + WriteRawByte(b2); + WriteRawByte(b3); + } + + /// + /// Writes the given four-byte tag directly to the stream. + /// + /// The first byte of the encoded tag + /// The second byte of the encoded tag + /// The third byte of the encoded tag + /// The fourth byte of the encoded tag + public void WriteRawTag(byte b1, byte b2, byte b3, byte b4) + { + WriteRawByte(b1); + WriteRawByte(b2); + WriteRawByte(b3); + WriteRawByte(b4); + } + + /// + /// Writes the given five-byte tag directly to the stream. + /// + /// The first byte of the encoded tag + /// The second byte of the encoded tag + /// The third byte of the encoded tag + /// The fourth byte of the encoded tag + /// The fifth byte of the encoded tag + public void WriteRawTag(byte b1, byte b2, byte b3, byte b4, byte b5) + { + WriteRawByte(b1); + WriteRawByte(b2); + WriteRawByte(b3); + WriteRawByte(b4); + WriteRawByte(b5); + } + #endregion + + #region Underlying writing primitives + /// + /// Writes a 32 bit value as a varint. The fast route is taken when + /// there's enough buffer space left to whizz through without checking + /// for each byte; otherwise, we resort to calling WriteRawByte each time. + /// + internal void WriteRawVarint32(uint value) + { + // Optimize for the common case of a single byte value + if (value < 128 && position < limit) + { + buffer[position++] = (byte)value; + return; + } + + while (value > 127 && position < limit) + { + buffer[position++] = (byte) ((value & 0x7F) | 0x80); + value >>= 7; + } + while (value > 127) + { + WriteRawByte((byte) ((value & 0x7F) | 0x80)); + value >>= 7; + } + if (position < limit) + { + buffer[position++] = (byte) value; + } + else + { + WriteRawByte((byte) value); + } + } + + internal void WriteRawVarint64(ulong value) + { + while (value > 127 && position < limit) + { + buffer[position++] = (byte) ((value & 0x7F) | 0x80); + value >>= 7; + } + while (value > 127) + { + WriteRawByte((byte) ((value & 0x7F) | 0x80)); + value >>= 7; + } + if (position < limit) + { + buffer[position++] = (byte) value; + } + else + { + WriteRawByte((byte) value); + } + } + + internal void WriteRawLittleEndian32(uint value) + { + if (position + 4 > limit) + { + WriteRawByte((byte) value); + WriteRawByte((byte) (value >> 8)); + WriteRawByte((byte) (value >> 16)); + WriteRawByte((byte) (value >> 24)); + } + else + { + buffer[position++] = ((byte) value); + buffer[position++] = ((byte) (value >> 8)); + buffer[position++] = ((byte) (value >> 16)); + buffer[position++] = ((byte) (value >> 24)); + } + } + + internal void WriteRawLittleEndian64(ulong value) + { + if (position + 8 > limit) + { + WriteRawByte((byte) value); + WriteRawByte((byte) (value >> 8)); + WriteRawByte((byte) (value >> 16)); + WriteRawByte((byte) (value >> 24)); + WriteRawByte((byte) (value >> 32)); + WriteRawByte((byte) (value >> 40)); + WriteRawByte((byte) (value >> 48)); + WriteRawByte((byte) (value >> 56)); + } + else + { + buffer[position++] = ((byte) value); + buffer[position++] = ((byte) (value >> 8)); + buffer[position++] = ((byte) (value >> 16)); + buffer[position++] = ((byte) (value >> 24)); + buffer[position++] = ((byte) (value >> 32)); + buffer[position++] = ((byte) (value >> 40)); + buffer[position++] = ((byte) (value >> 48)); + buffer[position++] = ((byte) (value >> 56)); + } + } + + internal void WriteRawByte(byte value) + { + if (position == limit) + { + RefreshBuffer(); + } + + buffer[position++] = value; + } + + internal void WriteRawByte(uint value) + { + WriteRawByte((byte) value); + } + + /// + /// Writes out an array of bytes. + /// + internal void WriteRawBytes(byte[] value) + { + WriteRawBytes(value, 0, value.Length); + } + + /// + /// Writes out part of an array of bytes. + /// + internal void WriteRawBytes(byte[] value, int offset, int length) + { + if (limit - position >= length) + { + ByteArray.Copy(value, offset, buffer, position, length); + // We have room in the current buffer. + position += length; + } + else + { + // Write extends past current buffer. Fill the rest of this buffer and + // flush. + int bytesWritten = limit - position; + ByteArray.Copy(value, offset, buffer, position, bytesWritten); + offset += bytesWritten; + length -= bytesWritten; + position = limit; + RefreshBuffer(); + + // Now deal with the rest. + // Since we have an output stream, this is our buffer + // and buffer offset == 0 + if (length <= limit) + { + // Fits in new buffer. + ByteArray.Copy(value, offset, buffer, 0, length); + position = length; + } + else + { + // Write is very big. Let's do it all at once. + output.Write(value, offset, length); + } + } + } + + #endregion + + /// + /// Encode a 32-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + internal static uint EncodeZigZag32(int n) + { + // Note: the right-shift must be arithmetic + return (uint) ((n << 1) ^ (n >> 31)); + } + + /// + /// Encode a 64-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + internal static ulong EncodeZigZag64(long n) + { + return (ulong) ((n << 1) ^ (n >> 63)); + } + + private void RefreshBuffer() + { + if (output == null) + { + // We're writing to a single buffer. + throw new OutOfSpaceException(); + } + + // Since we have an output stream, this is our buffer + // and buffer offset == 0 + output.Write(buffer, 0, position); + position = 0; + } + + /// + /// Indicates that a CodedOutputStream wrapping a flat byte array + /// ran out of space. + /// + public sealed class OutOfSpaceException : IOException + { + internal OutOfSpaceException() + : base("CodedOutputStream was writing to a flat byte array and ran out of space.") + { + } + } + + /// + /// Flushes any buffered data and optionally closes the underlying stream, if any. + /// + /// + /// + /// By default, any underlying stream is closed by this method. To configure this behaviour, + /// use a constructor overload with a leaveOpen parameter. If this instance does not + /// have an underlying stream, this method does nothing. + /// + /// + /// For the sake of efficiency, calling this method does not prevent future write calls - but + /// if a later write ends up writing to a stream which has been disposed, that is likely to + /// fail. It is recommend that you not call any other methods after this. + /// + /// + public void Dispose() + { + Flush(); + if (!leaveOpen) + { + output.Dispose(); + } + } + + /// + /// Flushes any buffered data to the underlying stream (if there is one). + /// + public void Flush() + { + if (output != null) + { + RefreshBuffer(); + } + } + + /// + /// Verifies that SpaceLeft returns zero. It's common to create a byte array + /// that is exactly big enough to hold a message, then write to it with + /// a CodedOutputStream. Calling CheckNoSpaceLeft after writing verifies that + /// the message was actually as big as expected, which can help bugs. + /// + public void CheckNoSpaceLeft() + { + if (SpaceLeft != 0) + { + throw new InvalidOperationException("Did not write as much data as expected."); + } + } + + /// + /// If writing to a flat array, returns the space left in the array. Otherwise, + /// throws an InvalidOperationException. + /// + public int SpaceLeft + { + get + { + if (output == null) + { + return limit - position; + } + else + { + throw new InvalidOperationException( + "SpaceLeft can only be called on CodedOutputStreams that are " + + "writing to a flat array."); + } + } + } + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs index 993a89d776..8dac8e301d 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -30,14 +30,13 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion +using Google.Protobuf.Compatibility; using Google.Protobuf.Reflection; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; -using Google.Protobuf.Compatibility; namespace Google.Protobuf.Collections { @@ -48,9 +47,6 @@ namespace Google.Protobuf.Collections /// Value type in the map. Must be a type supported by Protocol Buffers. /// /// - /// This implementation preserves insertion order for simplicity of testing - /// code using maps fields. Overwriting an existing entry does not change the - /// position of that entry within the map. Equality is not order-sensitive. /// For string keys, the equality comparison is provided by . /// /// @@ -65,8 +61,15 @@ namespace Google.Protobuf.Collections /// supported by Protocol Buffers (e.g. using a key type of byte) but nor does it guarantee /// that all operations will work in such cases. /// + /// + /// The order in which entries are returned when iterating over this object is undefined, and may change + /// in future versions. + /// /// public sealed class MapField : IDeepCloneable>, IDictionary, IEquatable>, IDictionary +#if !NET35 + , IReadOnlyDictionary +#endif { // TODO: Don't create the map/list until we have an entry. (Assume many maps will be empty.) private readonly Dictionary>> map = @@ -112,7 +115,7 @@ namespace Google.Protobuf.Collections // Validation of arguments happens in ContainsKey and the indexer if (ContainsKey(key)) { - throw new ArgumentException("Key already exists in map", "key"); + throw new ArgumentException("Key already exists in map", nameof(key)); } this[key] = value; } @@ -124,7 +127,7 @@ namespace Google.Protobuf.Collections /// true if the map contains the given key; false otherwise. public bool ContainsKey(TKey key) { - ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key)); return map.ContainsKey(key); } @@ -141,7 +144,7 @@ namespace Google.Protobuf.Collections /// true if the map contained the given key before the entry was removed; false otherwise. public bool Remove(TKey key) { - ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key)); LinkedListNode> node; if (map.TryGetValue(key, out node)) { @@ -189,7 +192,7 @@ namespace Google.Protobuf.Collections { get { - ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key)); TValue value; if (TryGetValue(key, out value)) { @@ -199,11 +202,11 @@ namespace Google.Protobuf.Collections } set { - ProtoPreconditions.CheckNotNullUnconstrained(key, "key"); + ProtoPreconditions.CheckNotNullUnconstrained(key, nameof(key)); // value == null check here is redundant, but avoids boxing. if (value == null) { - ProtoPreconditions.CheckNotNullUnconstrained(value, "value"); + ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value)); } LinkedListNode> node; var pair = new KeyValuePair(key, value); @@ -235,7 +238,7 @@ namespace Google.Protobuf.Collections /// The entries to add to the map. public void Add(IDictionary entries) { - ProtoPreconditions.CheckNotNull(entries, "entries"); + ProtoPreconditions.CheckNotNull(entries, nameof(entries)); foreach (var pair in entries) { Add(pair.Key, pair.Value); @@ -314,7 +317,7 @@ namespace Google.Protobuf.Collections { if (item.Key == null) { - throw new ArgumentException("Key is null", "item"); + throw new ArgumentException("Key is null", nameof(item)); } LinkedListNode> node; if (map.TryGetValue(item.Key, out node) && @@ -502,7 +505,7 @@ namespace Google.Protobuf.Collections void IDictionary.Remove(object key) { - ProtoPreconditions.CheckNotNull(key, "key"); + ProtoPreconditions.CheckNotNull(key, nameof(key)); if (!(key is TKey)) { return; @@ -531,7 +534,7 @@ namespace Google.Protobuf.Collections { get { - ProtoPreconditions.CheckNotNull(key, "key"); + ProtoPreconditions.CheckNotNull(key, nameof(key)); if (!(key is TKey)) { return null; @@ -548,6 +551,14 @@ namespace Google.Protobuf.Collections } #endregion + #region IReadOnlyDictionary explicit interface implementation +#if !NET35 + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; +#endif + #endregion + private class DictionaryEnumerator : IDictionaryEnumerator { private readonly IEnumerator> enumerator; @@ -713,11 +724,11 @@ namespace Google.Protobuf.Collections { if (arrayIndex < 0) { - throw new ArgumentOutOfRangeException("arrayIndex"); + throw new ArgumentOutOfRangeException(nameof(arrayIndex)); } - if (arrayIndex + Count >= array.Length) + if (arrayIndex + Count > array.Length) { - throw new ArgumentException("Not enough space in the array", "array"); + throw new ArgumentException("Not enough space in the array", nameof(array)); } foreach (var item in this) { @@ -744,11 +755,11 @@ namespace Google.Protobuf.Collections { if (index < 0) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } - if (index + Count >= array.Length) + if (index + Count > array.Length) { - throw new ArgumentException("Not enough space in the array", "array"); + throw new ArgumentException("Not enough space in the array", nameof(array)); } foreach (var item in this) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs index 28530a29a8..84360667d8 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/ReadOnlyDictionary.cs @@ -1,147 +1,147 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Google.Protobuf.Collections -{ - /// - /// Read-only wrapper around another dictionary. - /// - internal sealed class ReadOnlyDictionary : IDictionary - { - private readonly IDictionary wrapped; - - public ReadOnlyDictionary(IDictionary wrapped) - { - this.wrapped = wrapped; - } - - public void Add(TKey key, TValue value) - { - throw new InvalidOperationException(); - } - - public bool ContainsKey(TKey key) - { - return wrapped.ContainsKey(key); - } - - public ICollection Keys - { - get { return wrapped.Keys; } - } - - public bool Remove(TKey key) - { - throw new InvalidOperationException(); - } - - public bool TryGetValue(TKey key, out TValue value) - { - return wrapped.TryGetValue(key, out value); - } - - public ICollection Values - { - get { return wrapped.Values; } - } - - public TValue this[TKey key] - { - get { return wrapped[key]; } - set { throw new InvalidOperationException(); } - } - - public void Add(KeyValuePair item) - { - throw new InvalidOperationException(); - } - - public void Clear() - { - throw new InvalidOperationException(); - } - - public bool Contains(KeyValuePair item) - { - return wrapped.Contains(item); - } - - public void CopyTo(KeyValuePair[] array, int arrayIndex) - { - wrapped.CopyTo(array, arrayIndex); - } - - public int Count - { - get { return wrapped.Count; } - } - - public bool IsReadOnly - { - get { return true; } - } - - public bool Remove(KeyValuePair item) - { - throw new InvalidOperationException(); - } - - public IEnumerator> GetEnumerator() - { - return wrapped.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return ((IEnumerable) wrapped).GetEnumerator(); - } - - public override bool Equals(object obj) - { - return wrapped.Equals(obj); - } - - public override int GetHashCode() - { - return wrapped.GetHashCode(); - } - - public override string ToString() - { - return wrapped.ToString(); - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Google.Protobuf.Collections +{ + /// + /// Read-only wrapper around another dictionary. + /// + internal sealed class ReadOnlyDictionary : IDictionary + { + private readonly IDictionary wrapped; + + public ReadOnlyDictionary(IDictionary wrapped) + { + this.wrapped = wrapped; + } + + public void Add(TKey key, TValue value) + { + throw new InvalidOperationException(); + } + + public bool ContainsKey(TKey key) + { + return wrapped.ContainsKey(key); + } + + public ICollection Keys + { + get { return wrapped.Keys; } + } + + public bool Remove(TKey key) + { + throw new InvalidOperationException(); + } + + public bool TryGetValue(TKey key, out TValue value) + { + return wrapped.TryGetValue(key, out value); + } + + public ICollection Values + { + get { return wrapped.Values; } + } + + public TValue this[TKey key] + { + get { return wrapped[key]; } + set { throw new InvalidOperationException(); } + } + + public void Add(KeyValuePair item) + { + throw new InvalidOperationException(); + } + + public void Clear() + { + throw new InvalidOperationException(); + } + + public bool Contains(KeyValuePair item) + { + return wrapped.Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + wrapped.CopyTo(array, arrayIndex); + } + + public int Count + { + get { return wrapped.Count; } + } + + public bool IsReadOnly + { + get { return true; } + } + + public bool Remove(KeyValuePair item) + { + throw new InvalidOperationException(); + } + + public IEnumerator> GetEnumerator() + { + return wrapped.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable) wrapped).GetEnumerator(); + } + + public override bool Equals(object obj) + { + return wrapped.Equals(obj); + } + + public override int GetHashCode() + { + return wrapped.GetHashCode(); + } + + public override string ToString() + { + return wrapped.ToString(); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs old mode 100644 new mode 100755 index d1db856c9c..6063ff6158 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Collections/RepeatedField.cs @@ -34,7 +34,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.IO; -using System.Text; namespace Google.Protobuf.Collections { @@ -48,6 +47,9 @@ namespace Google.Protobuf.Collections /// /// The element type of the repeated field. public sealed class RepeatedField : IList, IList, IDeepCloneable>, IEquatable> +#if !NET35 + , IReadOnlyList +#endif { private static readonly T[] EmptyArray = new T[0]; private const int MinArraySize = 8; @@ -227,10 +229,7 @@ namespace Google.Protobuf.Collections /// The item to add. public void Add(T item) { - if (item == null) - { - throw new ArgumentNullException("item"); - } + ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); EnsureSize(count + 1); array[count++] = item; } @@ -285,48 +284,84 @@ namespace Google.Protobuf.Collections /// /// Gets the number of elements contained in the collection. /// - public int Count { get { return count; } } + public int Count => count; /// /// Gets a value indicating whether the collection is read-only. /// - public bool IsReadOnly { get { return false; } } - - // TODO: Remove this overload and just handle it in the one below, at execution time? + public bool IsReadOnly => false; /// /// Adds all of the specified values into this collection. /// /// The values to add to this collection. - public void Add(RepeatedField values) + public void AddRange(IEnumerable values) { - if (values == null) - { - throw new ArgumentNullException("values"); - } - EnsureSize(count + values.count); - // We know that all the values will be valid, because it's a RepeatedField. - Array.Copy(values.array, 0, array, count, values.count); - count += values.count; - } + ProtoPreconditions.CheckNotNull(values, nameof(values)); - /// - /// Adds all of the specified values into this collection. - /// - /// The values to add to this collection. - public void Add(IEnumerable values) - { - if (values == null) + // Optimization 1: If the collection we're adding is already a RepeatedField, + // we know the values are valid. + var otherRepeatedField = values as RepeatedField; + if (otherRepeatedField != null) { - throw new ArgumentNullException("values"); + EnsureSize(count + otherRepeatedField.count); + Array.Copy(otherRepeatedField.array, 0, array, count, otherRepeatedField.count); + count += otherRepeatedField.count; + return; } - // TODO: Check for ICollection and get the Count, to optimize? + + // Optimization 2: The collection is an ICollection, so we can expand + // just once and ask the collection to copy itself into the array. + var collection = values as ICollection; + if (collection != null) + { + var extraCount = collection.Count; + // For reference types and nullable value types, we need to check that there are no nulls + // present. (This isn't a thread-safe approach, but we don't advertise this is thread-safe.) + // We expect the JITter to optimize this test to true/false, so it's effectively conditional + // specialization. + if (default(T) == null) + { + // TODO: Measure whether iterating once to check and then letting the collection copy + // itself is faster or slower than iterating and adding as we go. For large + // collections this will not be great in terms of cache usage... but the optimized + // copy may be significantly faster than doing it one at a time. + foreach (var item in collection) + { + if (item == null) + { + throw new ArgumentException("Sequence contained null element", nameof(values)); + } + } + } + EnsureSize(count + extraCount); + collection.CopyTo(array, count); + count += extraCount; + return; + } + + // We *could* check for ICollection as well, but very very few collections implement + // ICollection but not ICollection. (HashSet does, for one...) + + // Fall back to a slower path of adding items one at a time. foreach (T item in values) { Add(item); } } + /// + /// Adds all of the specified values into this collection. This method is present to + /// allow repeated fields to be constructed from queries within collection initializers. + /// Within non-collection-initializer code, consider using the equivalent + /// method instead for clarity. + /// + /// The values to add to this collection. + public void Add(IEnumerable values) + { + AddRange(values); + } + /// /// Returns an enumerator that iterates through the collection. /// @@ -418,10 +453,7 @@ namespace Google.Protobuf.Collections /// The zero-based index of the item, or -1 if it is not found. public int IndexOf(T item) { - if (item == null) - { - throw new ArgumentNullException("item"); - } + ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); EqualityComparer comparer = EqualityComparer.Default; for (int i = 0; i < count; i++) { @@ -440,13 +472,10 @@ namespace Google.Protobuf.Collections /// The item to insert. public void Insert(int index, T item) { - if (item == null) - { - throw new ArgumentNullException("item"); - } + ProtoPreconditions.CheckNotNullUnconstrained(item, nameof(item)); if (index < 0 || index > count) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } EnsureSize(count + 1); Array.Copy(array, index, array, index + 1, count - index); @@ -462,7 +491,7 @@ namespace Google.Protobuf.Collections { if (index < 0 || index >= count) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } Array.Copy(array, index + 1, array, index, count - index - 1); count--; @@ -494,7 +523,7 @@ namespace Google.Protobuf.Collections { if (index < 0 || index >= count) { - throw new ArgumentOutOfRangeException("index"); + throw new ArgumentOutOfRangeException(nameof(index)); } return array[index]; } @@ -502,27 +531,24 @@ namespace Google.Protobuf.Collections { if (index < 0 || index >= count) { - throw new ArgumentOutOfRangeException("index"); - } - if (value == null) - { - throw new ArgumentNullException("value"); + throw new ArgumentOutOfRangeException(nameof(index)); } + ProtoPreconditions.CheckNotNullUnconstrained(value, nameof(value)); array[index] = value; } } #region Explicit interface implementation for IList and ICollection. - bool IList.IsFixedSize { get { return false; } } + bool IList.IsFixedSize => false; void ICollection.CopyTo(Array array, int index) { Array.Copy(this.array, 0, array, index, count); } - bool ICollection.IsSynchronized { get { return false; } } + bool ICollection.IsSynchronized => false; - object ICollection.SyncRoot { get { return this; } } + object ICollection.SyncRoot => this; object IList.this[int index] { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs old mode 100644 new mode 100755 index 8a6fefa74e..95a02c727f --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs @@ -47,7 +47,11 @@ namespace Google.Protobuf.Compatibility /// internal static MethodInfo GetGetMethod(this PropertyInfo target) { +#if NET35 + var method = target.GetGetMethod(); +#else var method = target.GetMethod; +#endif return method != null && method.IsPublic ? method : null; } @@ -57,7 +61,11 @@ namespace Google.Protobuf.Compatibility /// internal static MethodInfo GetSetMethod(this PropertyInfo target) { +#if NET35 + var method = target.GetSetMethod(); +#else var method = target.SetMethod; +#endif return method != null && method.IsPublic ? method : null; } } diff --git a/packager/third_party/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs old mode 100644 new mode 100755 similarity index 57% rename from packager/third_party/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java rename to packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs index 05b2b161a3..bf4bf22018 --- a/packager/third_party/protobuf/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs @@ -1,6 +1,7 @@ +#region Copyright notice and license // Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://code.google.com/p/protobuf/ +// Copyright 2015 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -27,34 +28,39 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion -package com.google.protobuf; +#if NET35 +using System; +using System.IO; -/** - * Base interface for methods common to {@link MessageLite} - * and {@link MessageLite.Builder} to provide type equivalency. - * - * @author jonp@google.com (Jon Perlow) - */ -public interface MessageLiteOrBuilder { - /** - * Get an instance of the type with no fields set. Because no fields are set, - * all getters for singular fields will return default values and repeated - * fields will appear empty. - * This may or may not be a singleton. This differs from the - * {@code getDefaultInstance()} method of generated message classes in that - * this method is an abstract method of the {@code MessageLite} interface - * whereas {@code getDefaultInstance()} is a static method of a specific - * class. They return the same thing. - */ - MessageLite getDefaultInstanceForType(); +namespace Google.Protobuf.Compatibility +{ + /// + /// Extension methods for in order to provide + /// backwards compatibility with .NET 3.5 + /// + public static class StreamExtensions + { + // 81920 seems to be the default buffer size used in .NET 4.5.1 + private const int BUFFER_SIZE = 81920; - /** - * Returns true if all required fields in the message and all embedded - * messages are set, false otherwise. - * - *

See also: {@link MessageOrBuilder#getInitializationErrorString()} - */ - boolean isInitialized(); + ///

+ /// Write the contents of the current stream to the destination stream + /// + public static void CopyTo(this Stream source, Stream destination) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + byte[] buffer = new byte[BUFFER_SIZE]; + int numBytesRead; + while ((numBytesRead = source.Read(buffer, 0, buffer.Length)) > 0) { + destination.Write(buffer, 0, numBytesRead); + } + } + } } +#endif diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs old mode 100644 new mode 100755 index 762a29eb0a..2f23713819 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs @@ -33,6 +33,7 @@ using System; using System.Reflection; +#if !NET35 namespace Google.Protobuf.Compatibility { /// @@ -45,15 +46,6 @@ namespace Google.Protobuf.Compatibility /// internal static class TypeExtensions { - /// - /// Returns true if the target type is a value type, including a nullable value type or an enum, or false - /// if it's a reference type (class, delegate, interface - including System.ValueType and System.Enum). - /// - internal static bool IsValueType(this Type target) - { - return target.GetTypeInfo().IsValueType; - } - /// /// See https://msdn.microsoft.com/en-us/library/system.type.isassignablefrom /// @@ -111,3 +103,4 @@ namespace Google.Protobuf.Compatibility } } } +#endif diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/FieldCodec.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/FieldCodec.cs index 9831308882..c28b47e1eb 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/FieldCodec.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/FieldCodec.cs @@ -347,7 +347,8 @@ namespace Google.Protobuf public sealed class FieldCodec { private static readonly T DefaultDefault; - private static readonly bool TypeSupportsPacking = typeof(T).IsValueType() && Nullable.GetUnderlyingType(typeof(T)) == null; + // Only non-nullable value types support packing. This is the simplest way of detecting that. + private static readonly bool TypeSupportsPacking = default(T) != null; static FieldCodec() { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs index c8060f6ca8..9498dbe4cc 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/FrameworkPortability.cs @@ -1,49 +1,49 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.Text.RegularExpressions; - -namespace Google.Protobuf -{ - /// - /// Class containing helpful workarounds for various platform compatibility - /// - internal static class FrameworkPortability - { - // The value of RegexOptions.Compiled is 8. We can test for the presence at - // execution time using Enum.IsDefined, so a single build will do the right thing - // on each platform. (RegexOptions.Compiled isn't supported by PCLs.) - internal static readonly RegexOptions CompiledRegexWhereAvailable = - Enum.IsDefined(typeof(RegexOptions), 8) ? (RegexOptions)8 : RegexOptions.None; - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Text.RegularExpressions; + +namespace Google.Protobuf +{ + /// + /// Class containing helpful workarounds for various platform compatibility + /// + internal static class FrameworkPortability + { + // The value of RegexOptions.Compiled is 8. We can test for the presence at + // execution time using Enum.IsDefined, so a single build will do the right thing + // on each platform. (RegexOptions.Compiled isn't supported by PCLs.) + internal static readonly RegexOptions CompiledRegexWhereAvailable = + Enum.IsDefined(typeof(RegexOptions), 8) ? (RegexOptions)8 : RegexOptions.None; + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj index fdd97ddf74..46418e3921 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -1,168 +1,33 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {6908BDCE-D925-43F3-94AC-A531E6DF2591} - Library - Properties - Google.Protobuf - Google.Protobuf - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile259 - v4.5 - 512 - 3.5 - 10.0 - - + C# runtime library for Protocol Buffers - Google's data interchange format. + Copyright 2015, Google Inc. + Google Protocol Buffers + 3.3.0 + Google Inc. + netstandard1.0;net451 + true + ../../keys/Google.Protobuf.snk + true + true + Protocol;Buffers;Binary;Serialization;Format;Google;proto;proto3 + C# proto3 support + https://github.com/google/protobuf + https://github.com/google/protobuf/blob/master/LICENSE + git + https://github.com/google/protobuf.git + true + true - - true - full - false - bin\Debug - obj\Debug\ - bin\Debug\Google.Protobuf.xml - - - DEBUG;TRACE - prompt - 4 - true - Off - true + + + + netstandard1.0 - - pdbonly - true - bin\Release - obj\Release\ - $(OutputPath)\$(AssemblyName).xml - - - TRACE - prompt - 4 - true - Off - true - - - pdbonly - true - bin\ReleaseSigned - obj\ReleaseSigned\ - $(OutputPath)\$(AssemblyName).xml - - - TRACE;SIGNED - prompt - 4 - true - Off - True - ..\..\keys\Google.Protobuf.snk - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file + + diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.nuspec b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.nuspec deleted file mode 100644 index 90e3da3d0e..0000000000 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Google.Protobuf.nuspec +++ /dev/null @@ -1,54 +0,0 @@ - - - - Google.Protobuf - Google Protocol Buffers C# - C# runtime library for Protocol Buffers - Google's data interchange format. - See project site for more info. - 3.0.0-beta3 - Google Inc. - protobuf-packages - https://github.com/google/protobuf/blob/master/LICENSE - https://github.com/google/protobuf - false - C# proto3 support - Copyright 2015, Google Inc. - Protocol Buffers Binary Serialization Format Google proto proto3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/IMessage.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/IMessage.cs index 3e644c1773..d089f94639 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/IMessage.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/IMessage.cs @@ -1,87 +1,87 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using Google.Protobuf.Reflection; - -namespace Google.Protobuf -{ - /// - /// Interface for a Protocol Buffers message, supporting - /// basic operations required for serialization. - /// - public interface IMessage - { - /// - /// Merges the data from the specified coded input stream with the current message. - /// - /// See the user guide for precise merge semantics. - /// - void MergeFrom(CodedInputStream input); - - /// - /// Writes the data to the given coded output stream. - /// - /// Coded output stream to write the data to. Must not be null. - void WriteTo(CodedOutputStream output); - - /// - /// Calculates the size of this message in Protocol Buffer wire format, in bytes. - /// - /// The number of bytes required to write this message - /// to a coded output stream. - int CalculateSize(); - - /// - /// Descriptor for this message. All instances are expected to return the same descriptor, - /// and for generated types this will be an explicitly-implemented member, returning the - /// same value as the static property declared on the type. - /// - MessageDescriptor Descriptor { get; } - } - - /// - /// Generic interface for a Protocol Buffers message, - /// where the type parameter is expected to be the same type as - /// the implementation class. - /// - /// The message type. - public interface IMessage : IMessage, IEquatable, IDeepCloneable where T : IMessage - { - /// - /// Merges the given message into this one. - /// - /// See the user guide for precise merge semantics. - /// The message to merge with this one. Must not be null. - void MergeFrom(T message); - } -} +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using Google.Protobuf.Reflection; + +namespace Google.Protobuf +{ + /// + /// Interface for a Protocol Buffers message, supporting + /// basic operations required for serialization. + /// + public interface IMessage + { + /// + /// Merges the data from the specified coded input stream with the current message. + /// + /// See the user guide for precise merge semantics. + /// + void MergeFrom(CodedInputStream input); + + /// + /// Writes the data to the given coded output stream. + /// + /// Coded output stream to write the data to. Must not be null. + void WriteTo(CodedOutputStream output); + + /// + /// Calculates the size of this message in Protocol Buffer wire format, in bytes. + /// + /// The number of bytes required to write this message + /// to a coded output stream. + int CalculateSize(); + + /// + /// Descriptor for this message. All instances are expected to return the same descriptor, + /// and for generated types this will be an explicitly-implemented member, returning the + /// same value as the static property declared on the type. + /// + MessageDescriptor Descriptor { get; } + } + + /// + /// Generic interface for a Protocol Buffers message, + /// where the type parameter is expected to be the same type as + /// the implementation class. + /// + /// The message type. + public interface IMessage : IMessage, IEquatable, IDeepCloneable where T : IMessage + { + /// + /// Merges the given message into this one. + /// + /// See the user guide for precise merge semantics. + /// The message to merge with this one. Must not be null. + void MergeFrom(T message); + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs index a6aefb6fa4..0fbc530631 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs @@ -1,129 +1,129 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System; -using System.IO; - -namespace Google.Protobuf -{ - /// - /// Thrown when a protocol message being parsed is invalid in some way, - /// e.g. it contains a malformed varint or a negative byte length. - /// - public sealed class InvalidProtocolBufferException : IOException - { - internal InvalidProtocolBufferException(string message) - : base(message) - { - } - - internal InvalidProtocolBufferException(string message, Exception innerException) - : base(message, innerException) - { - } - - internal static InvalidProtocolBufferException MoreDataAvailable() - { - return new InvalidProtocolBufferException( - "Completed reading a message while more data was available in the stream."); - } - - internal static InvalidProtocolBufferException TruncatedMessage() - { - return new InvalidProtocolBufferException( - "While parsing a protocol message, the input ended unexpectedly " + - "in the middle of a field. This could mean either than the " + - "input has been truncated or that an embedded message " + - "misreported its own length."); - } - - internal static InvalidProtocolBufferException NegativeSize() - { - return new InvalidProtocolBufferException( - "CodedInputStream encountered an embedded string or message " + - "which claimed to have negative size."); - } - - internal static InvalidProtocolBufferException MalformedVarint() - { - return new InvalidProtocolBufferException( - "CodedInputStream encountered a malformed varint."); - } - - /// - /// Creates an exception for an error condition of an invalid tag being encountered. - /// - internal static InvalidProtocolBufferException InvalidTag() - { - return new InvalidProtocolBufferException( - "Protocol message contained an invalid tag (zero)."); - } - - internal static InvalidProtocolBufferException InvalidBase64(Exception innerException) - { - return new InvalidProtocolBufferException("Invalid base64 data", innerException); - } - - internal static InvalidProtocolBufferException InvalidEndTag() - { - return new InvalidProtocolBufferException( - "Protocol message end-group tag did not match expected tag."); - } - - internal static InvalidProtocolBufferException RecursionLimitExceeded() - { - return new InvalidProtocolBufferException( - "Protocol message had too many levels of nesting. May be malicious. " + - "Use CodedInputStream.SetRecursionLimit() to increase the depth limit."); - } - - internal static InvalidProtocolBufferException JsonRecursionLimitExceeded() - { - return new InvalidProtocolBufferException( - "Protocol message had too many levels of nesting. May be malicious. " + - "Use JsonParser.Settings to increase the depth limit."); - } - - internal static InvalidProtocolBufferException SizeLimitExceeded() - { - return new InvalidProtocolBufferException( - "Protocol message was too large. May be malicious. " + - "Use CodedInputStream.SetSizeLimit() to increase the size limit."); - } - - internal static InvalidProtocolBufferException InvalidMessageStreamTag() - { - return new InvalidProtocolBufferException( - "Stream of protocol messages had invalid tag. Expected tag is length-delimited field 1."); - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.IO; + +namespace Google.Protobuf +{ + /// + /// Thrown when a protocol message being parsed is invalid in some way, + /// e.g. it contains a malformed varint or a negative byte length. + /// + public sealed class InvalidProtocolBufferException : IOException + { + internal InvalidProtocolBufferException(string message) + : base(message) + { + } + + internal InvalidProtocolBufferException(string message, Exception innerException) + : base(message, innerException) + { + } + + internal static InvalidProtocolBufferException MoreDataAvailable() + { + return new InvalidProtocolBufferException( + "Completed reading a message while more data was available in the stream."); + } + + internal static InvalidProtocolBufferException TruncatedMessage() + { + return new InvalidProtocolBufferException( + "While parsing a protocol message, the input ended unexpectedly " + + "in the middle of a field. This could mean either that the " + + "input has been truncated or that an embedded message " + + "misreported its own length."); + } + + internal static InvalidProtocolBufferException NegativeSize() + { + return new InvalidProtocolBufferException( + "CodedInputStream encountered an embedded string or message " + + "which claimed to have negative size."); + } + + internal static InvalidProtocolBufferException MalformedVarint() + { + return new InvalidProtocolBufferException( + "CodedInputStream encountered a malformed varint."); + } + + /// + /// Creates an exception for an error condition of an invalid tag being encountered. + /// + internal static InvalidProtocolBufferException InvalidTag() + { + return new InvalidProtocolBufferException( + "Protocol message contained an invalid tag (zero)."); + } + + internal static InvalidProtocolBufferException InvalidBase64(Exception innerException) + { + return new InvalidProtocolBufferException("Invalid base64 data", innerException); + } + + internal static InvalidProtocolBufferException InvalidEndTag() + { + return new InvalidProtocolBufferException( + "Protocol message end-group tag did not match expected tag."); + } + + internal static InvalidProtocolBufferException RecursionLimitExceeded() + { + return new InvalidProtocolBufferException( + "Protocol message had too many levels of nesting. May be malicious. " + + "Use CodedInputStream.SetRecursionLimit() to increase the depth limit."); + } + + internal static InvalidProtocolBufferException JsonRecursionLimitExceeded() + { + return new InvalidProtocolBufferException( + "Protocol message had too many levels of nesting. May be malicious. " + + "Use JsonParser.Settings to increase the depth limit."); + } + + internal static InvalidProtocolBufferException SizeLimitExceeded() + { + return new InvalidProtocolBufferException( + "Protocol message was too large. May be malicious. " + + "Use CodedInputStream.SetSizeLimit() to increase the size limit."); + } + + internal static InvalidProtocolBufferException InvalidMessageStreamTag() + { + return new InvalidProtocolBufferException( + "Stream of protocol messages had invalid tag. Expected tag is length-delimited field 1."); + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs old mode 100644 new mode 100755 index 8377247326..4ae10d8b73 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonFormatter.cs @@ -248,80 +248,26 @@ namespace Google.Protobuf return !first; } - /// - /// Camel-case converter with added strictness for field mask formatting. - /// - /// The field mask is invalid for JSON representation - private static string ToCamelCaseForFieldMask(string input) + // Converted from java/core/src/main/java/com/google/protobuf/Descriptors.java + internal static string ToJsonName(string name) { - for (int i = 0; i < input.Length; i++) + StringBuilder result = new StringBuilder(name.Length); + bool isNextUpperCase = false; + foreach (char ch in name) { - char c = input[i]; - if (c >= 'A' && c <= 'Z') + if (ch == '_') { - throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}"); + isNextUpperCase = true; } - if (c == '_' && i < input.Length - 1) + else if (isNextUpperCase) { - char next = input[i + 1]; - if (next < 'a' || next > 'z') - { - throw new InvalidOperationException($"Invalid field mask to be converted to JSON: {input}"); - } + result.Append(char.ToUpperInvariant(ch)); + isNextUpperCase = false; } - } - return ToCamelCase(input); - } - - // Converted from src/google/protobuf/util/internal/utility.cc ToCamelCase - // TODO: Use the new field in FieldDescriptor. - internal static string ToCamelCase(string input) - { - bool capitalizeNext = false; - bool wasCap = true; - bool isCap = false; - bool firstWord = true; - StringBuilder result = new StringBuilder(input.Length); - - for (int i = 0; i < input.Length; i++, wasCap = isCap) - { - isCap = char.IsUpper(input[i]); - if (input[i] == '_') + else { - capitalizeNext = true; - if (result.Length != 0) - { - firstWord = false; - } - continue; + result.Append(ch); } - else if (firstWord) - { - // Consider when the current character B is capitalized, - // first word ends when: - // 1) following a lowercase: "...aB..." - // 2) followed by a lowercase: "...ABc..." - if (result.Length != 0 && isCap && - (!wasCap || (i + 1 < input.Length && char.IsLower(input[i + 1])))) - { - firstWord = false; - } - else - { - result.Append(char.ToLowerInvariant(input[i])); - continue; - } - } - else if (capitalizeNext) - { - capitalizeNext = false; - if (char.IsLower(input[i])) - { - result.Append(char.ToUpperInvariant(input[i])); - continue; - } - } - result.Append(input[i]); } return result.ToString(); } @@ -377,8 +323,16 @@ namespace Google.Protobuf throw new ArgumentException("Invalid field type"); } } - - private void WriteValue(TextWriter writer, object value) + + /// + /// Writes a single value to the given writer as JSON. Only types understood by + /// Protocol Buffers can be written in this way. This method is only exposed for + /// advanced use cases; most users should be using + /// or . + /// + /// The writer to write the value to. Must not be null. + /// The value to write. May be null. + public void WriteValue(TextWriter writer, object value) { if (value == null) { @@ -421,14 +375,21 @@ namespace Google.Protobuf } else if (value is System.Enum) { - string name = OriginalEnumValueHelper.GetOriginalName(value); - if (name != null) + if (settings.FormatEnumsAsIntegers) { - WriteString(writer, name); + WriteValue(writer, (int)value); } else { - WriteValue(writer, (int)value); + string name = OriginalEnumValueHelper.GetOriginalName(value); + if (name != null) + { + WriteString(writer, name); + } + else + { + WriteValue(writer, (int)value); + } } } else if (value is float || value is double) @@ -447,15 +408,7 @@ namespace Google.Protobuf } else if (value is IMessage) { - IMessage message = (IMessage) value; - if (message.Descriptor.IsWellKnownType) - { - WriteWellKnownTypeValue(writer, message.Descriptor, value); - } - else - { - WriteMessage(writer, (IMessage)value); - } + Format((IMessage)value, writer); } else { @@ -723,20 +676,6 @@ namespace Google.Protobuf writer.Write(first ? "}" : " }"); } - /// - /// Returns whether or not a singular value can be represented in JSON. - /// Currently only relevant for enums, where unknown values can't be represented. - /// For repeated/map fields, this always returns true. - /// - private bool CanWriteSingleValue(object value) - { - if (value is System.Enum) - { - return System.Enum.IsDefined(value.GetType(), value); - } - return true; - } - /// /// Writes a string (including leading and trailing double quotes) to a builder, escaping as required. /// @@ -846,7 +785,11 @@ namespace Google.Protobuf /// public TypeRegistry TypeRegistry { get; } - // TODO: Work out how we're going to scale this to multiple settings. "WithXyz" methods? + /// + /// Whether to format enums as ints. Defaults to false. + /// + public bool FormatEnumsAsIntegers { get; } + /// /// Creates a new object with the specified formatting of default values @@ -863,11 +806,42 @@ namespace Google.Protobuf /// /// true if default values (0, empty strings etc) should be formatted; false otherwise. /// The to use when formatting messages. - public Settings(bool formatDefaultValues, TypeRegistry typeRegistry) + public Settings(bool formatDefaultValues, TypeRegistry typeRegistry) : this(formatDefaultValues, typeRegistry, false) + { + } + + /// + /// Creates a new object with the specified parameters. + /// + /// true if default values (0, empty strings etc) should be formatted; false otherwise. + /// The to use when formatting messages. TypeRegistry.Empty will be used if it is null. + /// true to format the enums as integers; false to format enums as enum names. + private Settings(bool formatDefaultValues, + TypeRegistry typeRegistry, + bool formatEnumsAsIntegers) { FormatDefaultValues = formatDefaultValues; - TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, nameof(typeRegistry)); + TypeRegistry = typeRegistry ?? TypeRegistry.Empty; + FormatEnumsAsIntegers = formatEnumsAsIntegers; } + + /// + /// Creates a new object with the specified formatting of default values and the current settings. + /// + /// true if default values (0, empty strings etc) should be formatted; false otherwise. + public Settings WithFormatDefaultValues(bool formatDefaultValues) => new Settings(formatDefaultValues, TypeRegistry, FormatEnumsAsIntegers); + + /// + /// Creates a new object with the specified type registry and the current settings. + /// + /// The to use when formatting messages. + public Settings WithTypeRegistry(TypeRegistry typeRegistry) => new Settings(FormatDefaultValues, typeRegistry, FormatEnumsAsIntegers); + + /// + /// Creates a new object with the specified enums formatting option and the current settings. + /// + /// true to format the enums as integers; false to format enums as enum names. + public Settings WithFormatEnumsAsIntegers(bool formatEnumsAsIntegers) => new Settings(FormatDefaultValues, TypeRegistry, formatEnumsAsIntegers); } // Effectively a cache of mapping from enum values to the original name as specified in the proto file, @@ -899,14 +873,30 @@ namespace Google.Protobuf return originalName; } +#if NET35 + // TODO: Consider adding functionality to TypeExtensions to avoid this difference. + private static Dictionary GetNameMapping(System.Type enumType) => + enumType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static) + .Where(f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false) + .FirstOrDefault() as OriginalNameAttribute) + ?.PreferredAlias ?? true) + .ToDictionary(f => f.GetValue(null), + f => (f.GetCustomAttributes(typeof(OriginalNameAttribute), false) + .FirstOrDefault() as OriginalNameAttribute) + // If the attribute hasn't been applied, fall back to the name of the field. + ?.Name ?? f.Name); +#else private static Dictionary GetNameMapping(System.Type enumType) => enumType.GetTypeInfo().DeclaredFields .Where(f => f.IsStatic) + .Where(f => f.GetCustomAttributes() + .FirstOrDefault()?.PreferredAlias ?? true) .ToDictionary(f => f.GetValue(null), f => f.GetCustomAttributes() .FirstOrDefault() // If the attribute hasn't been applied, fall back to the name of the field. ?.Name ?? f.Name); +#endif } } } diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs index d738ebb04b..6b6f2d9ae2 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/JsonParser.cs @@ -86,7 +86,8 @@ namespace Google.Protobuf { FloatValue.Descriptor.FullName, MergeWrapperField }, { DoubleValue.Descriptor.FullName, MergeWrapperField }, { BytesValue.Descriptor.FullName, MergeWrapperField }, - { StringValue.Descriptor.FullName, MergeWrapperField } + { StringValue.Descriptor.FullName, MergeWrapperField }, + { BoolValue.Descriptor.FullName, MergeWrapperField } }; // Convenience method to avoid having to repeat the same code multiple times in the above diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs index ad852eba5d..9b179bd7cd 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs @@ -1,67 +1,49 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Security; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("Google.Protobuf")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Google.Protobuf")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -#if !NCRUNCH -[assembly: AllowPartiallyTrustedCallers] -#endif - -#if SIGNED -[assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" + - "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" + - "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" + - "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" + - "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" + - "c5ae9cb6")] -#else -[assembly: InternalsVisibleTo("Google.Protobuf.Test")] -#endif - -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] -[assembly: AssemblyInformationalVersion("3.0.0-beta3")] +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System.Runtime.CompilerServices; +using System.Security; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +#if !NCRUNCH +[assembly: AllowPartiallyTrustedCallers] +#endif + +[assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=" + + "002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a1" + + "7c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd" + + "981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dc" + + "b6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665" + + "c5ae9cb6")] diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs new file mode 100644 index 0000000000..88b3ec000d --- /dev/null +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/CustomOptions.cs @@ -0,0 +1,390 @@ +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2017 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Collections.Generic; + +namespace Google.Protobuf.Reflection +{ + /// + /// Container for a set of custom options specified within a message, field etc. + /// + /// + /// + /// This type is publicly immutable, but internally mutable. It is only populated + /// by the descriptor parsing code - by the time any user code is able to see an instance, + /// it will be fully initialized. + /// + /// + /// If an option is requested using the incorrect method, an answer may still be returned: all + /// of the numeric types are represented internally using 64-bit integers, for example. It is up to + /// the caller to ensure that they make the appropriate method call for the option they're interested in. + /// Note that enum options are simply stored as integers, so the value should be fetched using + /// and then cast appropriately. + /// + /// + /// Repeated options are currently not supported. Asking for a single value of an option + /// which was actually repeated will return the last value, except for message types where + /// all the set values are merged together. + /// + /// + public sealed class CustomOptions + { + /// + /// Singleton for all descriptors with an empty set of options. + /// + internal static readonly CustomOptions Empty = new CustomOptions(); + + /// + /// A sequence of values per field. This needs to be per field rather than per tag to allow correct deserialization + /// of repeated fields which could be "int, ByteString, int" - unlikely as that is. The fact that values are boxed + /// is unfortunate; we might be able to use a struct instead, and we could combine uint and ulong values. + /// + private readonly Dictionary> valuesByField = new Dictionary>(); + + private CustomOptions() { } + + /// + /// Retrieves a Boolean value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetBool(int field, out bool value) + { + ulong? tmp = GetLastNumericValue(field); + value = tmp == 1UL; + return tmp != null; + } + + /// + /// Retrieves a signed 32-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetInt32(int field, out int value) + { + ulong? tmp = GetLastNumericValue(field); + value = (int) tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves a signed 64-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetInt64(int field, out long value) + { + ulong? tmp = GetLastNumericValue(field); + value = (long) tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves an unsigned 32-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetFixed32(int field, out uint value) => TryGetUInt32(field, out value); + + /// + /// Retrieves an unsigned 64-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetFixed64(int field, out ulong value) => TryGetUInt64(field, out value); + + /// + /// Retrieves a signed 32-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSFixed32(int field, out int value) => TryGetInt32(field, out value); + + /// + /// Retrieves a signed 64-bit integer value for the specified option field, + /// assuming a fixed-length representation. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSFixed64(int field, out long value) => TryGetInt64(field, out value); + + /// + /// Retrieves a signed 32-bit integer value for the specified option field, + /// assuming a zigzag encoding. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSInt32(int field, out int value) + { + ulong? tmp = GetLastNumericValue(field); + value = CodedInputStream.DecodeZigZag32((uint) tmp.GetValueOrDefault()); + return tmp != null; + } + + /// + /// Retrieves a signed 64-bit integer value for the specified option field, + /// assuming a zigzag encoding. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetSInt64(int field, out long value) + { + ulong? tmp = GetLastNumericValue(field); + value = CodedInputStream.DecodeZigZag64(tmp.GetValueOrDefault()); + return tmp != null; + } + + /// + /// Retrieves an unsigned 32-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetUInt32(int field, out uint value) + { + ulong? tmp = GetLastNumericValue(field); + value = (uint) tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves an unsigned 64-bit integer value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetUInt64(int field, out ulong value) + { + ulong? tmp = GetLastNumericValue(field); + value = tmp.GetValueOrDefault(); + return tmp != null; + } + + /// + /// Retrieves a 32-bit floating point value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetFloat(int field, out float value) + { + ulong? tmp = GetLastNumericValue(field); + int int32 = (int) tmp.GetValueOrDefault(); + byte[] bytes = BitConverter.GetBytes(int32); + value = BitConverter.ToSingle(bytes, 0); + return tmp != null; + } + + /// + /// Retrieves a 64-bit floating point value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetDouble(int field, out double value) + { + ulong? tmp = GetLastNumericValue(field); + value = BitConverter.Int64BitsToDouble((long) tmp.GetValueOrDefault()); + return tmp != null; + } + + /// + /// Retrieves a string value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetString(int field, out string value) + { + ByteString bytes = GetLastByteStringValue(field); + value = bytes?.ToStringUtf8(); + return bytes != null; + } + + /// + /// Retrieves a bytes value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetBytes(int field, out ByteString value) + { + ByteString bytes = GetLastByteStringValue(field); + value = bytes; + return bytes != null; + } + + /// + /// Retrieves a message value for the specified option field. + /// + /// The field to fetch the value for. + /// The output variable to populate. + /// true if a suitable value for the field was found; false otherwise. + public bool TryGetMessage(int field, out T value) where T : class, IMessage, new() + { + value = null; + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return false; + } + foreach (FieldValue fieldValue in values) + { + if (fieldValue.ByteString != null) + { + if (value == null) + { + value = new T(); + } + value.MergeFrom(fieldValue.ByteString); + } + } + return value != null; + } + + private ulong? GetLastNumericValue(int field) + { + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return null; + } + for (int i = values.Count - 1; i >= 0; i--) + { + // A non-bytestring value is a numeric value + if (values[i].ByteString == null) + { + return values[i].Number; + } + } + return null; + } + + private ByteString GetLastByteStringValue(int field) + { + List values; + if (!valuesByField.TryGetValue(field, out values)) + { + return null; + } + for (int i = values.Count - 1; i >= 0; i--) + { + if (values[i].ByteString != null) + { + return values[i].ByteString; + } + } + return null; + } + + /// + /// Reads an unknown field, either parsing it and storing it or skipping it. + /// + /// + /// If the current set of options is empty and we manage to read a field, a new set of options + /// will be created and returned. Otherwise, the return value is this. This allows + /// us to start with a singleton empty set of options and just create new ones where necessary. + /// + /// Input stream to read from. + /// The resulting set of custom options, either this or a new set. + internal CustomOptions ReadOrSkipUnknownField(CodedInputStream input) + { + var tag = input.LastTag; + var field = WireFormat.GetTagFieldNumber(tag); + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.LengthDelimited: + return AddValue(field, new FieldValue(input.ReadBytes())); + case WireFormat.WireType.Fixed32: + return AddValue(field, new FieldValue(input.ReadFixed32())); + case WireFormat.WireType.Fixed64: + return AddValue(field, new FieldValue(input.ReadFixed64())); + case WireFormat.WireType.Varint: + return AddValue(field, new FieldValue(input.ReadRawVarint64())); + // For StartGroup, EndGroup or any wire format we don't understand, + // just use the normal behavior (call SkipLastField). + default: + input.SkipLastField(); + return this; + } + } + + private CustomOptions AddValue(int field, FieldValue value) + { + var ret = valuesByField.Count == 0 ? new CustomOptions() : this; + List valuesForField; + if (!ret.valuesByField.TryGetValue(field, out valuesForField)) + { + // Expect almost all + valuesForField = new List(1); + ret.valuesByField[field] = valuesForField; + } + valuesForField.Add(value); + return ret; + } + + /// + /// All field values can be stored as a byte string or a 64-bit integer. + /// This struct avoids unnecessary boxing. + /// + private struct FieldValue + { + internal ulong Number { get; } + internal ByteString ByteString { get; } + + internal FieldValue(ulong number) + { + Number = number; + ByteString = null; + } + + internal FieldValue(ByteString byteString) + { + Number = 0; + ByteString = byteString; + } + } + } +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.cs index fa138dfe91..6c605f3c18 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/Descriptor.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.Reflection { /// Holder for reflection information generated from google/protobuf/descriptor.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal static partial class DescriptorReflection { #region Descriptor @@ -65,79 +64,90 @@ namespace Google.Protobuf.Reflection { "RVMQDBIPCgtUWVBFX1VJTlQzMhANEg0KCVRZUEVfRU5VTRAOEhEKDVRZUEVf", "U0ZJWEVEMzIQDxIRCg1UWVBFX1NGSVhFRDY0EBASDwoLVFlQRV9TSU5UMzIQ", "ERIPCgtUWVBFX1NJTlQ2NBASIkMKBUxhYmVsEhIKDkxBQkVMX09QVElPTkFM", - "EAESEgoOTEFCRUxfUkVRVUlSRUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIiQK", - "FE9uZW9mRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkijAEKE0VudW1E", - "ZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMoCzIp", - "Lmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SLQoH", - "b3B0aW9ucxgDIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9ucyJs", - "ChhFbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIOCgZu", - "dW1iZXIYAiABKAUSMgoHb3B0aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90b2J1", - "Zi5FbnVtVmFsdWVPcHRpb25zIpABChZTZXJ2aWNlRGVzY3JpcHRvclByb3Rv", - "EgwKBG5hbWUYASABKAkSNgoGbWV0aG9kGAIgAygLMiYuZ29vZ2xlLnByb3Rv", - "YnVmLk1ldGhvZERlc2NyaXB0b3JQcm90bxIwCgdvcHRpb25zGAMgASgLMh8u", - "Z29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zIsEBChVNZXRob2REZXNj", - "cmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIgASgJ", - "EhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5nb29n", - "bGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFtaW5n", - "GAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVmYWxz", - "ZSKHBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwKFGph", - "dmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVfZmls", - "ZXMYCiABKAg6BWZhbHNlEiwKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2FuZF9o", - "YXNoGBQgASgIOgVmYWxzZRIlChZqYXZhX3N0cmluZ19jaGVja191dGY4GBsg", + "EAESEgoOTEFCRUxfUkVRVUlSRUQQAhISCg5MQUJFTF9SRVBFQVRFRBADIlQK", + "FE9uZW9mRGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSLgoHb3B0aW9u", + "cxgCIAEoCzIdLmdvb2dsZS5wcm90b2J1Zi5PbmVvZk9wdGlvbnMijAEKE0Vu", + "dW1EZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI4CgV2YWx1ZRgCIAMo", + "CzIpLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8S", + "LQoHb3B0aW9ucxgDIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9u", + "cyJsChhFbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRIO", + "CgZudW1iZXIYAiABKAUSMgoHb3B0aW9ucxgDIAEoCzIhLmdvb2dsZS5wcm90", + "b2J1Zi5FbnVtVmFsdWVPcHRpb25zIpABChZTZXJ2aWNlRGVzY3JpcHRvclBy", + "b3RvEgwKBG5hbWUYASABKAkSNgoGbWV0aG9kGAIgAygLMiYuZ29vZ2xlLnBy", + "b3RvYnVmLk1ldGhvZERlc2NyaXB0b3JQcm90bxIwCgdvcHRpb25zGAMgASgL", + "Mh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25zIsEBChVNZXRob2RE", + "ZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRISCgppbnB1dF90eXBlGAIg", + "ASgJEhMKC291dHB1dF90eXBlGAMgASgJEi8KB29wdGlvbnMYBCABKAsyHi5n", + "b29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxIfChBjbGllbnRfc3RyZWFt", + "aW5nGAUgASgIOgVmYWxzZRIfChBzZXJ2ZXJfc3RyZWFtaW5nGAYgASgIOgVm", + "YWxzZSLwBQoLRmlsZU9wdGlvbnMSFAoMamF2YV9wYWNrYWdlGAEgASgJEhwK", + "FGphdmFfb3V0ZXJfY2xhc3NuYW1lGAggASgJEiIKE2phdmFfbXVsdGlwbGVf", + "ZmlsZXMYCiABKAg6BWZhbHNlEikKHWphdmFfZ2VuZXJhdGVfZXF1YWxzX2Fu", + "ZF9oYXNoGBQgASgIQgIYARIlChZqYXZhX3N0cmluZ19jaGVja191dGY4GBsg", "ASgIOgVmYWxzZRJGCgxvcHRpbWl6ZV9mb3IYCSABKA4yKS5nb29nbGUucHJv", "dG9idWYuRmlsZU9wdGlvbnMuT3B0aW1pemVNb2RlOgVTUEVFRBISCgpnb19w", "YWNrYWdlGAsgASgJEiIKE2NjX2dlbmVyaWNfc2VydmljZXMYECABKAg6BWZh", "bHNlEiQKFWphdmFfZ2VuZXJpY19zZXJ2aWNlcxgRIAEoCDoFZmFsc2USIgoT", - "cHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USGQoKZGVwcmVjYXRl", - "ZBgXIAEoCDoFZmFsc2USHwoQY2NfZW5hYmxlX2FyZW5hcxgfIAEoCDoFZmFs", - "c2USGQoRb2JqY19jbGFzc19wcmVmaXgYJCABKAkSGAoQY3NoYXJwX25hbWVz", - "cGFjZRglIAEoCRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5n", - "b29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiI6CgxPcHRpbWl6", - "ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJWkUQAhIQCgxMSVRFX1JVTlRJ", - "TUUQAyoJCOgHEICAgIACSgQIJhAnIuYBCg5NZXNzYWdlT3B0aW9ucxImChdt", - "ZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEoCDoFZmFsc2USLgofbm9fc3Rh", - "bmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgCIAEoCDoFZmFsc2USGQoKZGVw", - "cmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFwX2VudHJ5GAcgASgIEkMKFHVu", + "cHlfZ2VuZXJpY19zZXJ2aWNlcxgSIAEoCDoFZmFsc2USIwoUcGhwX2dlbmVy", + "aWNfc2VydmljZXMYEyABKAg6BWZhbHNlEhkKCmRlcHJlY2F0ZWQYFyABKAg6", + "BWZhbHNlEh8KEGNjX2VuYWJsZV9hcmVuYXMYHyABKAg6BWZhbHNlEhkKEW9i", + "amNfY2xhc3NfcHJlZml4GCQgASgJEhgKEGNzaGFycF9uYW1lc3BhY2UYJSAB", + "KAkSFAoMc3dpZnRfcHJlZml4GCcgASgJEhgKEHBocF9jbGFzc19wcmVmaXgY", + "KCABKAkSFQoNcGhwX25hbWVzcGFjZRgpIAEoCRJDChR1bmludGVycHJldGVk", + "X29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRl", + "ZE9wdGlvbiI6CgxPcHRpbWl6ZU1vZGUSCQoFU1BFRUQQARINCglDT0RFX1NJ", + "WkUQAhIQCgxMSVRFX1JVTlRJTUUQAyoJCOgHEICAgIACSgQIJhAnIvIBCg5N", + "ZXNzYWdlT3B0aW9ucxImChdtZXNzYWdlX3NldF93aXJlX2Zvcm1hdBgBIAEo", + "CDoFZmFsc2USLgofbm9fc3RhbmRhcmRfZGVzY3JpcHRvcl9hY2Nlc3NvchgC", + "IAEoCDoFZmFsc2USGQoKZGVwcmVjYXRlZBgDIAEoCDoFZmFsc2USEQoJbWFw", + "X2VudHJ5GAcgASgIEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk", + "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICA", + "gAJKBAgIEAlKBAgJEAoingMKDEZpZWxkT3B0aW9ucxI6CgVjdHlwZRgBIAEo", + "DjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMuQ1R5cGU6BlNUUklO", + "RxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBlGAYgASgOMiQuZ29vZ2xlLnBy", + "b3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6CUpTX05PUk1BTBITCgRsYXp5", + "GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMgASgIOgVmYWxzZRITCgR3", + "ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByAD", + "KAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbiIvCgVD", + "VHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAESEAoMU1RSSU5HX1BJRUNFEAIi", + "NQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0KCUpTX1NUUklORxABEg0KCUpT", + "X05VTUJFUhACKgkI6AcQgICAgAJKBAgEEAUiXgoMT25lb2ZPcHRpb25zEkMK", + "FHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1", + "Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIikwEKC0VudW1PcHRp", + "b25zEhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJlY2F0ZWQYAyABKAg6", + "BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2ds", + "ZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAJKBAgF", + "EAYifQoQRW51bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEgASgIOgVm", + "YWxzZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUu", + "cHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIACInsKDlNl", + "cnZpY2VPcHRpb25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNlEkMKFHVu", "aW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5V", - "bmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIimAMKDEZpZWxkT3B0aW9u", - "cxI6CgVjdHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlv", - "bnMuQ1R5cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgSPwoGanN0eXBlGAYg", - "ASgOMiQuZ29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucy5KU1R5cGU6CUpT", - "X05PUk1BTBITCgRsYXp5GAUgASgIOgVmYWxzZRIZCgpkZXByZWNhdGVkGAMg", - "ASgIOgVmYWxzZRITCgR3ZWFrGAogASgIOgVmYWxzZRJDChR1bmludGVycHJl", - "dGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnBy", - "ZXRlZE9wdGlvbiIvCgVDVHlwZRIKCgZTVFJJTkcQABIICgRDT1JEEAESEAoM", - "U1RSSU5HX1BJRUNFEAIiNQoGSlNUeXBlEg0KCUpTX05PUk1BTBAAEg0KCUpT", - "X1NUUklORxABEg0KCUpTX05VTUJFUhACKgkI6AcQgICAgAIijQEKC0VudW1P", - "cHRpb25zEhMKC2FsbG93X2FsaWFzGAIgASgIEhkKCmRlcHJlY2F0ZWQYAyAB", - "KAg6BWZhbHNlEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdv", - "b2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIi", - "fQoQRW51bVZhbHVlT3B0aW9ucxIZCgpkZXByZWNhdGVkGAEgASgIOgVmYWxz", - "ZRJDChR1bmludGVycHJldGVkX29wdGlvbhjnByADKAsyJC5nb29nbGUucHJv", - "dG9idWYuVW5pbnRlcnByZXRlZE9wdGlvbioJCOgHEICAgIACInsKDlNlcnZp", - "Y2VPcHRpb25zEhkKCmRlcHJlY2F0ZWQYISABKAg6BWZhbHNlEkMKFHVuaW50", + "bmludGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIirQIKDU1ldGhvZE9wdGlv", + "bnMSGQoKZGVwcmVjYXRlZBghIAEoCDoFZmFsc2USXwoRaWRlbXBvdGVuY3lf", + "bGV2ZWwYIiABKA4yLy5nb29nbGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucy5J", + "ZGVtcG90ZW5jeUxldmVsOhNJREVNUE9URU5DWV9VTktOT1dOEkMKFHVuaW50", "ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5Vbmlu", - "dGVycHJldGVkT3B0aW9uKgkI6AcQgICAgAIiegoNTWV0aG9kT3B0aW9ucxIZ", - "CgpkZXByZWNhdGVkGCEgASgIOgVmYWxzZRJDChR1bmludGVycHJldGVkX29w", - "dGlvbhjnByADKAsyJC5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w", - "dGlvbioJCOgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0aW9uEjsKBG5h", - "bWUYAiADKAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9wdGlv", - "bi5OYW1lUGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJEhoKEnBvc2l0", - "aXZlX2ludF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRfdmFsdWUYBSAB", - "KAMSFAoMZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192YWx1ZRgHIAEo", - "DBIXCg9hZ2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBhcnQSEQoJbmFt", - "ZV9wYXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLVAQoOU291cmNl", - "Q29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9idWYu", - "U291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBhdGgY", - "ASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29tbWVu", - "dHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVhZGlu", - "Z19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJhdGVkQ29kZUlu", - "Zm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5HZW5l", - "cmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRpb24SEAoEcGF0", - "aBgBIAMoBUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoFYmVnaW4YAyAB", - "KAUSCwoDZW5kGAQgASgFQlgKE2NvbS5nb29nbGUucHJvdG9idWZCEERlc2Ny", - "aXB0b3JQcm90b3NIAVoKZGVzY3JpcHRvcqICA0dQQqoCGkdvb2dsZS5Qcm90", - "b2J1Zi5SZWZsZWN0aW9u")); + "dGVycHJldGVkT3B0aW9uIlAKEElkZW1wb3RlbmN5TGV2ZWwSFwoTSURFTVBP", + "VEVOQ1lfVU5LTk9XThAAEhMKD05PX1NJREVfRUZGRUNUUxABEg4KCklERU1Q", + "T1RFTlQQAioJCOgHEICAgIACIp4CChNVbmludGVycHJldGVkT3B0aW9uEjsK", + "BG5hbWUYAiADKAsyLS5nb29nbGUucHJvdG9idWYuVW5pbnRlcnByZXRlZE9w", + "dGlvbi5OYW1lUGFydBIYChBpZGVudGlmaWVyX3ZhbHVlGAMgASgJEhoKEnBv", + "c2l0aXZlX2ludF92YWx1ZRgEIAEoBBIaChJuZWdhdGl2ZV9pbnRfdmFsdWUY", + "BSABKAMSFAoMZG91YmxlX3ZhbHVlGAYgASgBEhQKDHN0cmluZ192YWx1ZRgH", + "IAEoDBIXCg9hZ2dyZWdhdGVfdmFsdWUYCCABKAkaMwoITmFtZVBhcnQSEQoJ", + "bmFtZV9wYXJ0GAEgAigJEhQKDGlzX2V4dGVuc2lvbhgCIAIoCCLVAQoOU291", + "cmNlQ29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9i", + "dWYuU291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBh", + "dGgYASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29t", + "bWVudHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVh", + "ZGluZ19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKnAQoRR2VuZXJhdGVkQ29k", + "ZUluZm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5H", + "ZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGk8KCkFubm90YXRpb24SEAoE", + "cGF0aBgBIAMoBUICEAESEwoLc291cmNlX2ZpbGUYAiABKAkSDQoFYmVnaW4Y", + "AyABKAUSCwoDZW5kGAQgASgFQowBChNjb20uZ29vZ2xlLnByb3RvYnVmQhBE", + "ZXNjcmlwdG9yUHJvdG9zSAFaPmdpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVm", + "L3Byb3RvYy1nZW4tZ28vZGVzY3JpcHRvcjtkZXNjcmlwdG9yogIDR1BCqgIa", + "R29vZ2xlLlByb3RvYnVmLlJlZmxlY3Rpb24=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -146,18 +156,19 @@ namespace Google.Protobuf.Reflection { 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.OneofDescriptorProto), global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser, new[]{ "Name", "Options" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumDescriptorProto), global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser, new[]{ "Name", "Value", "Options" }, 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", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FileOptions), global::Google.Protobuf.Reflection.FileOptions.Parser, new[]{ "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "JavaStringCheckUtf8", "OptimizeFor", "GoPackage", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "PhpGenericServices", "Deprecated", "CcEnableArenas", "ObjcClassPrefix", "CsharpNamespace", "SwiftPrefix", "PhpClassPrefix", "PhpNamespace", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MessageOptions), global::Google.Protobuf.Reflection.MessageOptions.Parser, new[]{ "MessageSetWireFormat", "NoStandardDescriptorAccessor", "Deprecated", "MapEntry", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.FieldOptions), global::Google.Protobuf.Reflection.FieldOptions.Parser, new[]{ "Ctype", "Packed", "Jstype", "Lazy", "Deprecated", "Weak", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.CType), typeof(global::Google.Protobuf.Reflection.FieldOptions.Types.JSType) }, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.OneofOptions), global::Google.Protobuf.Reflection.OneofOptions.Parser, new[]{ "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumOptions), global::Google.Protobuf.Reflection.EnumOptions.Parser, new[]{ "AllowAlias", "Deprecated", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.EnumValueOptions), global::Google.Protobuf.Reflection.EnumValueOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.ServiceOptions), global::Google.Protobuf.Reflection.ServiceOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "UninterpretedOption" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.MethodOptions), global::Google.Protobuf.Reflection.MethodOptions.Parser, new[]{ "Deprecated", "IdempotencyLevel", "UninterpretedOption" }, null, new[]{ typeof(global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) }, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption), global::Google.Protobuf.Reflection.UninterpretedOption.Parser, new[]{ "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart), global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser, new[]{ "NamePart_", "IsExtension" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo), global::Google.Protobuf.Reflection.SourceCodeInfo.Parser, new[]{ "Location" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser, new[]{ "Path", "Span", "LeadingComments", "TrailingComments", "LeadingDetachedComments" }, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Parser, new[]{ "Annotation" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation), global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser, new[]{ "Path", "SourceFile", "Begin", "End" }, null, null, null)}) @@ -168,32 +179,37 @@ namespace Google.Protobuf.Reflection { } #region Messages /// - /// The protocol compiler can output a FileDescriptorSet containing the .proto - /// files it parses. + /// The protocol compiler can output a FileDescriptorSet containing the .proto + /// files it parses. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class FileDescriptorSet : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorSet()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorSet() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorSet(FileDescriptorSet other) : this() { file_ = other.file_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorSet Clone() { return new FileDescriptorSet(this); } @@ -203,14 +219,17 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_file_codec = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.FileDescriptorProto.Parser); private readonly pbc::RepeatedField file_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField File { get { return file_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FileDescriptorSet); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FileDescriptorSet other) { if (ReferenceEquals(other, null)) { return false; @@ -222,26 +241,31 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= file_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { file_.WriteTo(output, _repeated_file_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += file_.CalculateSize(_repeated_file_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FileDescriptorSet other) { if (other == null) { return; @@ -249,6 +273,7 @@ namespace Google.Protobuf.Reflection { file_.Add(other.file_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -267,27 +292,31 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a complete .proto file. + /// Describes a complete .proto file. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class FileDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorProto(FileDescriptorProto other) : this() { name_ = other.name_; package_ = other.package_; @@ -303,6 +332,7 @@ namespace Google.Protobuf.Reflection { syntax_ = other.syntax_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileDescriptorProto Clone() { return new FileDescriptorProto(this); } @@ -311,8 +341,9 @@ namespace Google.Protobuf.Reflection { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// file name, relative to root of source tree + /// file name, relative to root of source tree /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -324,8 +355,9 @@ namespace Google.Protobuf.Reflection { public const int PackageFieldNumber = 2; private string package_ = ""; /// - /// e.g. "foo", "foo.bar", etc. + /// e.g. "foo", "foo.bar", etc. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Package { get { return package_; } set { @@ -339,8 +371,9 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForString(26); private readonly pbc::RepeatedField dependency_ = new pbc::RepeatedField(); /// - /// Names of files imported by this file. + /// Names of files imported by this file. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Dependency { get { return dependency_; } } @@ -351,8 +384,9 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForInt32(80); private readonly pbc::RepeatedField publicDependency_ = new pbc::RepeatedField(); /// - /// Indexes of the public imported files in the dependency list above. + /// Indexes of the public imported files in the dependency list above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField PublicDependency { get { return publicDependency_; } } @@ -363,9 +397,10 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForInt32(88); private readonly pbc::RepeatedField weakDependency_ = new pbc::RepeatedField(); /// - /// Indexes of the weak imported files in the dependency list. - /// For Google-internal migration only. Do not use. + /// Indexes of the weak imported files in the dependency list. + /// For Google-internal migration only. Do not use. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField WeakDependency { get { return weakDependency_; } } @@ -376,8 +411,9 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.DescriptorProto.Parser); private readonly pbc::RepeatedField messageType_ = new pbc::RepeatedField(); /// - /// All top-level definitions in this file. + /// All top-level definitions in this file. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField MessageType { get { return messageType_; } } @@ -387,6 +423,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_enumType_codec = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser); private readonly pbc::RepeatedField enumType_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField EnumType { get { return enumType_; } } @@ -396,6 +433,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_service_codec = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.ServiceDescriptorProto.Parser); private readonly pbc::RepeatedField service_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Service { get { return service_; } } @@ -405,6 +443,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_extension_codec = pb::FieldCodec.ForMessage(58, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); private readonly pbc::RepeatedField extension_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Extension { get { return extension_; } } @@ -412,6 +451,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 8; private global::Google.Protobuf.Reflection.FileOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FileOptions Options { get { return options_; } set { @@ -423,11 +463,12 @@ namespace Google.Protobuf.Reflection { public const int SourceCodeInfoFieldNumber = 9; private global::Google.Protobuf.Reflection.SourceCodeInfo sourceCodeInfo_; /// - /// This field contains optional information about the original source code. - /// You may safely remove this entire field without harming runtime - /// functionality of the descriptors -- the information is needed only by - /// development tools. + /// This field contains optional information about the original source code. + /// You may safely remove this entire field without harming runtime + /// functionality of the descriptors -- the information is needed only by + /// development tools. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.SourceCodeInfo SourceCodeInfo { get { return sourceCodeInfo_; } set { @@ -439,9 +480,10 @@ namespace Google.Protobuf.Reflection { public const int SyntaxFieldNumber = 12; private string syntax_ = ""; /// - /// The syntax of the proto file. - /// The supported values are "proto2" and "proto3". + /// The syntax of the proto file. + /// The supported values are "proto2" and "proto3". /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Syntax { get { return syntax_; } set { @@ -449,10 +491,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FileDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FileDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -475,6 +519,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -492,10 +537,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -526,6 +573,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -553,6 +601,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FileDescriptorProto other) { if (other == null) { return; @@ -587,6 +636,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -657,27 +707,31 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a message type. + /// Describes a message type. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class DescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new DescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DescriptorProto(DescriptorProto other) : this() { name_ = other.name_; field_ = other.field_.Clone(); @@ -691,6 +745,7 @@ namespace Google.Protobuf.Reflection { reservedName_ = other.reservedName_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public DescriptorProto Clone() { return new DescriptorProto(this); } @@ -698,6 +753,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -710,6 +766,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_field_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); private readonly pbc::RepeatedField field_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Field { get { return field_; } } @@ -719,6 +776,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_extension_codec = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.Reflection.FieldDescriptorProto.Parser); private readonly pbc::RepeatedField extension_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Extension { get { return extension_; } } @@ -728,6 +786,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_nestedType_codec = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.Reflection.DescriptorProto.Parser); private readonly pbc::RepeatedField nestedType_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField NestedType { get { return nestedType_; } } @@ -737,6 +796,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_enumType_codec = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.Reflection.EnumDescriptorProto.Parser); private readonly pbc::RepeatedField enumType_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField EnumType { get { return enumType_; } } @@ -746,6 +806,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_extensionRange_codec = pb::FieldCodec.ForMessage(42, global::Google.Protobuf.Reflection.DescriptorProto.Types.ExtensionRange.Parser); private readonly pbc::RepeatedField extensionRange_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField ExtensionRange { get { return extensionRange_; } } @@ -755,6 +816,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_oneofDecl_codec = pb::FieldCodec.ForMessage(66, global::Google.Protobuf.Reflection.OneofDescriptorProto.Parser); private readonly pbc::RepeatedField oneofDecl_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField OneofDecl { get { return oneofDecl_; } } @@ -762,6 +824,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 7; private global::Google.Protobuf.Reflection.MessageOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.MessageOptions Options { get { return options_; } set { @@ -774,6 +837,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_reservedRange_codec = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.Reflection.DescriptorProto.Types.ReservedRange.Parser); private readonly pbc::RepeatedField reservedRange_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField ReservedRange { get { return reservedRange_; } } @@ -784,17 +848,20 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForString(82); private readonly pbc::RepeatedField reservedName_ = new pbc::RepeatedField(); /// - /// Reserved field names, which may not be used by fields in the same message. - /// A given name may only be reserved once. + /// Reserved field names, which may not be used by fields in the same message. + /// A given name may only be reserved once. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField ReservedName { get { return reservedName_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as DescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(DescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -815,6 +882,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -830,10 +898,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -853,6 +923,7 @@ namespace Google.Protobuf.Reflection { reservedName_.WriteTo(output, _repeated_reservedName_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -872,6 +943,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(DescriptorProto other) { if (other == null) { return; @@ -895,6 +967,7 @@ namespace Google.Protobuf.Reflection { reservedName_.Add(other.reservedName_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -951,32 +1024,37 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the DescriptorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class ExtensionRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExtensionRange()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ExtensionRange() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ExtensionRange(ExtensionRange other) : this() { start_ = other.start_; end_ = other.end_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ExtensionRange Clone() { return new ExtensionRange(this); } @@ -984,6 +1062,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "start" field. public const int StartFieldNumber = 1; private int start_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Start { get { return start_; } set { @@ -994,6 +1073,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "end" field. public const int EndFieldNumber = 2; private int end_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { get { return end_; } set { @@ -1001,10 +1081,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ExtensionRange); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ExtensionRange other) { if (ReferenceEquals(other, null)) { return false; @@ -1017,6 +1099,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Start != 0) hash ^= Start.GetHashCode(); @@ -1024,10 +1107,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Start != 0) { output.WriteRawTag(8); @@ -1039,6 +1124,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Start != 0) { @@ -1050,6 +1136,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ExtensionRange other) { if (other == null) { return; @@ -1062,6 +1149,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1084,34 +1172,39 @@ namespace Google.Protobuf.Reflection { } /// - /// Range of reserved tag numbers. Reserved tag numbers may not be used by - /// fields or extension ranges in the same message. Reserved ranges may - /// not overlap. + /// Range of reserved tag numbers. Reserved tag numbers may not be used by + /// fields or extension ranges in the same message. Reserved ranges may + /// not overlap. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class ReservedRange : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ReservedRange()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorProto.Descriptor.NestedTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedRange() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedRange(ReservedRange other) : this() { start_ = other.start_; end_ = other.end_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ReservedRange Clone() { return new ReservedRange(this); } @@ -1120,8 +1213,9 @@ namespace Google.Protobuf.Reflection { public const int StartFieldNumber = 1; private int start_; /// - /// Inclusive. + /// Inclusive. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Start { get { return start_; } set { @@ -1133,8 +1227,9 @@ namespace Google.Protobuf.Reflection { public const int EndFieldNumber = 2; private int end_; /// - /// Exclusive. + /// Exclusive. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { get { return end_; } set { @@ -1142,10 +1237,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ReservedRange); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ReservedRange other) { if (ReferenceEquals(other, null)) { return false; @@ -1158,6 +1255,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Start != 0) hash ^= Start.GetHashCode(); @@ -1165,10 +1263,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Start != 0) { output.WriteRawTag(8); @@ -1180,6 +1280,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Start != 0) { @@ -1191,6 +1292,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ReservedRange other) { if (other == null) { return; @@ -1203,6 +1305,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1230,27 +1333,31 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a field within a message. + /// Describes a field within a message. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class FieldDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[3]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldDescriptorProto(FieldDescriptorProto other) : this() { name_ = other.name_; number_ = other.number_; @@ -1264,6 +1371,7 @@ namespace Google.Protobuf.Reflection { Options = other.options_ != null ? other.Options.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldDescriptorProto Clone() { return new FieldDescriptorProto(this); } @@ -1271,6 +1379,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -1281,6 +1390,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "number" field. public const int NumberFieldNumber = 3; private int number_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { get { return number_; } set { @@ -1291,6 +1401,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "label" field. public const int LabelFieldNumber = 4; private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label label_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Label Label { get { return label_; } set { @@ -1302,9 +1413,10 @@ namespace Google.Protobuf.Reflection { public const int TypeFieldNumber = 5; private global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type type_ = 0; /// - /// If type_name is set, this need not be set. If both this and type_name - /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + /// If type_name is set, this need not be set. If both this and type_name + /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldDescriptorProto.Types.Type Type { get { return type_; } set { @@ -1316,12 +1428,13 @@ namespace Google.Protobuf.Reflection { public const int TypeNameFieldNumber = 6; private string typeName_ = ""; /// - /// For message and enum types, this is the name of the type. If the name - /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - /// rules are used to find the type (i.e. first the nested types within this - /// message are searched, then within the parent, on up to the root - /// namespace). + /// For message and enum types, this is the name of the type. If the name + /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + /// rules are used to find the type (i.e. first the nested types within this + /// message are searched, then within the parent, on up to the root + /// namespace). /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeName { get { return typeName_; } set { @@ -1333,9 +1446,10 @@ namespace Google.Protobuf.Reflection { public const int ExtendeeFieldNumber = 2; private string extendee_ = ""; /// - /// For extensions, this is the name of the type being extended. It is - /// resolved in the same manner as type_name. + /// For extensions, this is the name of the type being extended. It is + /// resolved in the same manner as type_name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Extendee { get { return extendee_; } set { @@ -1347,12 +1461,13 @@ namespace Google.Protobuf.Reflection { public const int DefaultValueFieldNumber = 7; private string defaultValue_ = ""; /// - /// For numeric types, contains the original text representation of the value. - /// For booleans, "true" or "false". - /// For strings, contains the default text contents (not escaped in any way). - /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. - /// TODO(kenton): Base-64 encode? + /// For numeric types, contains the original text representation of the value. + /// For booleans, "true" or "false". + /// For strings, contains the default text contents (not escaped in any way). + /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. + /// TODO(kenton): Base-64 encode? /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DefaultValue { get { return defaultValue_; } set { @@ -1364,9 +1479,10 @@ namespace Google.Protobuf.Reflection { public const int OneofIndexFieldNumber = 9; private int oneofIndex_; /// - /// If set, gives the index of a oneof in the containing type's oneof_decl - /// list. This field is a member of that oneof. + /// If set, gives the index of a oneof in the containing type's oneof_decl + /// list. This field is a member of that oneof. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OneofIndex { get { return oneofIndex_; } set { @@ -1378,11 +1494,12 @@ namespace Google.Protobuf.Reflection { public const int JsonNameFieldNumber = 10; private string jsonName_ = ""; /// - /// JSON name of this field. The value is set by protocol compiler. If the - /// user has set a "json_name" option on this field, that option's value - /// will be used. Otherwise, it's deduced from the field's name by converting - /// it to camelCase. + /// JSON name of this field. The value is set by protocol compiler. If the + /// user has set a "json_name" option on this field, that option's value + /// will be used. Otherwise, it's deduced from the field's name by converting + /// it to camelCase. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonName { get { return jsonName_; } set { @@ -1393,6 +1510,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 8; private global::Google.Protobuf.Reflection.FieldOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions Options { get { return options_; } set { @@ -1400,10 +1518,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FieldDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FieldDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -1424,6 +1544,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1439,10 +1560,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1486,6 +1609,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1521,6 +1645,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FieldDescriptorProto other) { if (other == null) { return; @@ -1560,6 +1685,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1616,24 +1742,24 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the FieldDescriptorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { internal enum Type { /// - /// 0 is reserved for errors. - /// Order is weird for historical reasons. + /// 0 is reserved for errors. + /// Order is weird for historical reasons. /// [pbr::OriginalName("TYPE_DOUBLE")] Double = 1, [pbr::OriginalName("TYPE_FLOAT")] Float = 2, /// - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - /// negative values are likely. + /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + /// negative values are likely. /// [pbr::OriginalName("TYPE_INT64")] Int64 = 3, [pbr::OriginalName("TYPE_UINT64")] Uint64 = 4, /// - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - /// negative values are likely. + /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + /// negative values are likely. /// [pbr::OriginalName("TYPE_INT32")] Int32 = 5, [pbr::OriginalName("TYPE_FIXED64")] Fixed64 = 6, @@ -1641,15 +1767,18 @@ namespace Google.Protobuf.Reflection { [pbr::OriginalName("TYPE_BOOL")] Bool = 8, [pbr::OriginalName("TYPE_STRING")] String = 9, /// - /// Tag-delimited aggregate. + /// Tag-delimited aggregate. + /// Group type is deprecated and not supported in proto3. However, Proto3 + /// implementations should still be able to parse the group wire format and + /// treat group fields as unknown fields. /// [pbr::OriginalName("TYPE_GROUP")] Group = 10, /// - /// Length-delimited aggregate. + /// Length-delimited aggregate. /// [pbr::OriginalName("TYPE_MESSAGE")] Message = 11, /// - /// New in version 2. + /// New in version 2. /// [pbr::OriginalName("TYPE_BYTES")] Bytes = 12, [pbr::OriginalName("TYPE_UINT32")] Uint32 = 13, @@ -1657,24 +1786,21 @@ namespace Google.Protobuf.Reflection { [pbr::OriginalName("TYPE_SFIXED32")] Sfixed32 = 15, [pbr::OriginalName("TYPE_SFIXED64")] Sfixed64 = 16, /// - /// Uses ZigZag encoding. + /// Uses ZigZag encoding. /// [pbr::OriginalName("TYPE_SINT32")] Sint32 = 17, /// - /// Uses ZigZag encoding. + /// Uses ZigZag encoding. /// [pbr::OriginalName("TYPE_SINT64")] Sint64 = 18, } internal enum Label { /// - /// 0 is reserved for errors + /// 0 is reserved for errors /// [pbr::OriginalName("LABEL_OPTIONAL")] Optional = 1, [pbr::OriginalName("LABEL_REQUIRED")] Required = 2, - /// - /// TODO(sanjay): Should we add LABEL_MAP? - /// [pbr::OriginalName("LABEL_REPEATED")] Repeated = 3, } @@ -1684,31 +1810,37 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a oneof. + /// Describes a oneof. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class OneofDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[4]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofDescriptorProto(OneofDescriptorProto other) : this() { name_ = other.name_; + Options = other.options_ != null ? other.Options.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofDescriptorProto Clone() { return new OneofDescriptorProto(this); } @@ -1716,6 +1848,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -1723,10 +1856,23 @@ namespace Google.Protobuf.Reflection { } } + /// Field number for the "options" field. + public const int OptionsFieldNumber = 2; + private global::Google.Protobuf.Reflection.OneofOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.Reflection.OneofOptions Options { + get { return options_; } + set { + options_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as OneofDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(OneofDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -1735,34 +1881,48 @@ namespace Google.Protobuf.Reflection { return true; } if (Name != other.Name) return false; + if (!object.Equals(Options, other.Options)) return false; return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (options_ != null) hash ^= Options.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } + if (options_ != null) { + output.WriteRawTag(18); + output.WriteMessage(Options); + } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } + if (options_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Options); + } return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(OneofDescriptorProto other) { if (other == null) { return; @@ -1770,8 +1930,15 @@ namespace Google.Protobuf.Reflection { if (other.Name.Length != 0) { Name = other.Name; } + if (other.options_ != null) { + if (options_ == null) { + options_ = new global::Google.Protobuf.Reflection.OneofOptions(); + } + Options.MergeFrom(other.Options); + } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1783,6 +1950,13 @@ namespace Google.Protobuf.Reflection { Name = input.ReadString(); break; } + case 18: { + if (options_ == null) { + options_ = new global::Google.Protobuf.Reflection.OneofOptions(); + } + input.ReadMessage(options_); + break; + } } } } @@ -1790,33 +1964,38 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes an enum type. + /// Describes an enum type. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class EnumDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[5]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumDescriptorProto(EnumDescriptorProto other) : this() { name_ = other.name_; value_ = other.value_.Clone(); Options = other.options_ != null ? other.Options.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumDescriptorProto Clone() { return new EnumDescriptorProto(this); } @@ -1824,6 +2003,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -1836,6 +2016,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_value_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.EnumValueDescriptorProto.Parser); private readonly pbc::RepeatedField value_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Value { get { return value_; } } @@ -1843,6 +2024,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 3; private global::Google.Protobuf.Reflection.EnumOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.EnumOptions Options { get { return options_; } set { @@ -1850,10 +2032,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EnumDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(EnumDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -1867,6 +2051,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1875,10 +2060,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1891,6 +2078,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1903,6 +2091,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(EnumDescriptorProto other) { if (other == null) { return; @@ -1919,6 +2108,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1948,33 +2138,38 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a value within an enum. + /// Describes a value within an enum. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class EnumValueDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[6]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueDescriptorProto(EnumValueDescriptorProto other) : this() { name_ = other.name_; number_ = other.number_; Options = other.options_ != null ? other.Options.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueDescriptorProto Clone() { return new EnumValueDescriptorProto(this); } @@ -1982,6 +2177,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -1992,6 +2188,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "number" field. public const int NumberFieldNumber = 2; private int number_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { get { return number_; } set { @@ -2002,6 +2199,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 3; private global::Google.Protobuf.Reflection.EnumValueOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.EnumValueOptions Options { get { return options_; } set { @@ -2009,10 +2207,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EnumValueDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(EnumValueDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -2026,6 +2226,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -2034,10 +2235,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2053,6 +2256,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -2067,6 +2271,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(EnumValueDescriptorProto other) { if (other == null) { return; @@ -2085,6 +2290,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2114,33 +2320,38 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a service. + /// Describes a service. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class ServiceDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[7]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceDescriptorProto(ServiceDescriptorProto other) : this() { name_ = other.name_; method_ = other.method_.Clone(); Options = other.options_ != null ? other.Options.Clone() : null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceDescriptorProto Clone() { return new ServiceDescriptorProto(this); } @@ -2148,6 +2359,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -2160,6 +2372,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_method_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.MethodDescriptorProto.Parser); private readonly pbc::RepeatedField method_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Method { get { return method_; } } @@ -2167,6 +2380,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 3; private global::Google.Protobuf.Reflection.ServiceOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.ServiceOptions Options { get { return options_; } set { @@ -2174,10 +2388,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ServiceDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ServiceDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -2191,6 +2407,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -2199,10 +2416,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2215,6 +2434,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -2227,6 +2447,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ServiceDescriptorProto other) { if (other == null) { return; @@ -2243,6 +2464,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2272,27 +2494,31 @@ namespace Google.Protobuf.Reflection { } /// - /// Describes a method of a service. + /// Describes a method of a service. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class MethodDescriptorProto : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodDescriptorProto()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[8]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodDescriptorProto() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodDescriptorProto(MethodDescriptorProto other) : this() { name_ = other.name_; inputType_ = other.inputType_; @@ -2302,6 +2528,7 @@ namespace Google.Protobuf.Reflection { serverStreaming_ = other.serverStreaming_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodDescriptorProto Clone() { return new MethodDescriptorProto(this); } @@ -2309,6 +2536,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name" field. public const int NameFieldNumber = 1; private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -2320,9 +2548,10 @@ namespace Google.Protobuf.Reflection { public const int InputTypeFieldNumber = 2; private string inputType_ = ""; /// - /// Input and output type names. These are resolved in the same way as - /// FieldDescriptorProto.type_name, but must refer to a message type. + /// Input and output type names. These are resolved in the same way as + /// FieldDescriptorProto.type_name, but must refer to a message type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string InputType { get { return inputType_; } set { @@ -2333,6 +2562,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "output_type" field. public const int OutputTypeFieldNumber = 3; private string outputType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string OutputType { get { return outputType_; } set { @@ -2343,6 +2573,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "options" field. public const int OptionsFieldNumber = 4; private global::Google.Protobuf.Reflection.MethodOptions options_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.MethodOptions Options { get { return options_; } set { @@ -2354,8 +2585,9 @@ namespace Google.Protobuf.Reflection { public const int ClientStreamingFieldNumber = 5; private bool clientStreaming_; /// - /// Identifies if client streams multiple client messages + /// Identifies if client streams multiple client messages /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ClientStreaming { get { return clientStreaming_; } set { @@ -2367,8 +2599,9 @@ namespace Google.Protobuf.Reflection { public const int ServerStreamingFieldNumber = 6; private bool serverStreaming_; /// - /// Identifies if server streams multiple server messages + /// Identifies if server streams multiple server messages /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ServerStreaming { get { return serverStreaming_; } set { @@ -2376,10 +2609,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MethodDescriptorProto); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MethodDescriptorProto other) { if (ReferenceEquals(other, null)) { return false; @@ -2396,6 +2631,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -2407,10 +2643,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -2438,6 +2676,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -2461,6 +2700,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MethodDescriptorProto other) { if (other == null) { return; @@ -2488,6 +2728,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -2528,25 +2769,31 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class FileOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FileOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[9]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileOptions(FileOptions other) : this() { javaPackage_ = other.javaPackage_; javaOuterClassname_ = other.javaOuterClassname_; @@ -2558,13 +2805,18 @@ namespace Google.Protobuf.Reflection { ccGenericServices_ = other.ccGenericServices_; javaGenericServices_ = other.javaGenericServices_; pyGenericServices_ = other.pyGenericServices_; + phpGenericServices_ = other.phpGenericServices_; deprecated_ = other.deprecated_; ccEnableArenas_ = other.ccEnableArenas_; objcClassPrefix_ = other.objcClassPrefix_; csharpNamespace_ = other.csharpNamespace_; + swiftPrefix_ = other.swiftPrefix_; + phpClassPrefix_ = other.phpClassPrefix_; + phpNamespace_ = other.phpNamespace_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FileOptions Clone() { return new FileOptions(this); } @@ -2573,11 +2825,12 @@ namespace Google.Protobuf.Reflection { public const int JavaPackageFieldNumber = 1; private string javaPackage_ = ""; /// - /// Sets the Java package where classes generated from this .proto will be - /// placed. By default, the proto package is used, but this is often - /// inappropriate because proto packages do not normally start with backwards - /// domain names. + /// Sets the Java package where classes generated from this .proto will be + /// placed. By default, the proto package is used, but this is often + /// inappropriate because proto packages do not normally start with backwards + /// domain names. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JavaPackage { get { return javaPackage_; } set { @@ -2589,12 +2842,13 @@ namespace Google.Protobuf.Reflection { public const int JavaOuterClassnameFieldNumber = 8; private string javaOuterClassname_ = ""; /// - /// If set, all the classes from the .proto file are wrapped in a single - /// outer class with the given name. This applies to both Proto1 - /// (equivalent to the old "--one_java_file" option) and Proto2 (where - /// a .proto always translates to a single class, but you may want to - /// explicitly choose the class name). + /// If set, all the classes from the .proto file are wrapped in a single + /// outer class with the given name. This applies to both Proto1 + /// (equivalent to the old "--one_java_file" option) and Proto2 (where + /// a .proto always translates to a single class, but you may want to + /// explicitly choose the class name). /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JavaOuterClassname { get { return javaOuterClassname_; } set { @@ -2606,13 +2860,14 @@ namespace Google.Protobuf.Reflection { public const int JavaMultipleFilesFieldNumber = 10; private bool javaMultipleFiles_; /// - /// If set true, then the Java code generator will generate a separate .java - /// file for each top-level message, enum, and service defined in the .proto - /// file. Thus, these types will *not* be nested inside the outer class - /// named by java_outer_classname. However, the outer class will still be - /// generated to contain the file's getDescriptor() method as well as any - /// top-level extensions defined in the file. + /// If set true, then the Java code generator will generate a separate .java + /// file for each top-level message, enum, and service defined in the .proto + /// file. Thus, these types will *not* be nested inside the outer class + /// named by java_outer_classname. However, the outer class will still be + /// generated to contain the file's getDescriptor() method as well as any + /// top-level extensions defined in the file. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaMultipleFiles { get { return javaMultipleFiles_; } set { @@ -2624,19 +2879,10 @@ namespace Google.Protobuf.Reflection { public const int JavaGenerateEqualsAndHashFieldNumber = 20; private bool javaGenerateEqualsAndHash_; /// - /// If set true, then the Java code generator will generate equals() and - /// hashCode() methods for all messages defined in the .proto file. - /// This increases generated code size, potentially substantially for large - /// protos, which may harm a memory-constrained application. - /// - In the full runtime this is a speed optimization, as the - /// AbstractMessage base class includes reflection-based implementations of - /// these methods. - /// - In the lite runtime, setting this option changes the semantics of - /// equals() and hashCode() to more closely match those of the full runtime; - /// the generated methods compute their results based on field values rather - /// than object identity. (Implementations should not assume that hashcodes - /// will be consistent across runtimes or versions of the protocol compiler.) + /// This option does nothing. /// + [global::System.ObsoleteAttribute] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaGenerateEqualsAndHash { get { return javaGenerateEqualsAndHash_; } set { @@ -2648,13 +2894,14 @@ namespace Google.Protobuf.Reflection { public const int JavaStringCheckUtf8FieldNumber = 27; private bool javaStringCheckUtf8_; /// - /// If set true, then the Java2 code generator will generate code that - /// throws an exception whenever an attempt is made to assign a non-UTF-8 - /// byte sequence to a string field. - /// Message reflection will do the same. - /// However, an extension field still accepts non-UTF-8 byte sequences. - /// This option has no effect on when used with the lite runtime. + /// If set true, then the Java2 code generator will generate code that + /// throws an exception whenever an attempt is made to assign a non-UTF-8 + /// byte sequence to a string field. + /// Message reflection will do the same. + /// However, an extension field still accepts non-UTF-8 byte sequences. + /// This option has no effect on when used with the lite runtime. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaStringCheckUtf8 { get { return javaStringCheckUtf8_; } set { @@ -2665,6 +2912,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "optimize_for" field. public const int OptimizeForFieldNumber = 9; private global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode optimizeFor_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FileOptions.Types.OptimizeMode OptimizeFor { get { return optimizeFor_; } set { @@ -2676,12 +2924,13 @@ namespace Google.Protobuf.Reflection { public const int GoPackageFieldNumber = 11; private string goPackage_ = ""; /// - /// Sets the Go package where structs generated from this .proto will be - /// placed. If omitted, the Go package will be derived from the following: - /// - The basename of the package import path, if provided. - /// - Otherwise, the package statement in the .proto file, if present. - /// - Otherwise, the basename of the .proto file, without extension. + /// Sets the Go package where structs generated from this .proto will be + /// placed. If omitted, the Go package will be derived from the following: + /// - The basename of the package import path, if provided. + /// - Otherwise, the package statement in the .proto file, if present. + /// - Otherwise, the basename of the .proto file, without extension. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string GoPackage { get { return goPackage_; } set { @@ -2693,17 +2942,18 @@ namespace Google.Protobuf.Reflection { public const int CcGenericServicesFieldNumber = 16; private bool ccGenericServices_; /// - /// Should generic services be generated in each language? "Generic" services - /// are not specific to any particular RPC system. They are generated by the - /// main code generators in each language (without additional plugins). - /// Generic services were the only kind of service generation supported by - /// early versions of google.protobuf. + /// Should generic services be generated in each language? "Generic" services + /// are not specific to any particular RPC system. They are generated by the + /// main code generators in each language (without additional plugins). + /// Generic services were the only kind of service generation supported by + /// early versions of google.protobuf. /// - /// Generic services are now considered deprecated in favor of using plugins - /// that generate code specific to your particular RPC system. Therefore, - /// these default to false. Old code which depends on generic services should - /// explicitly set them to true. + /// Generic services are now considered deprecated in favor of using plugins + /// that generate code specific to your particular RPC system. Therefore, + /// these default to false. Old code which depends on generic services should + /// explicitly set them to true. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool CcGenericServices { get { return ccGenericServices_; } set { @@ -2714,6 +2964,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "java_generic_services" field. public const int JavaGenericServicesFieldNumber = 17; private bool javaGenericServices_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool JavaGenericServices { get { return javaGenericServices_; } set { @@ -2724,6 +2975,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "py_generic_services" field. public const int PyGenericServicesFieldNumber = 18; private bool pyGenericServices_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool PyGenericServices { get { return pyGenericServices_; } set { @@ -2731,15 +2983,27 @@ namespace Google.Protobuf.Reflection { } } + /// Field number for the "php_generic_services" field. + public const int PhpGenericServicesFieldNumber = 19; + private bool phpGenericServices_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool PhpGenericServices { + get { return phpGenericServices_; } + set { + phpGenericServices_ = value; + } + } + /// Field number for the "deprecated" field. public const int DeprecatedFieldNumber = 23; private bool deprecated_; /// - /// Is this file deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for everything in the file, or it will be completely ignored; in the very - /// least, this is a formalization for deprecating files. + /// Is this file deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for everything in the file, or it will be completely ignored; in the very + /// least, this is a formalization for deprecating files. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -2751,9 +3015,10 @@ namespace Google.Protobuf.Reflection { public const int CcEnableArenasFieldNumber = 31; private bool ccEnableArenas_; /// - /// Enables the use of arenas for the proto messages in this file. This applies - /// only to generated classes for C++. + /// Enables the use of arenas for the proto messages in this file. This applies + /// only to generated classes for C++. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool CcEnableArenas { get { return ccEnableArenas_; } set { @@ -2765,9 +3030,10 @@ namespace Google.Protobuf.Reflection { public const int ObjcClassPrefixFieldNumber = 36; private string objcClassPrefix_ = ""; /// - /// Sets the objective c class prefix which is prepended to all objective c - /// generated classes from this .proto. There is no default. + /// Sets the objective c class prefix which is prepended to all objective c + /// generated classes from this .proto. There is no default. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ObjcClassPrefix { get { return objcClassPrefix_; } set { @@ -2779,8 +3045,9 @@ namespace Google.Protobuf.Reflection { public const int CsharpNamespaceFieldNumber = 37; private string csharpNamespace_ = ""; /// - /// Namespace for generated classes; defaults to the package. + /// Namespace for generated classes; defaults to the package. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string CsharpNamespace { get { return csharpNamespace_; } set { @@ -2788,22 +3055,73 @@ namespace Google.Protobuf.Reflection { } } + /// Field number for the "swift_prefix" field. + public const int SwiftPrefixFieldNumber = 39; + private string swiftPrefix_ = ""; + /// + /// By default Swift generators will take the proto package and CamelCase it + /// replacing '.' with underscore and use that to prefix the types/symbols + /// defined. When this options is provided, they will use this value instead + /// to prefix the types/symbols defined. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SwiftPrefix { + get { return swiftPrefix_; } + set { + swiftPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "php_class_prefix" field. + public const int PhpClassPrefixFieldNumber = 40; + private string phpClassPrefix_ = ""; + /// + /// Sets the php class prefix which is prepended to all php generated classes + /// from this .proto. Default is empty. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string PhpClassPrefix { + get { return phpClassPrefix_; } + set { + phpClassPrefix_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "php_namespace" field. + public const int PhpNamespaceFieldNumber = 41; + private string phpNamespace_ = ""; + /// + /// Use this option to change the namespace of php generated classes. Default + /// is empty. When this option is empty, the package name will be used for + /// determining the namespace. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string PhpNamespace { + get { return phpNamespace_; } + set { + phpNamespace_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// Field number for the "uninterpreted_option" field. public const int UninterpretedOptionFieldNumber = 999; private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FileOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FileOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -2821,14 +3139,19 @@ namespace Google.Protobuf.Reflection { if (CcGenericServices != other.CcGenericServices) return false; if (JavaGenericServices != other.JavaGenericServices) return false; if (PyGenericServices != other.PyGenericServices) return false; + if (PhpGenericServices != other.PhpGenericServices) return false; if (Deprecated != other.Deprecated) return false; if (CcEnableArenas != other.CcEnableArenas) return false; if (ObjcClassPrefix != other.ObjcClassPrefix) return false; if (CsharpNamespace != other.CsharpNamespace) return false; + if (SwiftPrefix != other.SwiftPrefix) return false; + if (PhpClassPrefix != other.PhpClassPrefix) return false; + if (PhpNamespace != other.PhpNamespace) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (JavaPackage.Length != 0) hash ^= JavaPackage.GetHashCode(); @@ -2841,18 +3164,24 @@ namespace Google.Protobuf.Reflection { if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode(); if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode(); if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode(); + if (PhpGenericServices != false) hash ^= PhpGenericServices.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode(); if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode(); if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode(); + if (SwiftPrefix.Length != 0) hash ^= SwiftPrefix.GetHashCode(); + if (PhpClassPrefix.Length != 0) hash ^= PhpClassPrefix.GetHashCode(); + if (PhpNamespace.Length != 0) hash ^= PhpNamespace.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (JavaPackage.Length != 0) { output.WriteRawTag(10); @@ -2886,6 +3215,10 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(144, 1); output.WriteBool(PyGenericServices); } + if (PhpGenericServices != false) { + output.WriteRawTag(152, 1); + output.WriteBool(PhpGenericServices); + } if (JavaGenerateEqualsAndHash != false) { output.WriteRawTag(160, 1); output.WriteBool(JavaGenerateEqualsAndHash); @@ -2910,9 +3243,22 @@ namespace Google.Protobuf.Reflection { output.WriteRawTag(170, 2); output.WriteString(CsharpNamespace); } + if (SwiftPrefix.Length != 0) { + output.WriteRawTag(186, 2); + output.WriteString(SwiftPrefix); + } + if (PhpClassPrefix.Length != 0) { + output.WriteRawTag(194, 2); + output.WriteString(PhpClassPrefix); + } + if (PhpNamespace.Length != 0) { + output.WriteRawTag(202, 2); + output.WriteString(PhpNamespace); + } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (JavaPackage.Length != 0) { @@ -2945,6 +3291,9 @@ namespace Google.Protobuf.Reflection { if (PyGenericServices != false) { size += 2 + 1; } + if (PhpGenericServices != false) { + size += 2 + 1; + } if (Deprecated != false) { size += 2 + 1; } @@ -2957,10 +3306,20 @@ namespace Google.Protobuf.Reflection { if (CsharpNamespace.Length != 0) { size += 2 + pb::CodedOutputStream.ComputeStringSize(CsharpNamespace); } + if (SwiftPrefix.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(SwiftPrefix); + } + if (PhpClassPrefix.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpClassPrefix); + } + if (PhpNamespace.Length != 0) { + size += 2 + pb::CodedOutputStream.ComputeStringSize(PhpNamespace); + } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FileOptions other) { if (other == null) { return; @@ -2995,6 +3354,9 @@ namespace Google.Protobuf.Reflection { if (other.PyGenericServices != false) { PyGenericServices = other.PyGenericServices; } + if (other.PhpGenericServices != false) { + PhpGenericServices = other.PhpGenericServices; + } if (other.Deprecated != false) { Deprecated = other.Deprecated; } @@ -3007,15 +3369,25 @@ namespace Google.Protobuf.Reflection { if (other.CsharpNamespace.Length != 0) { CsharpNamespace = other.CsharpNamespace; } + if (other.SwiftPrefix.Length != 0) { + SwiftPrefix = other.SwiftPrefix; + } + if (other.PhpClassPrefix.Length != 0) { + PhpClassPrefix = other.PhpClassPrefix; + } + if (other.PhpNamespace.Length != 0) { + PhpNamespace = other.PhpNamespace; + } uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 10: { JavaPackage = input.ReadString(); @@ -3049,6 +3421,10 @@ namespace Google.Protobuf.Reflection { PyGenericServices = input.ReadBool(); break; } + case 152: { + PhpGenericServices = input.ReadBool(); + break; + } case 160: { JavaGenerateEqualsAndHash = input.ReadBool(); break; @@ -3073,6 +3449,18 @@ namespace Google.Protobuf.Reflection { CsharpNamespace = input.ReadString(); break; } + case 314: { + SwiftPrefix = input.ReadString(); + break; + } + case 322: { + PhpClassPrefix = input.ReadString(); + break; + } + case 330: { + PhpNamespace = input.ReadString(); + break; + } case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); break; @@ -3083,22 +3471,22 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the FileOptions message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// Generated classes can be optimized for speed or code size. + /// Generated classes can be optimized for speed or code size. /// internal enum OptimizeMode { /// - /// Generate complete code for parsing, serialization, + /// Generate complete code for parsing, serialization, /// [pbr::OriginalName("SPEED")] Speed = 1, /// - /// etc. + /// etc. /// [pbr::OriginalName("CODE_SIZE")] CodeSize = 2, /// - /// Generate code using MessageLite and the lite runtime. + /// Generate code using MessageLite and the lite runtime. /// [pbr::OriginalName("LITE_RUNTIME")] LiteRuntime = 3, } @@ -3108,25 +3496,31 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class MessageOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MessageOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[10]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageOptions(MessageOptions other) : this() { messageSetWireFormat_ = other.messageSetWireFormat_; noStandardDescriptorAccessor_ = other.noStandardDescriptorAccessor_; @@ -3135,6 +3529,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MessageOptions Clone() { return new MessageOptions(this); } @@ -3143,25 +3538,26 @@ namespace Google.Protobuf.Reflection { public const int MessageSetWireFormatFieldNumber = 1; private bool messageSetWireFormat_; /// - /// Set true to use the old proto1 MessageSet wire format for extensions. - /// This is provided for backwards-compatibility with the MessageSet wire - /// format. You should not use this for any other reason: It's less - /// efficient, has fewer features, and is more complicated. + /// Set true to use the old proto1 MessageSet wire format for extensions. + /// This is provided for backwards-compatibility with the MessageSet wire + /// format. You should not use this for any other reason: It's less + /// efficient, has fewer features, and is more complicated. /// - /// The message must be defined exactly as follows: - /// message Foo { - /// option message_set_wire_format = true; - /// extensions 4 to max; - /// } - /// Note that the message cannot have any defined fields; MessageSets only - /// have extensions. + /// The message must be defined exactly as follows: + /// message Foo { + /// option message_set_wire_format = true; + /// extensions 4 to max; + /// } + /// Note that the message cannot have any defined fields; MessageSets only + /// have extensions. /// - /// All extensions of your type must be singular messages; e.g. they cannot - /// be int32s, enums, or repeated messages. + /// All extensions of your type must be singular messages; e.g. they cannot + /// be int32s, enums, or repeated messages. /// - /// Because this is an option, the above two restrictions are not enforced by - /// the protocol compiler. + /// Because this is an option, the above two restrictions are not enforced by + /// the protocol compiler. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool MessageSetWireFormat { get { return messageSetWireFormat_; } set { @@ -3173,10 +3569,11 @@ namespace Google.Protobuf.Reflection { public const int NoStandardDescriptorAccessorFieldNumber = 2; private bool noStandardDescriptorAccessor_; /// - /// Disables the generation of the standard "descriptor()" accessor, which can - /// conflict with a field of the same name. This is meant to make migration - /// from proto1 easier; new code should avoid fields named "descriptor". + /// Disables the generation of the standard "descriptor()" accessor, which can + /// conflict with a field of the same name. This is meant to make migration + /// from proto1 easier; new code should avoid fields named "descriptor". /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool NoStandardDescriptorAccessor { get { return noStandardDescriptorAccessor_; } set { @@ -3188,11 +3585,12 @@ namespace Google.Protobuf.Reflection { public const int DeprecatedFieldNumber = 3; private bool deprecated_; /// - /// Is this message deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the message, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating messages. + /// Is this message deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the message, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating messages. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -3204,28 +3602,29 @@ namespace Google.Protobuf.Reflection { public const int MapEntryFieldNumber = 7; private bool mapEntry_; /// - /// Whether the message is an automatically generated map entry type for the - /// maps field. + /// Whether the message is an automatically generated map entry type for the + /// maps field. /// - /// For maps fields: - /// map<KeyType, ValueType> map_field = 1; - /// The parsed descriptor looks like: - /// message MapFieldEntry { - /// option map_entry = true; - /// optional KeyType key = 1; - /// optional ValueType value = 2; - /// } - /// repeated MapFieldEntry map_field = 1; + /// For maps fields: + /// map<KeyType, ValueType> map_field = 1; + /// The parsed descriptor looks like: + /// message MapFieldEntry { + /// option map_entry = true; + /// optional KeyType key = 1; + /// optional ValueType value = 2; + /// } + /// repeated MapFieldEntry map_field = 1; /// - /// Implementations may choose not to generate the map_entry=true message, but - /// use a native map in the target language to hold the keys and values. - /// The reflection APIs in such implementions still need to work as - /// if the field is a repeated message field. + /// Implementations may choose not to generate the map_entry=true message, but + /// use a native map in the target language to hold the keys and values. + /// The reflection APIs in such implementions still need to work as + /// if the field is a repeated message field. /// - /// NOTE: Do not set the option in .proto files. Always use the maps syntax - /// instead. The option should only be implicitly set by the proto compiler - /// parser. + /// NOTE: Do not set the option in .proto files. Always use the maps syntax + /// instead. The option should only be implicitly set by the proto compiler + /// parser. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool MapEntry { get { return mapEntry_; } set { @@ -3239,16 +3638,19 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MessageOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MessageOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -3264,6 +3666,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (MessageSetWireFormat != false) hash ^= MessageSetWireFormat.GetHashCode(); @@ -3274,10 +3677,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (MessageSetWireFormat != false) { output.WriteRawTag(8); @@ -3298,6 +3703,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (MessageSetWireFormat != false) { @@ -3316,6 +3722,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MessageOptions other) { if (other == null) { return; @@ -3335,12 +3742,13 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { MessageSetWireFormat = input.ReadBool(); @@ -3368,25 +3776,31 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class FieldOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[11]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldOptions(FieldOptions other) : this() { ctype_ = other.ctype_; packed_ = other.packed_; @@ -3397,6 +3811,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldOptions Clone() { return new FieldOptions(this); } @@ -3405,11 +3820,12 @@ namespace Google.Protobuf.Reflection { public const int CtypeFieldNumber = 1; private global::Google.Protobuf.Reflection.FieldOptions.Types.CType ctype_ = 0; /// - /// The ctype option instructs the C++ code generator to use a different - /// representation of the field than it normally would. See the specific - /// options below. This option is not yet implemented in the open source - /// release -- sorry, we'll try to include it in a future version! + /// The ctype option instructs the C++ code generator to use a different + /// representation of the field than it normally would. See the specific + /// options below. This option is not yet implemented in the open source + /// release -- sorry, we'll try to include it in a future version! /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions.Types.CType Ctype { get { return ctype_; } set { @@ -3421,12 +3837,13 @@ namespace Google.Protobuf.Reflection { public const int PackedFieldNumber = 2; private bool packed_; /// - /// The packed option can be enabled for repeated primitive fields to enable - /// a more efficient representation on the wire. Rather than repeatedly - /// writing the tag and type for each element, the entire array is encoded as - /// a single length-delimited blob. In proto3, only explicit setting it to - /// false will avoid using packed encoding. + /// The packed option can be enabled for repeated primitive fields to enable + /// a more efficient representation on the wire. Rather than repeatedly + /// writing the tag and type for each element, the entire array is encoded as + /// a single length-delimited blob. In proto3, only explicit setting it to + /// false will avoid using packed encoding. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Packed { get { return packed_; } set { @@ -3438,16 +3855,17 @@ namespace Google.Protobuf.Reflection { public const int JstypeFieldNumber = 6; private global::Google.Protobuf.Reflection.FieldOptions.Types.JSType jstype_ = 0; /// - /// The jstype option determines the JavaScript type used for values of the - /// field. The option is permitted only for 64 bit integral and fixed types - /// (int64, uint64, sint64, fixed64, sfixed64). By default these types are - /// represented as JavaScript strings. This avoids loss of precision that can - /// happen when a large value is converted to a floating point JavaScript - /// numbers. Specifying JS_NUMBER for the jstype causes the generated - /// JavaScript code to use the JavaScript "number" type instead of strings. - /// This option is an enum to permit additional types to be added, - /// e.g. goog.math.Integer. + /// The jstype option determines the JavaScript type used for values of the + /// field. The option is permitted only for 64 bit integral and fixed types + /// (int64, uint64, sint64, fixed64, sfixed64). By default these types are + /// represented as JavaScript strings. This avoids loss of precision that can + /// happen when a large value is converted to a floating point JavaScript + /// numbers. Specifying JS_NUMBER for the jstype causes the generated + /// JavaScript code to use the JavaScript "number" type instead of strings. + /// This option is an enum to permit additional types to be added, + /// e.g. goog.math.Integer. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.Reflection.FieldOptions.Types.JSType Jstype { get { return jstype_; } set { @@ -3459,34 +3877,35 @@ namespace Google.Protobuf.Reflection { public const int LazyFieldNumber = 5; private bool lazy_; /// - /// Should this field be parsed lazily? Lazy applies only to message-type - /// fields. It means that when the outer message is initially parsed, the - /// inner message's contents will not be parsed but instead stored in encoded - /// form. The inner message will actually be parsed when it is first accessed. + /// Should this field be parsed lazily? Lazy applies only to message-type + /// fields. It means that when the outer message is initially parsed, the + /// inner message's contents will not be parsed but instead stored in encoded + /// form. The inner message will actually be parsed when it is first accessed. /// - /// This is only a hint. Implementations are free to choose whether to use - /// eager or lazy parsing regardless of the value of this option. However, - /// setting this option true suggests that the protocol author believes that - /// using lazy parsing on this field is worth the additional bookkeeping - /// overhead typically needed to implement it. + /// This is only a hint. Implementations are free to choose whether to use + /// eager or lazy parsing regardless of the value of this option. However, + /// setting this option true suggests that the protocol author believes that + /// using lazy parsing on this field is worth the additional bookkeeping + /// overhead typically needed to implement it. /// - /// This option does not affect the public interface of any generated code; - /// all method signatures remain the same. Furthermore, thread-safety of the - /// interface is not affected by this option; const methods remain safe to - /// call from multiple threads concurrently, while non-const methods continue - /// to require exclusive access. + /// This option does not affect the public interface of any generated code; + /// all method signatures remain the same. Furthermore, thread-safety of the + /// interface is not affected by this option; const methods remain safe to + /// call from multiple threads concurrently, while non-const methods continue + /// to require exclusive access. /// - /// Note that implementations may choose not to check required fields within - /// a lazy sub-message. That is, calling IsInitialized() on the outher message - /// may return true even if the inner message has missing required fields. - /// This is necessary because otherwise the inner message would have to be - /// parsed in order to perform the check, defeating the purpose of lazy - /// parsing. An implementation which chooses not to check required fields - /// must be consistent about it. That is, for any particular sub-message, the - /// implementation must either *always* check its required fields, or *never* - /// check its required fields, regardless of whether or not the message has - /// been parsed. + /// Note that implementations may choose not to check required fields within + /// a lazy sub-message. That is, calling IsInitialized() on the outer message + /// may return true even if the inner message has missing required fields. + /// This is necessary because otherwise the inner message would have to be + /// parsed in order to perform the check, defeating the purpose of lazy + /// parsing. An implementation which chooses not to check required fields + /// must be consistent about it. That is, for any particular sub-message, the + /// implementation must either *always* check its required fields, or *never* + /// check its required fields, regardless of whether or not the message has + /// been parsed. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Lazy { get { return lazy_; } set { @@ -3498,11 +3917,12 @@ namespace Google.Protobuf.Reflection { public const int DeprecatedFieldNumber = 3; private bool deprecated_; /// - /// Is this field deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for accessors, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating fields. + /// Is this field deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for accessors, or it will be completely ignored; in the very least, this + /// is a formalization for deprecating fields. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -3514,8 +3934,9 @@ namespace Google.Protobuf.Reflection { public const int WeakFieldNumber = 10; private bool weak_; /// - /// For Google-internal migration only. Do not use. + /// For Google-internal migration only. Do not use. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Weak { get { return weak_; } set { @@ -3529,16 +3950,19 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FieldOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FieldOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -3556,6 +3980,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Ctype != 0) hash ^= Ctype.GetHashCode(); @@ -3568,10 +3993,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Ctype != 0) { output.WriteRawTag(8); @@ -3600,6 +4027,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Ctype != 0) { @@ -3624,6 +4052,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FieldOptions other) { if (other == null) { return; @@ -3649,12 +4078,13 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { ctype_ = (global::Google.Protobuf.Reflection.FieldOptions.Types.CType) input.ReadEnum(); @@ -3690,11 +4120,11 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the FieldOptions message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { internal enum CType { /// - /// Default mode. + /// Default mode. /// [pbr::OriginalName("STRING")] String = 0, [pbr::OriginalName("CORD")] Cord = 1, @@ -3703,15 +4133,15 @@ namespace Google.Protobuf.Reflection { internal enum JSType { /// - /// Use the default type. + /// Use the default type. /// [pbr::OriginalName("JS_NORMAL")] JsNormal = 0, /// - /// Use JavaScript strings. + /// Use JavaScript strings. /// [pbr::OriginalName("JS_STRING")] JsString = 1, /// - /// Use JavaScript numbers. + /// Use JavaScript numbers. /// [pbr::OriginalName("JS_NUMBER")] JsNumber = 2, } @@ -3721,31 +4151,152 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - internal sealed partial class EnumOptions : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumOptions()); - public static pb::MessageParser Parser { get { return _parser; } } + internal sealed partial class OneofOptions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OneofOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[12]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OneofOptions() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OneofOptions(OneofOptions other) : this() { + uninterpretedOption_ = other.uninterpretedOption_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public OneofOptions Clone() { + return new OneofOptions(this); + } + + /// Field number for the "uninterpreted_option" field. + public const int UninterpretedOptionFieldNumber = 999; + private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec + = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); + private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); + /// + /// The parser stores options it doesn't recognize here. See above. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField UninterpretedOption { + get { return uninterpretedOption_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as OneofOptions); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(OneofOptions other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= uninterpretedOption_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(OneofOptions other) { + if (other == null) { + return; + } + uninterpretedOption_.Add(other.uninterpretedOption_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); + break; + case 7994: { + uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); + break; + } + } + } + } + + } + + internal sealed partial class EnumOptions : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumOptions(EnumOptions other) : this() { allowAlias_ = other.allowAlias_; deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumOptions Clone() { return new EnumOptions(this); } @@ -3754,9 +4305,10 @@ namespace Google.Protobuf.Reflection { public const int AllowAliasFieldNumber = 2; private bool allowAlias_; /// - /// Set this option to true to allow mapping different tag names to the same - /// value. + /// Set this option to true to allow mapping different tag names to the same + /// value. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool AllowAlias { get { return allowAlias_; } set { @@ -3768,11 +4320,12 @@ namespace Google.Protobuf.Reflection { public const int DeprecatedFieldNumber = 3; private bool deprecated_; /// - /// Is this enum deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating enums. + /// Is this enum deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the enum, or it will be completely ignored; in the very least, this + /// is a formalization for deprecating enums. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -3786,16 +4339,19 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EnumOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(EnumOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -3809,6 +4365,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (AllowAlias != false) hash ^= AllowAlias.GetHashCode(); @@ -3817,10 +4374,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (AllowAlias != false) { output.WriteRawTag(16); @@ -3833,6 +4392,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (AllowAlias != false) { @@ -3845,6 +4405,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(EnumOptions other) { if (other == null) { return; @@ -3858,12 +4419,13 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 16: { AllowAlias = input.ReadBool(); @@ -3883,30 +4445,37 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class EnumValueOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValueOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[13]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueOptions(EnumValueOptions other) : this() { deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValueOptions Clone() { return new EnumValueOptions(this); } @@ -3915,11 +4484,12 @@ namespace Google.Protobuf.Reflection { public const int DeprecatedFieldNumber = 1; private bool deprecated_; /// - /// Is this enum value deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum value, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating enum values. + /// Is this enum value deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the enum value, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating enum values. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -3933,16 +4503,19 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EnumValueOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(EnumValueOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -3955,6 +4528,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); @@ -3962,10 +4536,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Deprecated != false) { output.WriteRawTag(8); @@ -3974,6 +4550,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Deprecated != false) { @@ -3983,6 +4560,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(EnumValueOptions other) { if (other == null) { return; @@ -3993,12 +4571,13 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 8: { Deprecated = input.ReadBool(); @@ -4014,30 +4593,37 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class ServiceOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ServiceOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[14]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceOptions(ServiceOptions other) : this() { deprecated_ = other.deprecated_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ServiceOptions Clone() { return new ServiceOptions(this); } @@ -4046,11 +4632,12 @@ namespace Google.Protobuf.Reflection { public const int DeprecatedFieldNumber = 33; private bool deprecated_; /// - /// Is this service deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the service, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating services. + /// Is this service deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the service, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating services. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -4064,16 +4651,19 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ServiceOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ServiceOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -4086,6 +4676,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); @@ -4093,10 +4684,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Deprecated != false) { output.WriteRawTag(136, 2); @@ -4105,6 +4698,7 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Deprecated != false) { @@ -4114,6 +4708,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ServiceOptions other) { if (other == null) { return; @@ -4124,12 +4719,13 @@ namespace Google.Protobuf.Reflection { uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 264: { Deprecated = input.ReadBool(); @@ -4145,30 +4741,38 @@ namespace Google.Protobuf.Reflection { } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class MethodOptions : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MethodOptions()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[15]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + internal CustomOptions CustomOptions{ get; private set; } = CustomOptions.Empty; + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodOptions() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodOptions(MethodOptions other) : this() { deprecated_ = other.deprecated_; + idempotencyLevel_ = other.idempotencyLevel_; uninterpretedOption_ = other.uninterpretedOption_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public MethodOptions Clone() { return new MethodOptions(this); } @@ -4177,11 +4781,12 @@ namespace Google.Protobuf.Reflection { public const int DeprecatedFieldNumber = 33; private bool deprecated_; /// - /// Is this method deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the method, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating methods. + /// Is this method deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the method, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating methods. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deprecated { get { return deprecated_; } set { @@ -4189,22 +4794,36 @@ namespace Google.Protobuf.Reflection { } } + /// Field number for the "idempotency_level" field. + public const int IdempotencyLevelFieldNumber = 34; + private global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel idempotencyLevel_ = 0; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel IdempotencyLevel { + get { return idempotencyLevel_; } + set { + idempotencyLevel_ = value; + } + } + /// Field number for the "uninterpreted_option" field. public const int UninterpretedOptionFieldNumber = 999; private static readonly pb::FieldCodec _repeated_uninterpretedOption_codec = pb::FieldCodec.ForMessage(7994, global::Google.Protobuf.Reflection.UninterpretedOption.Parser); private readonly pbc::RepeatedField uninterpretedOption_ = new pbc::RepeatedField(); /// - /// The parser stores options it doesn't recognize here. See above. + /// The parser stores options it doesn't recognize here. See above. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField UninterpretedOption { get { return uninterpretedOption_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as MethodOptions); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(MethodOptions other) { if (ReferenceEquals(other, null)) { return false; @@ -4213,38 +4832,52 @@ namespace Google.Protobuf.Reflection { return true; } if (Deprecated != other.Deprecated) return false; + if (IdempotencyLevel != other.IdempotencyLevel) return false; if(!uninterpretedOption_.Equals(other.uninterpretedOption_)) return false; return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Deprecated != false) hash ^= Deprecated.GetHashCode(); + if (IdempotencyLevel != 0) hash ^= IdempotencyLevel.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Deprecated != false) { output.WriteRawTag(136, 2); output.WriteBool(Deprecated); } + if (IdempotencyLevel != 0) { + output.WriteRawTag(144, 2); + output.WriteEnum((int) IdempotencyLevel); + } uninterpretedOption_.WriteTo(output, _repeated_uninterpretedOption_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Deprecated != false) { size += 2 + 1; } + if (IdempotencyLevel != 0) { + size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) IdempotencyLevel); + } size += uninterpretedOption_.CalculateSize(_repeated_uninterpretedOption_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(MethodOptions other) { if (other == null) { return; @@ -4252,20 +4885,28 @@ namespace Google.Protobuf.Reflection { if (other.Deprecated != false) { Deprecated = other.Deprecated; } + if (other.IdempotencyLevel != 0) { + IdempotencyLevel = other.IdempotencyLevel; + } uninterpretedOption_.Add(other.uninterpretedOption_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: - input.SkipLastField(); + CustomOptions = CustomOptions.ReadOrSkipUnknownField(input); break; case 264: { Deprecated = input.ReadBool(); break; } + case 272: { + idempotencyLevel_ = (global::Google.Protobuf.Reflection.MethodOptions.Types.IdempotencyLevel) input.ReadEnum(); + break; + } case 7994: { uninterpretedOption_.AddEntriesFrom(input, _repeated_uninterpretedOption_codec); break; @@ -4274,35 +4915,63 @@ namespace Google.Protobuf.Reflection { } } + #region Nested types + /// Container for nested types declared in the MethodOptions message type. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static partial class Types { + /// + /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + /// or neither? HTTP based RPC implementation may choose GET verb for safe + /// methods, and PUT verb for idempotent methods instead of the default POST. + /// + internal enum IdempotencyLevel { + [pbr::OriginalName("IDEMPOTENCY_UNKNOWN")] IdempotencyUnknown = 0, + /// + /// implies idempotent + /// + [pbr::OriginalName("NO_SIDE_EFFECTS")] NoSideEffects = 1, + /// + /// idempotent, but may have side effects + /// + [pbr::OriginalName("IDEMPOTENT")] Idempotent = 2, + } + + } + #endregion + } /// - /// A message representing a option the parser does not recognize. This only - /// appears in options protos created by the compiler::Parser class. - /// DescriptorPool resolves these when building Descriptor objects. Therefore, - /// options protos in descriptor objects (e.g. returned by Descriptor::options(), - /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions - /// in them. + /// A message representing a option the parser does not recognize. This only + /// appears in options protos created by the compiler::Parser class. + /// DescriptorPool resolves these when building Descriptor objects. Therefore, + /// options protos in descriptor objects (e.g. returned by Descriptor::options(), + /// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + /// in them. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class UninterpretedOption : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new UninterpretedOption()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[16]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public UninterpretedOption() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public UninterpretedOption(UninterpretedOption other) : this() { name_ = other.name_.Clone(); identifierValue_ = other.identifierValue_; @@ -4313,6 +4982,7 @@ namespace Google.Protobuf.Reflection { aggregateValue_ = other.aggregateValue_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public UninterpretedOption Clone() { return new UninterpretedOption(this); } @@ -4322,6 +4992,7 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_name_codec = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.Reflection.UninterpretedOption.Types.NamePart.Parser); private readonly pbc::RepeatedField name_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Name { get { return name_; } } @@ -4330,9 +5001,10 @@ namespace Google.Protobuf.Reflection { public const int IdentifierValueFieldNumber = 3; private string identifierValue_ = ""; /// - /// The value of the uninterpreted option, in whatever type the tokenizer - /// identified it as during parsing. Exactly one of these should be set. + /// The value of the uninterpreted option, in whatever type the tokenizer + /// identified it as during parsing. Exactly one of these should be set. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string IdentifierValue { get { return identifierValue_; } set { @@ -4343,6 +5015,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "positive_int_value" field. public const int PositiveIntValueFieldNumber = 4; private ulong positiveIntValue_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong PositiveIntValue { get { return positiveIntValue_; } set { @@ -4353,6 +5026,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "negative_int_value" field. public const int NegativeIntValueFieldNumber = 5; private long negativeIntValue_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long NegativeIntValue { get { return negativeIntValue_; } set { @@ -4363,6 +5037,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "double_value" field. public const int DoubleValueFieldNumber = 6; private double doubleValue_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double DoubleValue { get { return doubleValue_; } set { @@ -4373,6 +5048,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "string_value" field. public const int StringValueFieldNumber = 7; private pb::ByteString stringValue_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString StringValue { get { return stringValue_; } set { @@ -4383,6 +5059,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "aggregate_value" field. public const int AggregateValueFieldNumber = 8; private string aggregateValue_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AggregateValue { get { return aggregateValue_; } set { @@ -4390,10 +5067,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as UninterpretedOption); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(UninterpretedOption other) { if (ReferenceEquals(other, null)) { return false; @@ -4411,6 +5090,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= name_.GetHashCode(); @@ -4423,10 +5103,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { name_.WriteTo(output, _repeated_name_codec); if (IdentifierValue.Length != 0) { @@ -4455,6 +5137,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += name_.CalculateSize(_repeated_name_codec); @@ -4479,6 +5162,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(UninterpretedOption other) { if (other == null) { return; @@ -4504,6 +5188,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4545,39 +5230,44 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the UninterpretedOption message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// The name of the uninterpreted option. Each string represents a segment in - /// a dot-separated name. is_extension is true iff a segment represents an - /// extension (denoted with parentheses in options specs in .proto files). - /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents - /// "foo.(bar.baz).qux". + /// The name of the uninterpreted option. Each string represents a segment in + /// a dot-separated name. is_extension is true iff a segment represents an + /// extension (denoted with parentheses in options specs in .proto files). + /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + /// "foo.(bar.baz).qux". /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class NamePart : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NamePart()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.UninterpretedOption.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NamePart() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NamePart(NamePart other) : this() { namePart_ = other.namePart_; isExtension_ = other.isExtension_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public NamePart Clone() { return new NamePart(this); } @@ -4585,6 +5275,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "name_part" field. public const int NamePart_FieldNumber = 1; private string namePart_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string NamePart_ { get { return namePart_; } set { @@ -4595,6 +5286,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "is_extension" field. public const int IsExtensionFieldNumber = 2; private bool isExtension_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool IsExtension { get { return isExtension_; } set { @@ -4602,10 +5294,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as NamePart); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(NamePart other) { if (ReferenceEquals(other, null)) { return false; @@ -4618,6 +5312,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode(); @@ -4625,10 +5320,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (NamePart_.Length != 0) { output.WriteRawTag(10); @@ -4640,6 +5337,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (NamePart_.Length != 0) { @@ -4651,6 +5349,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(NamePart other) { if (other == null) { return; @@ -4663,6 +5362,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4690,32 +5390,37 @@ namespace Google.Protobuf.Reflection { } /// - /// Encapsulates information about the original source file from which a - /// FileDescriptorProto was generated. + /// Encapsulates information about the original source file from which a + /// FileDescriptorProto was generated. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class SourceCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceCodeInfo()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[17]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceCodeInfo() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceCodeInfo(SourceCodeInfo other) : this() { location_ = other.location_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceCodeInfo Clone() { return new SourceCodeInfo(this); } @@ -4726,58 +5431,61 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.SourceCodeInfo.Types.Location.Parser); private readonly pbc::RepeatedField location_ = new pbc::RepeatedField(); /// - /// A Location identifies a piece of source code in a .proto file which - /// corresponds to a particular definition. This information is intended - /// to be useful to IDEs, code indexers, documentation generators, and similar - /// tools. + /// A Location identifies a piece of source code in a .proto file which + /// corresponds to a particular definition. This information is intended + /// to be useful to IDEs, code indexers, documentation generators, and similar + /// tools. /// - /// For example, say we have a file like: - /// message Foo { - /// optional string foo = 1; - /// } - /// Let's look at just the field definition: - /// optional string foo = 1; - /// ^ ^^ ^^ ^ ^^^ - /// a bc de f ghi - /// We have the following locations: - /// span path represents - /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. - /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + /// For example, say we have a file like: + /// message Foo { + /// optional string foo = 1; + /// } + /// Let's look at just the field definition: + /// optional string foo = 1; + /// ^ ^^ ^^ ^ ^^^ + /// a bc de f ghi + /// We have the following locations: + /// span path represents + /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. + /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). /// - /// Notes: - /// - A location may refer to a repeated field itself (i.e. not to any - /// particular index within it). This is used whenever a set of elements are - /// logically enclosed in a single code segment. For example, an entire - /// extend block (possibly containing multiple extension definitions) will - /// have an outer location whose path refers to the "extensions" repeated - /// field without an index. - /// - Multiple locations may have the same path. This happens when a single - /// logical declaration is spread out across multiple places. The most - /// obvious example is the "extend" block again -- there may be multiple - /// extend blocks in the same scope, each of which will have the same path. - /// - A location's span is not always a subset of its parent's span. For - /// example, the "extendee" of an extension declaration appears at the - /// beginning of the "extend" block and is shared by all extensions within - /// the block. - /// - Just because a location's span is a subset of some other location's span - /// does not mean that it is a descendent. For example, a "group" defines - /// both a type and a field in a single declaration. Thus, the locations - /// corresponding to the type and field and their components will overlap. - /// - Code which tries to interpret locations should probably be designed to - /// ignore those that it doesn't understand, as more types of locations could - /// be recorded in the future. + /// Notes: + /// - A location may refer to a repeated field itself (i.e. not to any + /// particular index within it). This is used whenever a set of elements are + /// logically enclosed in a single code segment. For example, an entire + /// extend block (possibly containing multiple extension definitions) will + /// have an outer location whose path refers to the "extensions" repeated + /// field without an index. + /// - Multiple locations may have the same path. This happens when a single + /// logical declaration is spread out across multiple places. The most + /// obvious example is the "extend" block again -- there may be multiple + /// extend blocks in the same scope, each of which will have the same path. + /// - A location's span is not always a subset of its parent's span. For + /// example, the "extendee" of an extension declaration appears at the + /// beginning of the "extend" block and is shared by all extensions within + /// the block. + /// - Just because a location's span is a subset of some other location's span + /// does not mean that it is a descendent. For example, a "group" defines + /// both a type and a field in a single declaration. Thus, the locations + /// corresponding to the type and field and their components will overlap. + /// - Code which tries to interpret locations should probably be designed to + /// ignore those that it doesn't understand, as more types of locations could + /// be recorded in the future. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Location { get { return location_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SourceCodeInfo); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(SourceCodeInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -4789,26 +5497,31 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= location_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { location_.WriteTo(output, _repeated_location_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += location_.CalculateSize(_repeated_location_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(SourceCodeInfo other) { if (other == null) { return; @@ -4816,6 +5529,7 @@ namespace Google.Protobuf.Reflection { location_.Add(other.location_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -4833,27 +5547,31 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the SourceCodeInfo message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class Location : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Location()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.SourceCodeInfo.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Location() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Location(Location other) : this() { path_ = other.path_.Clone(); span_ = other.span_.Clone(); @@ -4862,6 +5580,7 @@ namespace Google.Protobuf.Reflection { leadingDetachedComments_ = other.leadingDetachedComments_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Location Clone() { return new Location(this); } @@ -4872,30 +5591,31 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForInt32(10); private readonly pbc::RepeatedField path_ = new pbc::RepeatedField(); /// - /// Identifies which part of the FileDescriptorProto was defined at this - /// location. + /// Identifies which part of the FileDescriptorProto was defined at this + /// location. /// - /// Each element is a field number or an index. They form a path from - /// the root FileDescriptorProto to the place where the definition. For - /// example, this path: - /// [ 4, 3, 2, 7, 1 ] - /// refers to: - /// file.message_type(3) // 4, 3 - /// .field(7) // 2, 7 - /// .name() // 1 - /// This is because FileDescriptorProto.message_type has field number 4: - /// repeated DescriptorProto message_type = 4; - /// and DescriptorProto.field has field number 2: - /// repeated FieldDescriptorProto field = 2; - /// and FieldDescriptorProto.name has field number 1: - /// optional string name = 1; + /// Each element is a field number or an index. They form a path from + /// the root FileDescriptorProto to the place where the definition. For + /// example, this path: + /// [ 4, 3, 2, 7, 1 ] + /// refers to: + /// file.message_type(3) // 4, 3 + /// .field(7) // 2, 7 + /// .name() // 1 + /// This is because FileDescriptorProto.message_type has field number 4: + /// repeated DescriptorProto message_type = 4; + /// and DescriptorProto.field has field number 2: + /// repeated FieldDescriptorProto field = 2; + /// and FieldDescriptorProto.name has field number 1: + /// optional string name = 1; /// - /// Thus, the above path gives the location of a field name. If we removed - /// the last element: - /// [ 4, 3, 2, 7 ] - /// this path refers to the whole field declaration (from the beginning - /// of the label to the terminating semicolon). + /// Thus, the above path gives the location of a field name. If we removed + /// the last element: + /// [ 4, 3, 2, 7 ] + /// this path refers to the whole field declaration (from the beginning + /// of the label to the terminating semicolon). /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Path { get { return path_; } } @@ -4906,12 +5626,13 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForInt32(18); private readonly pbc::RepeatedField span_ = new pbc::RepeatedField(); /// - /// Always has exactly three or four elements: start line, start column, - /// end line (optional, otherwise assumed same as start line), end column. - /// These are packed into a single field for efficiency. Note that line - /// and column numbers are zero-based -- typically you will want to add - /// 1 to each before displaying to a user. + /// Always has exactly three or four elements: start line, start column, + /// end line (optional, otherwise assumed same as start line), end column. + /// These are packed into a single field for efficiency. Note that line + /// and column numbers are zero-based -- typically you will want to add + /// 1 to each before displaying to a user. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Span { get { return span_; } } @@ -4920,54 +5641,55 @@ namespace Google.Protobuf.Reflection { public const int LeadingCommentsFieldNumber = 3; private string leadingComments_ = ""; /// - /// If this SourceCodeInfo represents a complete declaration, these are any - /// comments appearing before and after the declaration which appear to be - /// attached to the declaration. + /// If this SourceCodeInfo represents a complete declaration, these are any + /// comments appearing before and after the declaration which appear to be + /// attached to the declaration. /// - /// A series of line comments appearing on consecutive lines, with no other - /// tokens appearing on those lines, will be treated as a single comment. + /// A series of line comments appearing on consecutive lines, with no other + /// tokens appearing on those lines, will be treated as a single comment. /// - /// leading_detached_comments will keep paragraphs of comments that appear - /// before (but not connected to) the current element. Each paragraph, - /// separated by empty lines, will be one comment element in the repeated - /// field. + /// leading_detached_comments will keep paragraphs of comments that appear + /// before (but not connected to) the current element. Each paragraph, + /// separated by empty lines, will be one comment element in the repeated + /// field. /// - /// Only the comment content is provided; comment markers (e.g. //) are - /// stripped out. For block comments, leading whitespace and an asterisk - /// will be stripped from the beginning of each line other than the first. - /// Newlines are included in the output. + /// Only the comment content is provided; comment markers (e.g. //) are + /// stripped out. For block comments, leading whitespace and an asterisk + /// will be stripped from the beginning of each line other than the first. + /// Newlines are included in the output. /// - /// Examples: + /// Examples: /// - /// optional int32 foo = 1; // Comment attached to foo. - /// // Comment attached to bar. - /// optional int32 bar = 2; + /// optional int32 foo = 1; // Comment attached to foo. + /// // Comment attached to bar. + /// optional int32 bar = 2; /// - /// optional string baz = 3; - /// // Comment attached to baz. - /// // Another line attached to baz. + /// optional string baz = 3; + /// // Comment attached to baz. + /// // Another line attached to baz. /// - /// // Comment attached to qux. - /// // - /// // Another line attached to qux. - /// optional double qux = 4; + /// // Comment attached to qux. + /// // + /// // Another line attached to qux. + /// optional double qux = 4; /// - /// // Detached comment for corge. This is not leading or trailing comments - /// // to qux or corge because there are blank lines separating it from - /// // both. + /// // Detached comment for corge. This is not leading or trailing comments + /// // to qux or corge because there are blank lines separating it from + /// // both. /// - /// // Detached comment for corge paragraph 2. + /// // Detached comment for corge paragraph 2. /// - /// optional string corge = 5; - /// /* Block comment attached - /// * to corge. Leading asterisks - /// * will be removed. */ - /// /* Block comment attached to - /// * grault. */ - /// optional int32 grault = 6; + /// optional string corge = 5; + /// /* Block comment attached + /// * to corge. Leading asterisks + /// * will be removed. */ + /// /* Block comment attached to + /// * grault. */ + /// optional int32 grault = 6; /// - /// // ignored detached comments. + /// // ignored detached comments. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string LeadingComments { get { return leadingComments_; } set { @@ -4978,6 +5700,7 @@ namespace Google.Protobuf.Reflection { /// Field number for the "trailing_comments" field. public const int TrailingCommentsFieldNumber = 4; private string trailingComments_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TrailingComments { get { return trailingComments_; } set { @@ -4990,14 +5713,17 @@ namespace Google.Protobuf.Reflection { private static readonly pb::FieldCodec _repeated_leadingDetachedComments_codec = pb::FieldCodec.ForString(50); private readonly pbc::RepeatedField leadingDetachedComments_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField LeadingDetachedComments { get { return leadingDetachedComments_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Location); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Location other) { if (ReferenceEquals(other, null)) { return false; @@ -5013,6 +5739,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= path_.GetHashCode(); @@ -5023,10 +5750,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { path_.WriteTo(output, _repeated_path_codec); span_.WriteTo(output, _repeated_span_codec); @@ -5041,6 +5770,7 @@ namespace Google.Protobuf.Reflection { leadingDetachedComments_.WriteTo(output, _repeated_leadingDetachedComments_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += path_.CalculateSize(_repeated_path_codec); @@ -5055,6 +5785,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Location other) { if (other == null) { return; @@ -5070,6 +5801,7 @@ namespace Google.Protobuf.Reflection { leadingDetachedComments_.Add(other.leadingDetachedComments_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5111,33 +5843,38 @@ namespace Google.Protobuf.Reflection { } /// - /// 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. + /// 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. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class GeneratedCodeInfo : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GeneratedCodeInfo()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[18]; } + get { return global::Google.Protobuf.Reflection.DescriptorReflection.Descriptor.MessageTypes[19]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeneratedCodeInfo() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeneratedCodeInfo(GeneratedCodeInfo other) : this() { annotation_ = other.annotation_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public GeneratedCodeInfo Clone() { return new GeneratedCodeInfo(this); } @@ -5148,17 +5885,20 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.Reflection.GeneratedCodeInfo.Types.Annotation.Parser); private readonly pbc::RepeatedField annotation_ = new pbc::RepeatedField(); /// - /// An Annotation connects some span of text in generated code to an element - /// of its generating .proto file. + /// An Annotation connects some span of text in generated code to an element + /// of its generating .proto file. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Annotation { get { return annotation_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as GeneratedCodeInfo); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(GeneratedCodeInfo other) { if (ReferenceEquals(other, null)) { return false; @@ -5170,26 +5910,31 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= annotation_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { annotation_.WriteTo(output, _repeated_annotation_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += annotation_.CalculateSize(_repeated_annotation_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(GeneratedCodeInfo other) { if (other == null) { return; @@ -5197,6 +5942,7 @@ namespace Google.Protobuf.Reflection { annotation_.Add(other.annotation_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -5214,27 +5960,31 @@ namespace Google.Protobuf.Reflection { #region Nested types /// Container for nested types declared in the GeneratedCodeInfo message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] internal sealed partial class Annotation : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Annotation()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.Reflection.GeneratedCodeInfo.Descriptor.NestedTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Annotation() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Annotation(Annotation other) : this() { path_ = other.path_.Clone(); sourceFile_ = other.sourceFile_; @@ -5242,6 +5992,7 @@ namespace Google.Protobuf.Reflection { end_ = other.end_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Annotation Clone() { return new Annotation(this); } @@ -5252,9 +6003,10 @@ namespace Google.Protobuf.Reflection { = pb::FieldCodec.ForInt32(10); private readonly pbc::RepeatedField path_ = new pbc::RepeatedField(); /// - /// Identifies the element in the original source .proto file. This field - /// is formatted the same as SourceCodeInfo.Location.path. + /// Identifies the element in the original source .proto file. This field + /// is formatted the same as SourceCodeInfo.Location.path. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Path { get { return path_; } } @@ -5263,8 +6015,9 @@ namespace Google.Protobuf.Reflection { public const int SourceFileFieldNumber = 2; private string sourceFile_ = ""; /// - /// Identifies the filesystem path to the original source .proto. + /// Identifies the filesystem path to the original source .proto. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SourceFile { get { return sourceFile_; } set { @@ -5276,9 +6029,10 @@ namespace Google.Protobuf.Reflection { public const int BeginFieldNumber = 3; private int begin_; /// - /// Identifies the starting offset in bytes in the generated code - /// that relates to the identified object. + /// Identifies the starting offset in bytes in the generated code + /// that relates to the identified object. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Begin { get { return begin_; } set { @@ -5290,10 +6044,11 @@ namespace Google.Protobuf.Reflection { public const int EndFieldNumber = 4; private int end_; /// - /// 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). + /// 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). /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int End { get { return end_; } set { @@ -5301,10 +6056,12 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Annotation); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Annotation other) { if (ReferenceEquals(other, null)) { return false; @@ -5319,6 +6076,7 @@ namespace Google.Protobuf.Reflection { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= path_.GetHashCode(); @@ -5328,10 +6086,12 @@ namespace Google.Protobuf.Reflection { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { path_.WriteTo(output, _repeated_path_codec); if (SourceFile.Length != 0) { @@ -5348,6 +6108,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += path_.CalculateSize(_repeated_path_codec); @@ -5363,6 +6124,7 @@ namespace Google.Protobuf.Reflection { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Annotation other) { if (other == null) { return; @@ -5379,6 +6141,7 @@ namespace Google.Protobuf.Reflection { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs index c732c93a06..89c73a61b2 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs @@ -112,5 +112,10 @@ namespace Google.Protobuf.Reflection { return File.DescriptorPool.FindSymbol(FullName + "." + name); } + + /// + /// The (possibly empty) set of custom options for this enum. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs index b212ce9618..8b838c68f0 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs @@ -66,5 +66,10 @@ namespace Google.Protobuf.Reflection /// Returns the enum descriptor that this value is part of. /// public EnumDescriptor EnumDescriptor { get { return enumDescriptor; } } + + /// + /// The (possibly empty) set of custom options for this enum value. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs index 6c6f6ee05f..2a3d5c7a2d 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs @@ -97,7 +97,7 @@ namespace Google.Protobuf.Reflection // We could trust the generated code and check whether the type of the property is // a MapField, but that feels a tad nasty. this.propertyName = propertyName; - JsonName = Proto.JsonName == "" ? JsonFormatter.ToCamelCase(Proto.Name) : Proto.JsonName; + JsonName = Proto.JsonName == "" ? JsonFormatter.ToJsonName(Proto.Name) : Proto.JsonName; } @@ -250,6 +250,11 @@ namespace Google.Protobuf.Reflection } } + /// + /// The (possibly empty) set of custom options for this field. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + /// /// Look up and cross-link all field types etc. /// diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs index ab7cd92216..9124beee04 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs @@ -251,17 +251,6 @@ namespace Google.Protobuf.Reflection "Dependencies passed to FileDescriptor.BuildFrom() don't match " + "those listed in the FileDescriptorProto."); } - for (int i = 0; i < proto.Dependency.Count; i++) - { - if (dependencies[i].Name != proto.Dependency[i]) - { - throw new DescriptorValidationException( - result, - "Dependencies passed to FileDescriptor.BuildFrom() don't match " + - "those listed in the FileDescriptorProto. Expected: " + - proto.Dependency[i] + " but was: " + dependencies[i].Name); - } - } result.CrossLink(); return result; @@ -340,5 +329,10 @@ namespace Google.Protobuf.Reflection /// The file descriptor for descriptor.proto. /// public static FileDescriptor DescriptorProtoFileDescriptor { get { return DescriptorReflection.Descriptor; } } + + /// + /// The (possibly empty) set of custom options for this file. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; } -} \ No newline at end of file +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs old mode 100644 new mode 100755 index f5a835e5cc..86942acc02 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MessageDescriptor.cs @@ -34,6 +34,10 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +#if NET35 +// Needed for ReadOnlyDictionary, which does not exist in .NET 3.5 +using Google.Protobuf.Collections; +#endif namespace Google.Protobuf.Reflection { @@ -216,6 +220,11 @@ namespace Google.Protobuf.Reflection public T FindDescriptor(string name) where T : class, IDescriptor => File.DescriptorPool.FindSymbol(FullName + "." + name); + /// + /// The (possibly empty) set of custom options for this message. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + /// /// Looks up and cross-links all fields and nested types. /// diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs index f9539f6cbd..19d7f8a092 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/MethodDescriptor.cs @@ -67,6 +67,11 @@ namespace Google.Protobuf.Reflection /// public bool IsServerStreaming { get { return proto.ServerStreaming; } } + /// + /// The (possibly empty) set of custom options for this method. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file, ServiceDescriptor parent, int index) : base(file, parent.FullName + "." + proto.Name, index) diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs index 22020acf06..5906c2e36d 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OneofDescriptor.cs @@ -90,6 +90,11 @@ namespace Google.Protobuf.Reflection /// public OneofAccessor Accessor { get { return accessor; } } + /// + /// The (possibly empty) set of custom options for this oneof. + /// + public CustomOptions CustomOptions => proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal void CrossLink() { List fieldCollection = new List(); diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs index 27f9ab98c3..07d0fd99af 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/OriginalNameAttribute.cs @@ -46,6 +46,11 @@ namespace Google.Protobuf.Reflection /// public string Name { get; set; } + /// + /// If the name is preferred in the .proto file. + /// + public bool PreferredAlias { get; set; } + /// /// Constructs a new attribute instance for the given name. /// @@ -53,6 +58,8 @@ namespace Google.Protobuf.Reflection public OriginalNameAttribute(string name) { Name = ProtoPreconditions.CheckNotNull(name, nameof(name)); + PreferredAlias = true; } + } -} \ No newline at end of file +} diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs index 6c285410d4..8c055d6d92 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/PartialClasses.cs @@ -1,59 +1,59 @@ -#region Copyright notice and license -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion - -// This file just contains partial classes for any autogenerated classes that need additional support. -namespace Google.Protobuf.Reflection -{ - internal partial class FieldDescriptorProto - { - // We can't tell the difference between "explicitly set to 0" and "not set" - // in proto3, but we need to tell the difference for OneofIndex. descriptor.proto - // is really a proto2 file, but the runtime doesn't know about proto2 semantics... - // We fake it by defaulting to -1. - partial void OnConstruction() - { - OneofIndex = -1; - } - } - - internal partial class FieldOptions - { - // We can't tell the difference between "explicitly set to false" and "not set" - // in proto3, but we need to tell the difference for FieldDescriptor.IsPacked. - // This won't work if we ever need to support proto2, but at that point we'll be - // able to remove this hack and use field presence instead. - partial void OnConstruction() - { - Packed = true; - } - } +#region Copyright notice and license +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +// This file just contains partial classes for any autogenerated classes that need additional support. +namespace Google.Protobuf.Reflection +{ + internal partial class FieldDescriptorProto + { + // We can't tell the difference between "explicitly set to 0" and "not set" + // in proto3, but we need to tell the difference for OneofIndex. descriptor.proto + // is really a proto2 file, but the runtime doesn't know about proto2 semantics... + // We fake it by defaulting to -1. + partial void OnConstruction() + { + OneofIndex = -1; + } + } + + internal partial class FieldOptions + { + // We can't tell the difference between "explicitly set to false" and "not set" + // in proto3, but we need to tell the difference for FieldDescriptor.IsPacked. + // This won't work if we ever need to support proto2, but at that point we'll be + // able to remove this hack and use field presence instead. + partial void OnConstruction() + { + Packed = true; + } + } } \ No newline at end of file diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs index cc0a501042..fe5c072c8e 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/Reflection/ServiceDescriptor.cs @@ -78,6 +78,11 @@ namespace Google.Protobuf.Reflection return File.DescriptorPool.FindSymbol(FullName + "." + name); } + /// + /// The (possibly empty) set of custom options for this service. + /// + public CustomOptions CustomOptions => Proto.Options?.CustomOptions ?? CustomOptions.Empty; + internal void CrossLink() { foreach (MethodDescriptor method in methods) diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs index 871a383f0d..b90c9a2afd 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Any.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/any.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class AnyReflection { #region Descriptor @@ -24,10 +23,10 @@ namespace Google.Protobuf.WellKnownTypes { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", - "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnIKE2Nv", + "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQm8KE2Nv", "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaJWdpdGh1Yi5jb20vZ29s", - "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmgAQGiAgNHUEKqAh5Hb29nbGUuUHJv", - "dG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); + "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmiAgNHUEKqAh5Hb29nbGUuUHJvdG9i", + "dWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -39,89 +38,104 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// `Any` contains an arbitrary serialized protocol buffer message along with a - /// URL that describes the type of the serialized message. + /// `Any` contains an arbitrary serialized protocol buffer message along with a + /// URL that describes the type of the serialized message. /// - /// Protobuf library provides support to pack/unpack Any values in the form - /// of utility functions or additional generated methods of the Any type. + /// Protobuf library provides support to pack/unpack Any values in the form + /// of utility functions or additional generated methods of the Any type. /// - /// Example 1: Pack and unpack a message in C++. + /// Example 1: Pack and unpack a message in C++. /// - /// Foo foo = ...; - /// Any any; - /// any.PackFrom(foo); - /// ... - /// if (any.UnpackTo(&foo)) { - /// ... - /// } + /// Foo foo = ...; + /// Any any; + /// any.PackFrom(foo); + /// ... + /// if (any.UnpackTo(&foo)) { + /// ... + /// } /// - /// Example 2: Pack and unpack a message in Java. + /// Example 2: Pack and unpack a message in Java. /// - /// Foo foo = ...; - /// Any any = Any.pack(foo); - /// ... - /// if (any.is(Foo.class)) { - /// foo = any.unpack(Foo.class); - /// } + /// Foo foo = ...; + /// Any any = Any.pack(foo); + /// ... + /// if (any.is(Foo.class)) { + /// foo = any.unpack(Foo.class); + /// } /// - /// The pack methods provided by protobuf library will by default use - /// 'type.googleapis.com/full.type.name' as the type URL and the unpack - /// methods only use the fully qualified type name after the last '/' - /// in the type URL, for example "foo.bar.com/x/y.z" will yield type - /// name "y.z". + /// Example 3: Pack and unpack a message in Python. /// - /// JSON - /// ==== - /// The JSON representation of an `Any` value uses the regular - /// representation of the deserialized, embedded message, with an - /// additional field `@type` which contains the type URL. Example: + /// foo = Foo(...) + /// any = Any() + /// any.Pack(foo) + /// ... + /// if any.Is(Foo.DESCRIPTOR): + /// any.Unpack(foo) + /// ... /// - /// package google.profile; - /// message Person { - /// string first_name = 1; - /// string last_name = 2; - /// } + /// The pack methods provided by protobuf library will by default use + /// 'type.googleapis.com/full.type.name' as the type URL and the unpack + /// methods only use the fully qualified type name after the last '/' + /// in the type URL, for example "foo.bar.com/x/y.z" will yield type + /// name "y.z". /// - /// { - /// "@type": "type.googleapis.com/google.profile.Person", - /// "firstName": <string>, - /// "lastName": <string> - /// } + /// JSON + /// ==== + /// The JSON representation of an `Any` value uses the regular + /// representation of the deserialized, embedded message, with an + /// additional field `@type` which contains the type URL. Example: /// - /// If the embedded message type is well-known and has a custom JSON - /// representation, that representation will be embedded adding a field - /// `value` which holds the custom JSON in addition to the `@type` - /// field. Example (for message [google.protobuf.Duration][]): + /// package google.profile; + /// message Person { + /// string first_name = 1; + /// string last_name = 2; + /// } /// - /// { - /// "@type": "type.googleapis.com/google.protobuf.Duration", - /// "value": "1.212s" - /// } + /// { + /// "@type": "type.googleapis.com/google.profile.Person", + /// "firstName": <string>, + /// "lastName": <string> + /// } + /// + /// If the embedded message type is well-known and has a custom JSON + /// representation, that representation will be embedded adding a field + /// `value` which holds the custom JSON in addition to the `@type` + /// field. Example (for message [google.protobuf.Duration][]): + /// + /// { + /// "@type": "type.googleapis.com/google.protobuf.Duration", + /// "value": "1.212s" + /// } /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Any : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Any()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Any() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Any(Any other) : this() { typeUrl_ = other.typeUrl_; value_ = other.value_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Any Clone() { return new Any(this); } @@ -130,28 +144,29 @@ namespace Google.Protobuf.WellKnownTypes { public const int TypeUrlFieldNumber = 1; private string typeUrl_ = ""; /// - /// A URL/resource name whose content describes the type of the - /// serialized protocol buffer message. + /// A URL/resource name whose content describes the type of the + /// serialized protocol buffer message. /// - /// For URLs which use the schema `http`, `https`, or no schema, the - /// following restrictions and interpretations apply: + /// For URLs which use the scheme `http`, `https`, or no scheme, the + /// following restrictions and interpretations apply: /// - /// * If no schema is provided, `https` is assumed. - /// * The last segment of the URL's path must represent the fully - /// qualified name of the type (as in `path/google.protobuf.Duration`). - /// The name should be in a canonical form (e.g., leading "." is - /// not accepted). - /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] - /// value in binary format, or produce an error. - /// * Applications are allowed to cache lookup results based on the - /// URL, or have them precompiled into a binary to avoid any - /// lookup. Therefore, binary compatibility needs to be preserved - /// on changes to types. (Use versioned type names to manage - /// breaking changes.) + /// * If no scheme is provided, `https` is assumed. + /// * The last segment of the URL's path must represent the fully + /// qualified name of the type (as in `path/google.protobuf.Duration`). + /// The name should be in a canonical form (e.g., leading "." is + /// not accepted). + /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] + /// value in binary format, or produce an error. + /// * Applications are allowed to cache lookup results based on the + /// URL, or have them precompiled into a binary to avoid any + /// lookup. Therefore, binary compatibility needs to be preserved + /// on changes to types. (Use versioned type names to manage + /// breaking changes.) /// - /// Schemas other than `http`, `https` (or the empty schema) might be - /// used with implementation specific semantics. + /// Schemes other than `http`, `https` (or the empty scheme) might be + /// used with implementation specific semantics. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeUrl { get { return typeUrl_; } set { @@ -163,8 +178,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int ValueFieldNumber = 2; private pb::ByteString value_ = pb::ByteString.Empty; /// - /// Must be a valid serialized protocol buffer of the above specified type. + /// Must be a valid serialized protocol buffer of the above specified type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString Value { get { return value_; } set { @@ -172,10 +188,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Any); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Any other) { if (ReferenceEquals(other, null)) { return false; @@ -188,6 +206,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (TypeUrl.Length != 0) hash ^= TypeUrl.GetHashCode(); @@ -195,10 +214,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (TypeUrl.Length != 0) { output.WriteRawTag(10); @@ -210,6 +231,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (TypeUrl.Length != 0) { @@ -221,6 +243,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Any other) { if (other == null) { return; @@ -233,6 +256,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs index f4fac73865..fca689dc08 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/AnyPartial.cs @@ -44,17 +44,25 @@ namespace Google.Protobuf.WellKnownTypes prefix.EndsWith("/") ? prefix + descriptor.FullName : prefix + "/" + descriptor.FullName; /// - /// Retrieves the type name for a type URL. This is always just the last part of the URL, - /// after the trailing slash. No validation of anything before the trailing slash is performed. - /// If the type URL does not include a slash, an empty string is returned rather than an exception - /// being thrown; this won't match any types, and the calling code is probably in a better position - /// to give a meaningful error. - /// There is no handling of fragments or queries at the moment. + /// Retrieves the type name for a type URL, matching the + /// of the packed message type. /// + /// + /// + /// This is always just the last part of the URL, after the final slash. No validation of + /// anything before the trailing slash is performed. If the type URL does not include a slash, + /// an empty string is returned rather than an exception being thrown; this won't match any types, + /// and the calling code is probably in a better position to give a meaningful error. + /// + /// + /// There is no handling of fragments or queries at the moment. + /// + /// /// The URL to extract the type name from /// The type name - internal static string GetTypeName(string typeUrl) + public static string GetTypeName(string typeUrl) { + ProtoPreconditions.CheckNotNull(typeUrl, nameof(typeUrl)); int lastSlash = typeUrl.LastIndexOf('/'); return lastSlash == -1 ? "" : typeUrl.Substring(lastSlash + 1); } @@ -80,6 +88,27 @@ namespace Google.Protobuf.WellKnownTypes return target; } + /// + /// Attempts to unpack the content of this Any message into the target message type, + /// if it matches the type URL within this Any message. + /// + /// The type of message to attempt to unpack the content into. + /// true if the message was successfully unpacked; false if the type name didn't match + public bool TryUnpack(out T result) where T : IMessage, new() + { + // Note: deliberately avoid writing anything to result until the end, in case it's being + // monitored by other threads. (That would be a bug in the calling code, but let's not make it worse.) + T target = new T(); + if (GetTypeName(TypeUrl) != target.Descriptor.FullName) + { + result = default(T); // Can't use null as there's no class constraint, but this always *will* be null in real usage. + return false; + } + target.MergeFrom(Value); + result = target; + return true; + } + /// /// Packs the specified message into an Any message using a type URL prefix of "type.googleapis.com". /// diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs index e568a2c981..aeeb8e7392 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Api.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/api.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class ApiReflection { #region Descriptor @@ -36,9 +35,10 @@ namespace Google.Protobuf.WellKnownTypes { "ChFyZXNwb25zZV90eXBlX3VybBgEIAEoCRIaChJyZXNwb25zZV9zdHJlYW1p", "bmcYBSABKAgSKAoHb3B0aW9ucxgGIAMoCzIXLmdvb2dsZS5wcm90b2J1Zi5P", "cHRpb24SJwoGc3ludGF4GAcgASgOMhcuZ29vZ2xlLnByb3RvYnVmLlN5bnRh", - "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCSwoTY29t", - "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAaABAaICA0dQQqoCHkdvb2ds", - "ZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); + "eCIjCgVNaXhpbhIMCgRuYW1lGAEgASgJEgwKBHJvb3QYAiABKAlCdQoTY29t", + "Lmdvb2dsZS5wcm90b2J1ZkIIQXBpUHJvdG9QAVorZ29vZ2xlLmdvbGFuZy5v", + "cmcvZ2VucHJvdG8vcHJvdG9idWYvYXBpO2FwaaICA0dQQqoCHkdvb2dsZS5Q", + "cm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -52,27 +52,31 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// Api is a light-weight descriptor for a protocol buffer service. + /// Api is a light-weight descriptor for a protocol buffer service. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Api : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Api()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Api() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Api(Api other) : this() { name_ = other.name_; methods_ = other.methods_.Clone(); @@ -83,6 +87,7 @@ namespace Google.Protobuf.WellKnownTypes { syntax_ = other.syntax_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Api Clone() { return new Api(this); } @@ -91,9 +96,10 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The fully qualified name of this api, including package name - /// followed by the api's simple name. + /// The fully qualified name of this api, including package name + /// followed by the api's simple name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -107,8 +113,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Method.Parser); private readonly pbc::RepeatedField methods_ = new pbc::RepeatedField(); /// - /// The methods of this api, in unspecified order. + /// The methods of this api, in unspecified order. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Methods { get { return methods_; } } @@ -119,8 +126,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Any metadata attached to the API. + /// Any metadata attached to the API. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { get { return options_; } } @@ -129,27 +137,28 @@ namespace Google.Protobuf.WellKnownTypes { public const int VersionFieldNumber = 4; private string version_ = ""; /// - /// A version string for this api. If specified, must have the form - /// `major-version.minor-version`, as in `1.10`. If the minor version - /// is omitted, it defaults to zero. If the entire version field is - /// empty, the major version is derived from the package name, as - /// outlined below. If the field is not empty, the version in the - /// package name will be verified to be consistent with what is - /// provided here. + /// A version string for this api. If specified, must have the form + /// `major-version.minor-version`, as in `1.10`. If the minor version + /// is omitted, it defaults to zero. If the entire version field is + /// empty, the major version is derived from the package name, as + /// outlined below. If the field is not empty, the version in the + /// package name will be verified to be consistent with what is + /// provided here. /// - /// The versioning schema uses [semantic - /// versioning](http://semver.org) where the major version number - /// indicates a breaking change and the minor version an additive, - /// non-breaking change. Both version numbers are signals to users - /// what to expect from different versions, and should be carefully - /// chosen based on the product plan. + /// The versioning schema uses [semantic + /// versioning](http://semver.org) where the major version number + /// indicates a breaking change and the minor version an additive, + /// non-breaking change. Both version numbers are signals to users + /// what to expect from different versions, and should be carefully + /// chosen based on the product plan. /// - /// The major version is also reflected in the package name of the - /// API, which must end in `v<major-version>`, as in - /// `google.feature.v1`. For major versions 0 and 1, the suffix can - /// be omitted. Zero major versions must only be used for - /// experimental, none-GA apis. + /// The major version is also reflected in the package name of the + /// API, which must end in `v<major-version>`, as in + /// `google.feature.v1`. For major versions 0 and 1, the suffix can + /// be omitted. Zero major versions must only be used for + /// experimental, none-GA apis. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Version { get { return version_; } set { @@ -161,9 +170,10 @@ namespace Google.Protobuf.WellKnownTypes { public const int SourceContextFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; /// - /// Source context for the protocol buffer service represented by this - /// message. + /// Source context for the protocol buffer service represented by this + /// message. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { get { return sourceContext_; } set { @@ -177,8 +187,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Mixin.Parser); private readonly pbc::RepeatedField mixins_ = new pbc::RepeatedField(); /// - /// Included APIs. See [Mixin][]. + /// Included APIs. See [Mixin][]. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Mixins { get { return mixins_; } } @@ -187,8 +198,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int SyntaxFieldNumber = 7; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax of the service. + /// The source syntax of the service. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { get { return syntax_; } set { @@ -196,10 +208,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Api); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Api other) { if (ReferenceEquals(other, null)) { return false; @@ -217,6 +231,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -229,10 +244,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -255,6 +272,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -275,6 +293,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Api other) { if (other == null) { return; @@ -299,6 +318,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -344,27 +364,31 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// Method represents a method of an api. + /// Method represents a method of an api. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Method : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Method()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Method() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Method(Method other) : this() { name_ = other.name_; requestTypeUrl_ = other.requestTypeUrl_; @@ -375,6 +399,7 @@ namespace Google.Protobuf.WellKnownTypes { syntax_ = other.syntax_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Method Clone() { return new Method(this); } @@ -383,8 +408,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The simple name of this method. + /// The simple name of this method. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -396,8 +422,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int RequestTypeUrlFieldNumber = 2; private string requestTypeUrl_ = ""; /// - /// A URL of the input message type. + /// A URL of the input message type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string RequestTypeUrl { get { return requestTypeUrl_; } set { @@ -409,8 +436,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int RequestStreamingFieldNumber = 3; private bool requestStreaming_; /// - /// If true, the request is streamed. + /// If true, the request is streamed. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool RequestStreaming { get { return requestStreaming_; } set { @@ -422,8 +450,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int ResponseTypeUrlFieldNumber = 4; private string responseTypeUrl_ = ""; /// - /// The URL of the output message type. + /// The URL of the output message type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ResponseTypeUrl { get { return responseTypeUrl_; } set { @@ -435,8 +464,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int ResponseStreamingFieldNumber = 5; private bool responseStreaming_; /// - /// If true, the response is streamed. + /// If true, the response is streamed. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool ResponseStreaming { get { return responseStreaming_; } set { @@ -450,8 +480,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(50, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Any metadata attached to the method. + /// Any metadata attached to the method. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { get { return options_; } } @@ -460,8 +491,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int SyntaxFieldNumber = 7; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax of this method. + /// The source syntax of this method. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { get { return syntax_; } set { @@ -469,10 +501,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Method); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Method other) { if (ReferenceEquals(other, null)) { return false; @@ -490,6 +524,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -502,10 +537,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -534,6 +571,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -558,6 +596,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Method other) { if (other == null) { return; @@ -583,6 +622,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -625,108 +665,113 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// Declares an API to be included in this API. The including API must - /// redeclare all the methods from the included API, but documentation - /// and options are inherited as follows: + /// Declares an API to be included in this API. The including API must + /// redeclare all the methods from the included API, but documentation + /// and options are inherited as follows: /// - /// - If after comment and whitespace stripping, the documentation - /// string of the redeclared method is empty, it will be inherited - /// from the original method. + /// - If after comment and whitespace stripping, the documentation + /// string of the redeclared method is empty, it will be inherited + /// from the original method. /// - /// - Each annotation belonging to the service config (http, - /// visibility) which is not set in the redeclared method will be - /// inherited. + /// - Each annotation belonging to the service config (http, + /// visibility) which is not set in the redeclared method will be + /// inherited. /// - /// - If an http annotation is inherited, the path pattern will be - /// modified as follows. Any version prefix will be replaced by the - /// version of the including API plus the [root][] path if specified. + /// - If an http annotation is inherited, the path pattern will be + /// modified as follows. Any version prefix will be replaced by the + /// version of the including API plus the [root][] path if specified. /// - /// Example of a simple mixin: + /// Example of a simple mixin: /// - /// package google.acl.v1; - /// service AccessControl { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v1/{resource=**}:getAcl"; - /// } - /// } + /// package google.acl.v1; + /// service AccessControl { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v1/{resource=**}:getAcl"; + /// } + /// } /// - /// package google.storage.v2; - /// service Storage { - /// rpc GetAcl(GetAclRequest) returns (Acl); + /// package google.storage.v2; + /// service Storage { + /// rpc GetAcl(GetAclRequest) returns (Acl); /// - /// // Get a data record. - /// rpc GetData(GetDataRequest) returns (Data) { - /// option (google.api.http).get = "/v2/{resource=**}"; - /// } - /// } + /// // Get a data record. + /// rpc GetData(GetDataRequest) returns (Data) { + /// option (google.api.http).get = "/v2/{resource=**}"; + /// } + /// } /// - /// Example of a mixin configuration: + /// Example of a mixin configuration: /// - /// apis: - /// - name: google.storage.v2.Storage - /// mixins: - /// - name: google.acl.v1.AccessControl + /// apis: + /// - name: google.storage.v2.Storage + /// mixins: + /// - name: google.acl.v1.AccessControl /// - /// The mixin construct implies that all methods in `AccessControl` are - /// also declared with same name and request/response types in - /// `Storage`. A documentation generator or annotation processor will - /// see the effective `Storage.GetAcl` method after inherting - /// documentation and annotations as follows: + /// The mixin construct implies that all methods in `AccessControl` are + /// also declared with same name and request/response types in + /// `Storage`. A documentation generator or annotation processor will + /// see the effective `Storage.GetAcl` method after inherting + /// documentation and annotations as follows: /// - /// service Storage { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v2/{resource=**}:getAcl"; - /// } - /// ... - /// } + /// service Storage { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v2/{resource=**}:getAcl"; + /// } + /// ... + /// } /// - /// Note how the version in the path pattern changed from `v1` to `v2`. + /// Note how the version in the path pattern changed from `v1` to `v2`. /// - /// If the `root` field in the mixin is specified, it should be a - /// relative path under which inherited HTTP paths are placed. Example: + /// If the `root` field in the mixin is specified, it should be a + /// relative path under which inherited HTTP paths are placed. Example: /// - /// apis: - /// - name: google.storage.v2.Storage - /// mixins: - /// - name: google.acl.v1.AccessControl - /// root: acls + /// apis: + /// - name: google.storage.v2.Storage + /// mixins: + /// - name: google.acl.v1.AccessControl + /// root: acls /// - /// This implies the following inherited HTTP annotation: + /// This implies the following inherited HTTP annotation: /// - /// service Storage { - /// // Get the underlying ACL object. - /// rpc GetAcl(GetAclRequest) returns (Acl) { - /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; - /// } - /// ... - /// } + /// service Storage { + /// // Get the underlying ACL object. + /// rpc GetAcl(GetAclRequest) returns (Acl) { + /// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; + /// } + /// ... + /// } /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Mixin : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Mixin()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.ApiReflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Mixin() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Mixin(Mixin other) : this() { name_ = other.name_; root_ = other.root_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Mixin Clone() { return new Mixin(this); } @@ -735,8 +780,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The fully qualified name of the API which is included. + /// The fully qualified name of the API which is included. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -748,9 +794,10 @@ namespace Google.Protobuf.WellKnownTypes { public const int RootFieldNumber = 2; private string root_ = ""; /// - /// If non-empty specifies a path under which inherited HTTP paths - /// are rooted. + /// If non-empty specifies a path under which inherited HTTP paths + /// are rooted. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Root { get { return root_; } set { @@ -758,10 +805,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Mixin); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Mixin other) { if (ReferenceEquals(other, null)) { return false; @@ -774,6 +823,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -781,10 +831,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -796,6 +848,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -807,6 +860,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Mixin other) { if (other == null) { return; @@ -819,6 +873,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs index f17358f4b3..94159cb84c 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Duration.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/duration.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class DurationReflection { #region Descriptor @@ -26,7 +25,7 @@ namespace Google.Protobuf.WellKnownTypes { "Ch5nb29nbGUvcHJvdG9idWYvZHVyYXRpb24ucHJvdG8SD2dvb2dsZS5wcm90", "b2J1ZiIqCghEdXJhdGlvbhIPCgdzZWNvbmRzGAEgASgDEg0KBW5hbm9zGAIg", "ASgFQnwKE2NvbS5nb29nbGUucHJvdG9idWZCDUR1cmF0aW9uUHJvdG9QAVoq", - "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9uoAEB", + "Z2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL2R1cmF0aW9u+AEB", "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", "bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, @@ -40,71 +39,94 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// A Duration represents a signed, fixed-length span of time represented - /// as a count of seconds and fractions of seconds at nanosecond - /// resolution. It is independent of any calendar and concepts like "day" - /// or "month". It is related to Timestamp in that the difference between - /// two Timestamp values is a Duration and it can be added or subtracted - /// from a Timestamp. Range is approximately +-10,000 years. + /// A Duration represents a signed, fixed-length span of time represented + /// as a count of seconds and fractions of seconds at nanosecond + /// resolution. It is independent of any calendar and concepts like "day" + /// or "month". It is related to Timestamp in that the difference between + /// two Timestamp values is a Duration and it can be added or subtracted + /// from a Timestamp. Range is approximately +-10,000 years. /// - /// Example 1: Compute Duration from two Timestamps in pseudo code. + /// # Examples /// - /// Timestamp start = ...; - /// Timestamp end = ...; - /// Duration duration = ...; + /// Example 1: Compute Duration from two Timestamps in pseudo code. /// - /// duration.seconds = end.seconds - start.seconds; - /// duration.nanos = end.nanos - start.nanos; + /// Timestamp start = ...; + /// Timestamp end = ...; + /// Duration duration = ...; /// - /// if (duration.seconds < 0 && duration.nanos > 0) { - /// duration.seconds += 1; - /// duration.nanos -= 1000000000; - /// } else if (durations.seconds > 0 && duration.nanos < 0) { - /// duration.seconds -= 1; - /// duration.nanos += 1000000000; - /// } + /// duration.seconds = end.seconds - start.seconds; + /// duration.nanos = end.nanos - start.nanos; /// - /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + /// if (duration.seconds < 0 && duration.nanos > 0) { + /// duration.seconds += 1; + /// duration.nanos -= 1000000000; + /// } else if (durations.seconds > 0 && duration.nanos < 0) { + /// duration.seconds -= 1; + /// duration.nanos += 1000000000; + /// } /// - /// Timestamp start = ...; - /// Duration duration = ...; - /// Timestamp end = ...; + /// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. /// - /// end.seconds = start.seconds + duration.seconds; - /// end.nanos = start.nanos + duration.nanos; + /// Timestamp start = ...; + /// Duration duration = ...; + /// Timestamp end = ...; /// - /// if (end.nanos < 0) { - /// end.seconds -= 1; - /// end.nanos += 1000000000; - /// } else if (end.nanos >= 1000000000) { - /// end.seconds += 1; - /// end.nanos -= 1000000000; - /// } + /// end.seconds = start.seconds + duration.seconds; + /// end.nanos = start.nanos + duration.nanos; + /// + /// if (end.nanos < 0) { + /// end.seconds -= 1; + /// end.nanos += 1000000000; + /// } else if (end.nanos >= 1000000000) { + /// end.seconds += 1; + /// end.nanos -= 1000000000; + /// } + /// + /// Example 3: Compute Duration from datetime.timedelta in Python. + /// + /// td = datetime.timedelta(days=3, minutes=10) + /// duration = Duration() + /// duration.FromTimedelta(td) + /// + /// # JSON Mapping + /// + /// In JSON format, the Duration type is encoded as a string rather than an + /// object, where the string ends in the suffix "s" (indicating seconds) and + /// is preceded by the number of seconds, with nanoseconds expressed as + /// fractional seconds. For example, 3 seconds with 0 nanoseconds should be + /// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + /// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + /// microsecond should be expressed in JSON format as "3.000001s". /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Duration : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Duration()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Duration() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Duration(Duration other) : this() { seconds_ = other.seconds_; nanos_ = other.nanos_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Duration Clone() { return new Duration(this); } @@ -113,9 +135,11 @@ namespace Google.Protobuf.WellKnownTypes { public const int SecondsFieldNumber = 1; private long seconds_; /// - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. + /// Signed seconds of the span of time. Must be from -315,576,000,000 + /// to +315,576,000,000 inclusive. Note: these bounds are computed from: + /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Seconds { get { return seconds_; } set { @@ -127,13 +151,14 @@ namespace Google.Protobuf.WellKnownTypes { public const int NanosFieldNumber = 2; private int nanos_; /// - /// Signed fractions of a second at nanosecond resolution of the span - /// of time. Durations less than one second are represented with a 0 - /// `seconds` field and a positive or negative `nanos` field. For durations - /// of one second or more, a non-zero value for the `nanos` field must be - /// of the same sign as the `seconds` field. Must be from -999,999,999 - /// to +999,999,999 inclusive. + /// Signed fractions of a second at nanosecond resolution of the span + /// of time. Durations less than one second are represented with a 0 + /// `seconds` field and a positive or negative `nanos` field. For durations + /// of one second or more, a non-zero value for the `nanos` field must be + /// of the same sign as the `seconds` field. Must be from -999,999,999 + /// to +999,999,999 inclusive. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Nanos { get { return nanos_; } set { @@ -141,10 +166,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Duration); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Duration other) { if (ReferenceEquals(other, null)) { return false; @@ -157,6 +184,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Seconds != 0L) hash ^= Seconds.GetHashCode(); @@ -164,10 +192,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Seconds != 0L) { output.WriteRawTag(8); @@ -179,6 +209,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Seconds != 0L) { @@ -190,6 +221,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Duration other) { if (other == null) { return; @@ -202,6 +234,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs index e08ea2400b..aa89e08f59 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Empty.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/empty.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class EmptyReflection { #region Descriptor @@ -24,10 +23,10 @@ namespace Google.Protobuf.WellKnownTypes { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Chtnb29nbGUvcHJvdG9idWYvZW1wdHkucHJvdG8SD2dvb2dsZS5wcm90b2J1", - "ZiIHCgVFbXB0eUJ5ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", - "UAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0eaAB", - "AfgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); + "ZiIHCgVFbXB0eUJ2ChNjb20uZ29vZ2xlLnByb3RvYnVmQgpFbXB0eVByb3Rv", + "UAFaJ2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy9lbXB0efgB", + "AaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IGcHJv", + "dG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -39,46 +38,53 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// A generic empty message that you can re-use to avoid defining duplicated - /// empty messages in your APIs. A typical example is to use it as the request - /// or the response type of an API method. For instance: + /// A generic empty message that you can re-use to avoid defining duplicated + /// empty messages in your APIs. A typical example is to use it as the request + /// or the response type of an API method. For instance: /// - /// service Foo { - /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - /// } + /// service Foo { + /// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + /// } /// - /// The JSON representation for `Empty` is empty JSON object `{}`. + /// The JSON representation for `Empty` is empty JSON object `{}`. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Empty : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Empty()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.EmptyReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Empty() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Empty(Empty other) : this() { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Empty Clone() { return new Empty(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Empty); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Empty other) { if (ReferenceEquals(other, null)) { return false; @@ -89,29 +95,35 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Empty other) { if (other == null) { return; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs index 6f0a64d6ae..ef3bc10af7 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/field_mask.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class FieldMaskReflection { #region Descriptor @@ -24,9 +23,11 @@ namespace Google.Protobuf.WellKnownTypes { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiBnb29nbGUvcHJvdG9idWYvZmllbGRfbWFzay5wcm90bxIPZ29vZ2xlLnBy", - "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUJRChNjb20uZ29v", - "Z2xlLnByb3RvYnVmQg5GaWVsZE1hc2tQcm90b1ABoAEBogIDR1BCqgIeR29v", - "Z2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); + "b3RvYnVmIhoKCUZpZWxkTWFzaxINCgVwYXRocxgBIAMoCUKJAQoTY29tLmdv", + "b2dsZS5wcm90b2J1ZkIORmllbGRNYXNrUHJvdG9QAVo5Z29vZ2xlLmdvbGFu", + "Zy5vcmcvZ2VucHJvdG8vcHJvdG9idWYvZmllbGRfbWFzaztmaWVsZF9tYXNr", + "ogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5cGVzYgZwcm90", + "bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -38,178 +39,235 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// `FieldMask` represents a set of symbolic field paths, for example: + /// `FieldMask` represents a set of symbolic field paths, for example: /// - /// paths: "f.a" - /// paths: "f.b.d" + /// paths: "f.a" + /// paths: "f.b.d" /// - /// Here `f` represents a field in some root message, `a` and `b` - /// fields in the message found in `f`, and `d` a field found in the - /// message in `f.b`. + /// Here `f` represents a field in some root message, `a` and `b` + /// fields in the message found in `f`, and `d` a field found in the + /// message in `f.b`. /// - /// Field masks are used to specify a subset of fields that should be - /// returned by a get operation or modified by an update operation. - /// Field masks also have a custom JSON encoding (see below). + /// Field masks are used to specify a subset of fields that should be + /// returned by a get operation or modified by an update operation. + /// Field masks also have a custom JSON encoding (see below). /// - /// # Field Masks in Projections + /// # Field Masks in Projections /// - /// When used in the context of a projection, a response message or - /// sub-message is filtered by the API to only contain those fields as - /// specified in the mask. For example, if the mask in the previous - /// example is applied to a response message as follows: + /// When used in the context of a projection, a response message or + /// sub-message is filtered by the API to only contain those fields as + /// specified in the mask. For example, if the mask in the previous + /// example is applied to a response message as follows: /// - /// f { - /// a : 22 - /// b { - /// d : 1 - /// x : 2 - /// } - /// y : 13 - /// } - /// z: 8 + /// f { + /// a : 22 + /// b { + /// d : 1 + /// x : 2 + /// } + /// y : 13 + /// } + /// z: 8 /// - /// The result will not contain specific values for fields x,y and z - /// (their value will be set to the default, and omitted in proto text - /// output): + /// The result will not contain specific values for fields x,y and z + /// (their value will be set to the default, and omitted in proto text + /// output): /// - /// f { - /// a : 22 - /// b { - /// d : 1 - /// } - /// } + /// f { + /// a : 22 + /// b { + /// d : 1 + /// } + /// } /// - /// A repeated field is not allowed except at the last position of a - /// field mask. + /// A repeated field is not allowed except at the last position of a + /// paths string. /// - /// If a FieldMask object is not present in a get operation, the - /// operation applies to all fields (as if a FieldMask of all fields - /// had been specified). + /// If a FieldMask object is not present in a get operation, the + /// operation applies to all fields (as if a FieldMask of all fields + /// had been specified). /// - /// Note that a field mask does not necessarily apply to the - /// top-level response message. In case of a REST get operation, the - /// field mask applies directly to the response, but in case of a REST - /// list operation, the mask instead applies to each individual message - /// in the returned resource list. In case of a REST custom method, - /// other definitions may be used. Where the mask applies will be - /// clearly documented together with its declaration in the API. In - /// any case, the effect on the returned resource/resources is required - /// behavior for APIs. + /// Note that a field mask does not necessarily apply to the + /// top-level response message. In case of a REST get operation, the + /// field mask applies directly to the response, but in case of a REST + /// list operation, the mask instead applies to each individual message + /// in the returned resource list. In case of a REST custom method, + /// other definitions may be used. Where the mask applies will be + /// clearly documented together with its declaration in the API. In + /// any case, the effect on the returned resource/resources is required + /// behavior for APIs. /// - /// # Field Masks in Update Operations + /// # Field Masks in Update Operations /// - /// A field mask in update operations specifies which fields of the - /// targeted resource are going to be updated. The API is required - /// to only change the values of the fields as specified in the mask - /// and leave the others untouched. If a resource is passed in to - /// describe the updated values, the API ignores the values of all - /// fields not covered by the mask. + /// A field mask in update operations specifies which fields of the + /// targeted resource are going to be updated. The API is required + /// to only change the values of the fields as specified in the mask + /// and leave the others untouched. If a resource is passed in to + /// describe the updated values, the API ignores the values of all + /// fields not covered by the mask. /// - /// In order to reset a field's value to the default, the field must - /// be in the mask and set to the default value in the provided resource. - /// Hence, in order to reset all fields of a resource, provide a default - /// instance of the resource and set all fields in the mask, or do - /// not provide a mask as described below. + /// If a repeated field is specified for an update operation, the existing + /// repeated values in the target resource will be overwritten by the new values. + /// Note that a repeated field is only allowed in the last position of a `paths` + /// string. /// - /// If a field mask is not present on update, the operation applies to - /// all fields (as if a field mask of all fields has been specified). - /// Note that in the presence of schema evolution, this may mean that - /// fields the client does not know and has therefore not filled into - /// the request will be reset to their default. If this is unwanted - /// behavior, a specific service may require a client to always specify - /// a field mask, producing an error if not. + /// If a sub-message is specified in the last position of the field mask for an + /// update operation, then the existing sub-message in the target resource is + /// overwritten. Given the target message: /// - /// As with get operations, the location of the resource which - /// describes the updated values in the request message depends on the - /// operation kind. In any case, the effect of the field mask is - /// required to be honored by the API. + /// f { + /// b { + /// d : 1 + /// x : 2 + /// } + /// c : 1 + /// } /// - /// ## Considerations for HTTP REST + /// And an update message: /// - /// The HTTP kind of an update operation which uses a field mask must - /// be set to PATCH instead of PUT in order to satisfy HTTP semantics - /// (PUT must only be used for full updates). + /// f { + /// b { + /// d : 10 + /// } + /// } /// - /// # JSON Encoding of Field Masks + /// then if the field mask is: /// - /// In JSON, a field mask is encoded as a single string where paths are - /// separated by a comma. Fields name in each path are converted - /// to/from lower-camel naming conventions. + /// paths: "f.b" /// - /// As an example, consider the following message declarations: + /// then the result will be: /// - /// message Profile { - /// User user = 1; - /// Photo photo = 2; - /// } - /// message User { - /// string display_name = 1; - /// string address = 2; - /// } + /// f { + /// b { + /// d : 10 + /// } + /// c : 1 + /// } /// - /// In proto a field mask for `Profile` may look as such: + /// However, if the update mask was: /// - /// mask { - /// paths: "user.display_name" - /// paths: "photo" - /// } + /// paths: "f.b.d" /// - /// In JSON, the same mask is represented as below: + /// then the result would be: /// - /// { - /// mask: "user.displayName,photo" - /// } + /// f { + /// b { + /// d : 10 + /// x : 2 + /// } + /// c : 1 + /// } /// - /// # Field Masks and Oneof Fields + /// In order to reset a field's value to the default, the field must + /// be in the mask and set to the default value in the provided resource. + /// Hence, in order to reset all fields of a resource, provide a default + /// instance of the resource and set all fields in the mask, or do + /// not provide a mask as described below. /// - /// Field masks treat fields in oneofs just as regular fields. Consider the - /// following message: + /// If a field mask is not present on update, the operation applies to + /// all fields (as if a field mask of all fields has been specified). + /// Note that in the presence of schema evolution, this may mean that + /// fields the client does not know and has therefore not filled into + /// the request will be reset to their default. If this is unwanted + /// behavior, a specific service may require a client to always specify + /// a field mask, producing an error if not. /// - /// message SampleMessage { - /// oneof test_oneof { - /// string name = 4; - /// SubMessage sub_message = 9; - /// } - /// } + /// As with get operations, the location of the resource which + /// describes the updated values in the request message depends on the + /// operation kind. In any case, the effect of the field mask is + /// required to be honored by the API. /// - /// The field mask can be: + /// ## Considerations for HTTP REST /// - /// mask { - /// paths: "name" - /// } + /// The HTTP kind of an update operation which uses a field mask must + /// be set to PATCH instead of PUT in order to satisfy HTTP semantics + /// (PUT must only be used for full updates). /// - /// Or: + /// # JSON Encoding of Field Masks /// - /// mask { - /// paths: "sub_message" - /// } + /// In JSON, a field mask is encoded as a single string where paths are + /// separated by a comma. Fields name in each path are converted + /// to/from lower-camel naming conventions. /// - /// Note that oneof type names ("test_oneof" in this case) cannot be used in - /// paths. + /// As an example, consider the following message declarations: + /// + /// message Profile { + /// User user = 1; + /// Photo photo = 2; + /// } + /// message User { + /// string display_name = 1; + /// string address = 2; + /// } + /// + /// In proto a field mask for `Profile` may look as such: + /// + /// mask { + /// paths: "user.display_name" + /// paths: "photo" + /// } + /// + /// In JSON, the same mask is represented as below: + /// + /// { + /// mask: "user.displayName,photo" + /// } + /// + /// # Field Masks and Oneof Fields + /// + /// Field masks treat fields in oneofs just as regular fields. Consider the + /// following message: + /// + /// message SampleMessage { + /// oneof test_oneof { + /// string name = 4; + /// SubMessage sub_message = 9; + /// } + /// } + /// + /// The field mask can be: + /// + /// mask { + /// paths: "name" + /// } + /// + /// Or: + /// + /// mask { + /// paths: "sub_message" + /// } + /// + /// Note that oneof type names ("test_oneof" in this case) cannot be used in + /// paths. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FieldMask : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new FieldMask()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.FieldMaskReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldMask() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldMask(FieldMask other) : this() { paths_ = other.paths_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public FieldMask Clone() { return new FieldMask(this); } @@ -220,16 +278,19 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField paths_ = new pbc::RepeatedField(); /// - /// The set of field mask paths. + /// The set of field mask paths. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Paths { get { return paths_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as FieldMask); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(FieldMask other) { if (ReferenceEquals(other, null)) { return false; @@ -241,26 +302,31 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= paths_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { paths_.WriteTo(output, _repeated_paths_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += paths_.CalculateSize(_repeated_paths_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(FieldMask other) { if (other == null) { return; @@ -268,6 +334,7 @@ namespace Google.Protobuf.WellKnownTypes { paths_.Add(other.paths_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs old mode 100644 new mode 100755 index 4bd62cf3d4..4b0670f6fd --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/FieldMaskPartial.cs @@ -52,14 +52,19 @@ namespace Google.Protobuf.WellKnownTypes /// /// Paths in the field mask /// Determines the handling of non-normalized values - /// The represented duration is invalid, and is false. + /// The represented field mask is invalid, and is false. internal static string ToJson(IList paths, bool diagnosticOnly) { var firstInvalid = paths.FirstOrDefault(p => !ValidatePath(p)); if (firstInvalid == null) { var writer = new StringWriter(); - JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToCamelCase))); +#if NET35 + var query = paths.Select(JsonFormatter.ToJsonName); + JsonFormatter.WriteString(writer, string.Join(",", query.ToArray())); +#else + JsonFormatter.WriteString(writer, string.Join(",", paths.Select(JsonFormatter.ToJsonName))); +#endif return writer.ToString(); } else @@ -80,9 +85,9 @@ namespace Google.Protobuf.WellKnownTypes } /// - /// Camel-case converter with added strictness for field mask formatting. + /// Checks whether the given path is valid for a field mask. /// - /// The field mask is invalid for JSON representation + /// true if the path is valid; false otherwise private static bool ValidatePath(string input) { for (int i = 0; i < input.Length; i++) diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs index a235ecefa6..6ddadf19ae 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/source_context.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class SourceContextReflection { #region Descriptor @@ -25,9 +24,10 @@ namespace Google.Protobuf.WellKnownTypes { string.Concat( "CiRnb29nbGUvcHJvdG9idWYvc291cmNlX2NvbnRleHQucHJvdG8SD2dvb2ds", "ZS5wcm90b2J1ZiIiCg1Tb3VyY2VDb250ZXh0EhEKCWZpbGVfbmFtZRgBIAEo", - "CUJVChNjb20uZ29vZ2xlLnByb3RvYnVmQhJTb3VyY2VDb250ZXh0UHJvdG9Q", - "AaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", - "cHJvdG8z")); + "CUKVAQoTY29tLmdvb2dsZS5wcm90b2J1ZkISU291cmNlQ29udGV4dFByb3Rv", + "UAFaQWdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL3Byb3RvYnVmL3NvdXJj", + "ZV9jb250ZXh0O3NvdXJjZV9jb250ZXh0ogIDR1BCqgIeR29vZ2xlLlByb3Rv", + "YnVmLldlbGxLbm93blR5cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -39,32 +39,37 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// `SourceContext` represents information about the source of a - /// protobuf element, like the file in which it is defined. + /// `SourceContext` represents information about the source of a + /// protobuf element, like the file in which it is defined. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class SourceContext : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SourceContext()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceContext() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceContext(SourceContext other) : this() { fileName_ = other.fileName_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public SourceContext Clone() { return new SourceContext(this); } @@ -73,9 +78,10 @@ namespace Google.Protobuf.WellKnownTypes { public const int FileNameFieldNumber = 1; private string fileName_ = ""; /// - /// The path-qualified name of the .proto file that contained the associated - /// protobuf element. For example: `"google/protobuf/source.proto"`. + /// The path-qualified name of the .proto file that contained the associated + /// protobuf element. For example: `"google/protobuf/source_context.proto"`. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FileName { get { return fileName_; } set { @@ -83,10 +89,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SourceContext); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(SourceContext other) { if (ReferenceEquals(other, null)) { return false; @@ -98,16 +106,19 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (FileName.Length != 0) hash ^= FileName.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (FileName.Length != 0) { output.WriteRawTag(10); @@ -115,6 +126,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (FileName.Length != 0) { @@ -123,6 +135,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(SourceContext other) { if (other == null) { return; @@ -132,6 +145,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs index edc8940db3..1fa3552155 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/struct.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class StructReflection { #region Descriptor @@ -36,7 +35,7 @@ namespace Google.Protobuf.WellKnownTypes { "Lmdvb2dsZS5wcm90b2J1Zi5WYWx1ZSobCglOdWxsVmFsdWUSDgoKTlVMTF9W", "QUxVRRAAQoEBChNjb20uZ29vZ2xlLnByb3RvYnVmQgtTdHJ1Y3RQcm90b1AB", "WjFnaXRodWIuY29tL2dvbGFuZy9wcm90b2J1Zi9wdHlwZXMvc3RydWN0O3N0", - "cnVjdHBioAEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5", + "cnVjdHBi+AEBogIDR1BCqgIeR29vZ2xlLlByb3RvYnVmLldlbGxLbm93blR5", "cGVzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, @@ -51,14 +50,14 @@ namespace Google.Protobuf.WellKnownTypes { } #region Enums /// - /// `NullValue` is a singleton enumeration to represent the null value for the - /// `Value` type union. + /// `NullValue` is a singleton enumeration to represent the null value for the + /// `Value` type union. /// - /// The JSON representation for `NullValue` is JSON `null`. + /// The JSON representation for `NullValue` is JSON `null`. /// public enum NullValue { /// - /// Null value. + /// Null value. /// [pbr::OriginalName("NULL_VALUE")] NullValue = 0, } @@ -67,38 +66,43 @@ namespace Google.Protobuf.WellKnownTypes { #region Messages /// - /// `Struct` represents a structured data value, consisting of fields - /// which map to dynamically typed values. In some languages, `Struct` - /// might be supported by a native representation. For example, in - /// scripting languages like JS a struct is represented as an - /// object. The details of that representation are described together - /// with the proto support for the language. + /// `Struct` represents a structured data value, consisting of fields + /// which map to dynamically typed values. In some languages, `Struct` + /// might be supported by a native representation. For example, in + /// scripting languages like JS a struct is represented as an + /// object. The details of that representation are described together + /// with the proto support for the language. /// - /// The JSON representation for `Struct` is JSON object. + /// The JSON representation for `Struct` is JSON object. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Struct : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Struct()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Struct() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Struct(Struct other) : this() { fields_ = other.fields_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Struct Clone() { return new Struct(this); } @@ -109,16 +113,19 @@ namespace Google.Protobuf.WellKnownTypes { = new pbc::MapField.Codec(pb::FieldCodec.ForString(10), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 10); private readonly pbc::MapField fields_ = new pbc::MapField(); /// - /// Unordered map of dynamically typed values. + /// Unordered map of dynamically typed values. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField Fields { get { return fields_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Struct); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Struct other) { if (ReferenceEquals(other, null)) { return false; @@ -130,26 +137,31 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= Fields.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { fields_.WriteTo(output, _map_fields_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += fields_.CalculateSize(_map_fields_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Struct other) { if (other == null) { return; @@ -157,6 +169,7 @@ namespace Google.Protobuf.WellKnownTypes { fields_.Add(other.fields_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -175,32 +188,36 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// `Value` represents a dynamically typed value which can be either - /// null, a number, a string, a boolean, a recursive struct value, or a - /// list of values. A producer of value is expected to set one of that - /// variants, absence of any variant indicates an error. + /// `Value` represents a dynamically typed value which can be either + /// null, a number, a string, a boolean, a recursive struct value, or a + /// list of values. A producer of value is expected to set one of that + /// variants, absence of any variant indicates an error. /// - /// The JSON representation for `Value` is JSON value. + /// The JSON representation for `Value` is JSON value. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Value : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Value()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Value() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Value(Value other) : this() { switch (other.KindCase) { case KindOneofCase.NullValue: @@ -225,6 +242,7 @@ namespace Google.Protobuf.WellKnownTypes { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Value Clone() { return new Value(this); } @@ -232,8 +250,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Field number for the "null_value" field. public const int NullValueFieldNumber = 1; /// - /// Represents a null value. + /// Represents a null value. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.NullValue NullValue { get { return kindCase_ == KindOneofCase.NullValue ? (global::Google.Protobuf.WellKnownTypes.NullValue) kind_ : 0; } set { @@ -245,8 +264,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Field number for the "number_value" field. public const int NumberValueFieldNumber = 2; /// - /// Represents a double value. + /// Represents a double value. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double NumberValue { get { return kindCase_ == KindOneofCase.NumberValue ? (double) kind_ : 0D; } set { @@ -258,8 +278,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Field number for the "string_value" field. public const int StringValueFieldNumber = 3; /// - /// Represents a string value. + /// Represents a string value. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string StringValue { get { return kindCase_ == KindOneofCase.StringValue ? (string) kind_ : ""; } set { @@ -271,8 +292,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Field number for the "bool_value" field. public const int BoolValueFieldNumber = 4; /// - /// Represents a boolean value. + /// Represents a boolean value. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool BoolValue { get { return kindCase_ == KindOneofCase.BoolValue ? (bool) kind_ : false; } set { @@ -284,8 +306,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Field number for the "struct_value" field. public const int StructValueFieldNumber = 5; /// - /// Represents a structured value. + /// Represents a structured value. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Struct StructValue { get { return kindCase_ == KindOneofCase.StructValue ? (global::Google.Protobuf.WellKnownTypes.Struct) kind_ : null; } set { @@ -297,8 +320,9 @@ namespace Google.Protobuf.WellKnownTypes { /// Field number for the "list_value" field. public const int ListValueFieldNumber = 6; /// - /// Represents a repeated `Value`. + /// Represents a repeated `Value`. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.ListValue ListValue { get { return kindCase_ == KindOneofCase.ListValue ? (global::Google.Protobuf.WellKnownTypes.ListValue) kind_ : null; } set { @@ -319,19 +343,23 @@ namespace Google.Protobuf.WellKnownTypes { ListValue = 6, } private KindOneofCase kindCase_ = KindOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public KindOneofCase KindCase { get { return kindCase_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearKind() { kindCase_ = KindOneofCase.None; kind_ = null; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Value); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Value other) { if (ReferenceEquals(other, null)) { return false; @@ -349,6 +377,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (kindCase_ == KindOneofCase.NullValue) hash ^= NullValue.GetHashCode(); @@ -361,10 +390,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (kindCase_ == KindOneofCase.NullValue) { output.WriteRawTag(8); @@ -392,6 +423,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (kindCase_ == KindOneofCase.NullValue) { @@ -415,6 +447,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Value other) { if (other == null) { return; @@ -442,6 +475,7 @@ namespace Google.Protobuf.WellKnownTypes { } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -491,33 +525,38 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// `ListValue` is a wrapper around a repeated field of values. + /// `ListValue` is a wrapper around a repeated field of values. /// - /// The JSON representation for `ListValue` is JSON array. + /// The JSON representation for `ListValue` is JSON array. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ListValue : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ListValue()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ListValue() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ListValue(ListValue other) : this() { values_ = other.values_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ListValue Clone() { return new ListValue(this); } @@ -528,16 +567,19 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(10, global::Google.Protobuf.WellKnownTypes.Value.Parser); private readonly pbc::RepeatedField values_ = new pbc::RepeatedField(); /// - /// Repeated field of dynamically typed values. + /// Repeated field of dynamically typed values. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Values { get { return values_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ListValue); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ListValue other) { if (ReferenceEquals(other, null)) { return false; @@ -549,26 +591,31 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= values_.GetHashCode(); return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { values_.WriteTo(output, _repeated_values_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += values_.CalculateSize(_repeated_values_codec); return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ListValue other) { if (other == null) { return; @@ -576,6 +623,7 @@ namespace Google.Protobuf.WellKnownTypes { values_.Add(other.values_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs index dd485d324a..8b63d63035 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/TimeExtensions.cs @@ -31,10 +31,6 @@ #endregion using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Google.Protobuf.WellKnownTypes { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs index 053b88bd33..911f797e01 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/timestamp.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class TimestampReflection { #region Descriptor @@ -25,10 +24,10 @@ namespace Google.Protobuf.WellKnownTypes { string.Concat( "Ch9nb29nbGUvcHJvdG9idWYvdGltZXN0YW1wLnByb3RvEg9nb29nbGUucHJv", "dG9idWYiKwoJVGltZXN0YW1wEg8KB3NlY29uZHMYASABKAMSDQoFbmFub3MY", - "AiABKAVCgQEKE2NvbS5nb29nbGUucHJvdG9idWZCDlRpbWVzdGFtcFByb3Rv", - "UAFaK2dpdGh1Yi5jb20vZ29sYW5nL3Byb3RvYnVmL3B0eXBlcy90aW1lc3Rh", - "bXCgAQH4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2VsbEtub3duVHlw", - "ZXNiBnByb3RvMw==")); + "AiABKAVCfgoTY29tLmdvb2dsZS5wcm90b2J1ZkIOVGltZXN0YW1wUHJvdG9Q", + "AVorZ2l0aHViLmNvbS9nb2xhbmcvcHJvdG9idWYvcHR5cGVzL3RpbWVzdGFt", + "cPgBAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25vd25UeXBlc2IG", + "cHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { @@ -40,83 +39,111 @@ namespace Google.Protobuf.WellKnownTypes { } #region Messages /// - /// A Timestamp represents a point in time independent of any time zone - /// or calendar, represented as seconds and fractions of seconds at - /// nanosecond resolution in UTC Epoch time. It is encoded using the - /// Proleptic Gregorian Calendar which extends the Gregorian calendar - /// backwards to year one. It is encoded assuming all minutes are 60 - /// seconds long, i.e. leap seconds are "smeared" so that no leap second - /// table is needed for interpretation. Range is from - /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. - /// By restricting to that range, we ensure that we can convert to - /// and from RFC 3339 date strings. - /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). + /// A Timestamp represents a point in time independent of any time zone + /// or calendar, represented as seconds and fractions of seconds at + /// nanosecond resolution in UTC Epoch time. It is encoded using the + /// Proleptic Gregorian Calendar which extends the Gregorian calendar + /// backwards to year one. It is encoded assuming all minutes are 60 + /// seconds long, i.e. leap seconds are "smeared" so that no leap second + /// table is needed for interpretation. Range is from + /// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. + /// By restricting to that range, we ensure that we can convert to + /// and from RFC 3339 date strings. + /// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). /// - /// Example 1: Compute Timestamp from POSIX `time()`. + /// # Examples /// - /// Timestamp timestamp; - /// timestamp.set_seconds(time(NULL)); - /// timestamp.set_nanos(0); + /// Example 1: Compute Timestamp from POSIX `time()`. /// - /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. + /// Timestamp timestamp; + /// timestamp.set_seconds(time(NULL)); + /// timestamp.set_nanos(0); /// - /// struct timeval tv; - /// gettimeofday(&tv, NULL); + /// Example 2: Compute Timestamp from POSIX `gettimeofday()`. /// - /// Timestamp timestamp; - /// timestamp.set_seconds(tv.tv_sec); - /// timestamp.set_nanos(tv.tv_usec * 1000); + /// struct timeval tv; + /// gettimeofday(&tv, NULL); /// - /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + /// Timestamp timestamp; + /// timestamp.set_seconds(tv.tv_sec); + /// timestamp.set_nanos(tv.tv_usec * 1000); /// - /// FILETIME ft; - /// GetSystemTimeAsFileTime(&ft); - /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + /// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. /// - /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - /// Timestamp timestamp; - /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + /// FILETIME ft; + /// GetSystemTimeAsFileTime(&ft); + /// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; /// - /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + /// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + /// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + /// Timestamp timestamp; + /// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + /// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); /// - /// long millis = System.currentTimeMillis(); + /// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. /// - /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - /// .setNanos((int) ((millis % 1000) * 1000000)).build(); + /// long millis = System.currentTimeMillis(); /// - /// Example 5: Compute Timestamp from current time in Python. + /// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + /// .setNanos((int) ((millis % 1000) * 1000000)).build(); /// - /// now = time.time() - /// seconds = int(now) - /// nanos = int((now - seconds) * 10**9) - /// timestamp = Timestamp(seconds=seconds, nanos=nanos) + /// Example 5: Compute Timestamp from current time in Python. + /// + /// timestamp = Timestamp() + /// timestamp.GetCurrentTime() + /// + /// # JSON Mapping + /// + /// In JSON format, the Timestamp type is encoded as a string in the + /// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + /// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + /// where {year} is always expressed using four digits while {month}, {day}, + /// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + /// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + /// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + /// is required, though only UTC (as indicated by "Z") is presently supported. + /// + /// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + /// 01:30 UTC on January 15, 2017. + /// + /// In JavaScript, one can convert a Date object to this format using the + /// standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] + /// method. In Python, a standard `datetime.datetime` object can be converted + /// to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) + /// with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one + /// can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( + /// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) + /// to obtain a formatter capable of generating timestamps in this format. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Timestamp : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Timestamp()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Timestamp() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Timestamp(Timestamp other) : this() { seconds_ = other.seconds_; nanos_ = other.nanos_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Timestamp Clone() { return new Timestamp(this); } @@ -125,10 +152,11 @@ namespace Google.Protobuf.WellKnownTypes { public const int SecondsFieldNumber = 1; private long seconds_; /// - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public long Seconds { get { return seconds_; } set { @@ -140,11 +168,12 @@ namespace Google.Protobuf.WellKnownTypes { public const int NanosFieldNumber = 2; private int nanos_; /// - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Nanos { get { return nanos_; } set { @@ -152,10 +181,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Timestamp); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Timestamp other) { if (ReferenceEquals(other, null)) { return false; @@ -168,6 +199,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Seconds != 0L) hash ^= Seconds.GetHashCode(); @@ -175,10 +207,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Seconds != 0L) { output.WriteRawTag(8); @@ -190,6 +224,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Seconds != 0L) { @@ -201,6 +236,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Timestamp other) { if (other == null) { return; @@ -213,6 +249,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { diff --git a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs index 657c24645b..7375b6cb18 100644 --- a/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs +++ b/packager/third_party/protobuf/csharp/src/Google.Protobuf/WellKnownTypes/Type.cs @@ -10,7 +10,6 @@ using scg = global::System.Collections.Generic; namespace Google.Protobuf.WellKnownTypes { /// Holder for reflection information generated from google/protobuf/type.proto - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class TypeReflection { #region Descriptor @@ -55,9 +54,10 @@ namespace Google.Protobuf.WellKnownTypes { "ASgFEigKB29wdGlvbnMYAyADKAsyFy5nb29nbGUucHJvdG9idWYuT3B0aW9u", "IjsKBk9wdGlvbhIMCgRuYW1lGAEgASgJEiMKBXZhbHVlGAIgASgLMhQuZ29v", "Z2xlLnByb3RvYnVmLkFueSouCgZTeW50YXgSEQoNU1lOVEFYX1BST1RPMhAA", - "EhEKDVNZTlRBWF9QUk9UTzMQAUJMChNjb20uZ29vZ2xlLnByb3RvYnVmQglU", - "eXBlUHJvdG9QAaABAaICA0dQQqoCHkdvb2dsZS5Qcm90b2J1Zi5XZWxsS25v", - "d25UeXBlc2IGcHJvdG8z")); + "EhEKDVNZTlRBWF9QUk9UTzMQAUJ9ChNjb20uZ29vZ2xlLnByb3RvYnVmQglU", + "eXBlUHJvdG9QAVovZ29vZ2xlLmdvbGFuZy5vcmcvZ2VucHJvdG8vcHJvdG9i", + "dWYvcHR5cGU7cHR5cGX4AQGiAgNHUEKqAh5Hb29nbGUuUHJvdG9idWYuV2Vs", + "bEtub3duVHlwZXNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.SourceContextReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.WellKnownTypes.Syntax), }, new pbr::GeneratedClrTypeInfo[] { @@ -73,15 +73,15 @@ namespace Google.Protobuf.WellKnownTypes { } #region Enums /// - /// The syntax in which a protocol buffer element is defined. + /// The syntax in which a protocol buffer element is defined. /// public enum Syntax { /// - /// Syntax `proto2`. + /// Syntax `proto2`. /// [pbr::OriginalName("SYNTAX_PROTO2")] Proto2 = 0, /// - /// Syntax `proto3`. + /// Syntax `proto3`. /// [pbr::OriginalName("SYNTAX_PROTO3")] Proto3 = 1, } @@ -90,27 +90,31 @@ namespace Google.Protobuf.WellKnownTypes { #region Messages /// - /// A protocol buffer message type. + /// A protocol buffer message type. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Type : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Type()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[0]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Type() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Type(Type other) : this() { name_ = other.name_; fields_ = other.fields_.Clone(); @@ -120,6 +124,7 @@ namespace Google.Protobuf.WellKnownTypes { syntax_ = other.syntax_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Type Clone() { return new Type(this); } @@ -128,8 +133,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// The fully qualified message name. + /// The fully qualified message name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -143,8 +149,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Field.Parser); private readonly pbc::RepeatedField fields_ = new pbc::RepeatedField(); /// - /// The list of fields. + /// The list of fields. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Fields { get { return fields_; } } @@ -155,8 +162,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForString(26); private readonly pbc::RepeatedField oneofs_ = new pbc::RepeatedField(); /// - /// The list of types appearing in `oneof` definitions in this type. + /// The list of types appearing in `oneof` definitions in this type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Oneofs { get { return oneofs_; } } @@ -167,8 +175,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(34, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// The protocol buffer options. + /// The protocol buffer options. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { get { return options_; } } @@ -177,8 +186,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int SourceContextFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; /// - /// The source context. + /// The source context. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { get { return sourceContext_; } set { @@ -190,8 +200,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int SyntaxFieldNumber = 6; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax. + /// The source syntax. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { get { return syntax_; } set { @@ -199,10 +210,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Type); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Type other) { if (ReferenceEquals(other, null)) { return false; @@ -219,6 +232,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -230,10 +244,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -252,6 +268,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -269,6 +286,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Type other) { if (other == null) { return; @@ -290,6 +308,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -331,27 +350,31 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// A single field of a message type. + /// A single field of a message type. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Field : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Field()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[1]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Field() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Field(Field other) : this() { kind_ = other.kind_; cardinality_ = other.cardinality_; @@ -365,6 +388,7 @@ namespace Google.Protobuf.WellKnownTypes { defaultValue_ = other.defaultValue_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Field Clone() { return new Field(this); } @@ -373,8 +397,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int KindFieldNumber = 1; private global::Google.Protobuf.WellKnownTypes.Field.Types.Kind kind_ = 0; /// - /// The field type. + /// The field type. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Field.Types.Kind Kind { get { return kind_; } set { @@ -386,8 +411,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int CardinalityFieldNumber = 2; private global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality cardinality_ = 0; /// - /// The field cardinality. + /// The field cardinality. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality Cardinality { get { return cardinality_; } set { @@ -399,8 +425,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NumberFieldNumber = 3; private int number_; /// - /// The field number. + /// The field number. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { get { return number_; } set { @@ -412,8 +439,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 4; private string name_ = ""; /// - /// The field name. + /// The field name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -425,9 +453,10 @@ namespace Google.Protobuf.WellKnownTypes { public const int TypeUrlFieldNumber = 6; private string typeUrl_ = ""; /// - /// The field type URL, without the scheme, for message or enumeration - /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + /// The field type URL, without the scheme, for message or enumeration + /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TypeUrl { get { return typeUrl_; } set { @@ -439,9 +468,10 @@ namespace Google.Protobuf.WellKnownTypes { public const int OneofIndexFieldNumber = 7; private int oneofIndex_; /// - /// The index of the field type in `Type.oneofs`, for message or enumeration - /// types. The first type has index 1; zero means the type is not in the list. + /// The index of the field type in `Type.oneofs`, for message or enumeration + /// types. The first type has index 1; zero means the type is not in the list. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OneofIndex { get { return oneofIndex_; } set { @@ -453,8 +483,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int PackedFieldNumber = 8; private bool packed_; /// - /// Whether to use alternative packed wire representation. + /// Whether to use alternative packed wire representation. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Packed { get { return packed_; } set { @@ -468,8 +499,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(74, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// The protocol buffer options. + /// The protocol buffer options. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { get { return options_; } } @@ -478,8 +510,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int JsonNameFieldNumber = 10; private string jsonName_ = ""; /// - /// The field JSON name. + /// The field JSON name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string JsonName { get { return jsonName_; } set { @@ -491,8 +524,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int DefaultValueFieldNumber = 11; private string defaultValue_ = ""; /// - /// The string value of the default value of this field. Proto2 syntax only. + /// The string value of the default value of this field. Proto2 syntax only. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DefaultValue { get { return defaultValue_; } set { @@ -500,10 +534,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Field); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Field other) { if (ReferenceEquals(other, null)) { return false; @@ -524,6 +560,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Kind != 0) hash ^= Kind.GetHashCode(); @@ -539,10 +576,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Kind != 0) { output.WriteRawTag(8); @@ -583,6 +622,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Kind != 0) { @@ -616,6 +656,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Field other) { if (other == null) { return; @@ -650,6 +691,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -703,108 +745,108 @@ namespace Google.Protobuf.WellKnownTypes { #region Nested types /// Container for nested types declared in the Field message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// - /// Basic field types. + /// Basic field types. /// public enum Kind { /// - /// Field type unknown. + /// Field type unknown. /// [pbr::OriginalName("TYPE_UNKNOWN")] TypeUnknown = 0, /// - /// Field type double. + /// Field type double. /// [pbr::OriginalName("TYPE_DOUBLE")] TypeDouble = 1, /// - /// Field type float. + /// Field type float. /// [pbr::OriginalName("TYPE_FLOAT")] TypeFloat = 2, /// - /// Field type int64. + /// Field type int64. /// [pbr::OriginalName("TYPE_INT64")] TypeInt64 = 3, /// - /// Field type uint64. + /// Field type uint64. /// [pbr::OriginalName("TYPE_UINT64")] TypeUint64 = 4, /// - /// Field type int32. + /// Field type int32. /// [pbr::OriginalName("TYPE_INT32")] TypeInt32 = 5, /// - /// Field type fixed64. + /// Field type fixed64. /// [pbr::OriginalName("TYPE_FIXED64")] TypeFixed64 = 6, /// - /// Field type fixed32. + /// Field type fixed32. /// [pbr::OriginalName("TYPE_FIXED32")] TypeFixed32 = 7, /// - /// Field type bool. + /// Field type bool. /// [pbr::OriginalName("TYPE_BOOL")] TypeBool = 8, /// - /// Field type string. + /// Field type string. /// [pbr::OriginalName("TYPE_STRING")] TypeString = 9, /// - /// Field type group. Proto2 syntax only, and deprecated. + /// Field type group. Proto2 syntax only, and deprecated. /// [pbr::OriginalName("TYPE_GROUP")] TypeGroup = 10, /// - /// Field type message. + /// Field type message. /// [pbr::OriginalName("TYPE_MESSAGE")] TypeMessage = 11, /// - /// Field type bytes. + /// Field type bytes. /// [pbr::OriginalName("TYPE_BYTES")] TypeBytes = 12, /// - /// Field type uint32. + /// Field type uint32. /// [pbr::OriginalName("TYPE_UINT32")] TypeUint32 = 13, /// - /// Field type enum. + /// Field type enum. /// [pbr::OriginalName("TYPE_ENUM")] TypeEnum = 14, /// - /// Field type sfixed32. + /// Field type sfixed32. /// [pbr::OriginalName("TYPE_SFIXED32")] TypeSfixed32 = 15, /// - /// Field type sfixed64. + /// Field type sfixed64. /// [pbr::OriginalName("TYPE_SFIXED64")] TypeSfixed64 = 16, /// - /// Field type sint32. + /// Field type sint32. /// [pbr::OriginalName("TYPE_SINT32")] TypeSint32 = 17, /// - /// Field type sint64. + /// Field type sint64. /// [pbr::OriginalName("TYPE_SINT64")] TypeSint64 = 18, } /// - /// Whether a field is optional, required, or repeated. + /// Whether a field is optional, required, or repeated. /// public enum Cardinality { /// - /// For fields with unknown cardinality. + /// For fields with unknown cardinality. /// [pbr::OriginalName("CARDINALITY_UNKNOWN")] Unknown = 0, /// - /// For optional fields. + /// For optional fields. /// [pbr::OriginalName("CARDINALITY_OPTIONAL")] Optional = 1, /// - /// For required fields. Proto2 syntax only. + /// For required fields. Proto2 syntax only. /// [pbr::OriginalName("CARDINALITY_REQUIRED")] Required = 2, /// - /// For repeated fields. + /// For repeated fields. /// [pbr::OriginalName("CARDINALITY_REPEATED")] Repeated = 3, } @@ -815,27 +857,31 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// Enum type definition. + /// Enum type definition. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Enum : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Enum()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[2]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Enum() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Enum(Enum other) : this() { name_ = other.name_; enumvalue_ = other.enumvalue_.Clone(); @@ -844,6 +890,7 @@ namespace Google.Protobuf.WellKnownTypes { syntax_ = other.syntax_; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Enum Clone() { return new Enum(this); } @@ -852,8 +899,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// Enum type name. + /// Enum type name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -867,8 +915,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.EnumValue.Parser); private readonly pbc::RepeatedField enumvalue_ = new pbc::RepeatedField(); /// - /// Enum value definitions. + /// Enum value definitions. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Enumvalue { get { return enumvalue_; } } @@ -879,8 +928,9 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Protocol buffer options. + /// Protocol buffer options. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { get { return options_; } } @@ -889,8 +939,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int SourceContextFieldNumber = 4; private global::Google.Protobuf.WellKnownTypes.SourceContext sourceContext_; /// - /// The source context. + /// The source context. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.SourceContext SourceContext { get { return sourceContext_; } set { @@ -902,8 +953,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int SyntaxFieldNumber = 5; private global::Google.Protobuf.WellKnownTypes.Syntax syntax_ = 0; /// - /// The source syntax. + /// The source syntax. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Syntax Syntax { get { return syntax_; } set { @@ -911,10 +963,12 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Enum); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Enum other) { if (ReferenceEquals(other, null)) { return false; @@ -930,6 +984,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -940,10 +995,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -961,6 +1018,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -977,6 +1035,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Enum other) { if (other == null) { return; @@ -997,6 +1056,7 @@ namespace Google.Protobuf.WellKnownTypes { } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1034,33 +1094,38 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// Enum value definition. + /// Enum value definition. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class EnumValue : pb::IMessage { private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new EnumValue()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser Parser { get { return _parser; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Protobuf.WellKnownTypes.TypeReflection.Descriptor.MessageTypes[3]; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValue() { OnConstruction(); } partial void OnConstruction(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValue(EnumValue other) : this() { name_ = other.name_; number_ = other.number_; options_ = other.options_.Clone(); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public EnumValue Clone() { return new EnumValue(this); } @@ -1069,8 +1134,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NameFieldNumber = 1; private string name_ = ""; /// - /// Enum value name. + /// Enum value name. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { @@ -1082,8 +1148,9 @@ namespace Google.Protobuf.WellKnownTypes { public const int NumberFieldNumber = 2; private int number_; /// - /// Enum value number. + /// Enum value number. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Number { get { return number_; } set { @@ -1097,16 +1164,19 @@ namespace Google.Protobuf.WellKnownTypes { = pb::FieldCodec.ForMessage(26, global::Google.Protobuf.WellKnownTypes.Option.Parser); private readonly pbc::RepeatedField options_ = new pbc::RepeatedField(); /// - /// Protocol buffer options. + /// Protocol buffer options. /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField Options { get { return options_; } } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as EnumValue); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(EnumValue other) { if (ReferenceEquals(other, null)) { return false; @@ -1120,6 +1190,7 @@ namespace Google.Protobuf.WellKnownTypes { return true; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); @@ -1128,10 +1199,12 @@ namespace Google.Protobuf.WellKnownTypes { return hash; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { if (Name.Length != 0) { output.WriteRawTag(10); @@ -1144,6 +1217,7 @@ namespace Google.Protobuf.WellKnownTypes { options_.WriteTo(output, _repeated_options_codec); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { @@ -1156,6 +1230,7 @@ namespace Google.Protobuf.WellKnownTypes { return size; } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(EnumValue other) { if (other == null) { return; @@ -1169,6 +1244,7 @@ namespace Google.Protobuf.WellKnownTypes { options_.Add(other.options_); } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { @@ -1195,33 +1271,38 @@ namespace Google.Protobuf.WellKnownTypes { } /// - /// A protocol buffer option, which can be attached to a message, field, - /// enumeration, etc. + /// A protocol buffer option, which can be attached to a message, field, + /// enumeration, etc. /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Option : pb::IMessage