Merge branch '3.16.x' into merge-3-16-x
diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml
index aa4820b..895b65a 100644
--- a/.github/workflows/codespell.yml
+++ b/.github/workflows/codespell.yml
@@ -12,5 +12,5 @@
- uses: codespell-project/actions-codespell@master
with:
check_filenames: true
- skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal
+ skip: ./.git,./conformance/third_party,*.snk,*.pb,*.pb.cc,*.pb.h,./src/google/protobuf/testdata,./objectivec/Tests,./python/compatibility_tests/v2.5.0/tests/google/protobuf/internal,./github/workflows/codespell.yml
ignore_words_list: "alow,alse,ba,cleare,copyable,cloneable,dedup,dur,errorprone,files',fo,fundementals,hel,importd,inout,leapyear,nd,nin,ois,ons,parseable,process',te,testof,ue,unparseable,wasn,wee,gae,keyserver,objext,od,optin"
diff --git a/BUILD b/BUILD
index 07ee629..078f943 100644
--- a/BUILD
+++ b/BUILD
@@ -4,6 +4,7 @@
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("@rules_python//python:defs.bzl", "py_library")
+load("@rules_java//java:defs.bzl", "java_binary", "java_proto_library", "java_lite_proto_library")
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
licenses(["notice"])
@@ -369,6 +370,7 @@
"src/google/protobuf/compiler/cpp/cpp_message.cc",
"src/google/protobuf/compiler/cpp/cpp_message_field.cc",
"src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc",
+ "src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc",
"src/google/protobuf/compiler/cpp/cpp_primitive_field.cc",
"src/google/protobuf/compiler/cpp/cpp_service.cc",
"src/google/protobuf/compiler/cpp/cpp_string_field.cc",
@@ -401,6 +403,7 @@
"src/google/protobuf/compiler/java/java_generator.cc",
"src/google/protobuf/compiler/java/java_generator_factory.cc",
"src/google/protobuf/compiler/java/java_helpers.cc",
+ "src/google/protobuf/compiler/java/java_kotlin_generator.cc",
"src/google/protobuf/compiler/java/java_map_field.cc",
"src/google/protobuf/compiler/java/java_map_field_lite.cc",
"src/google/protobuf/compiler/java/java_message.cc",
@@ -457,6 +460,12 @@
# Tests
################################################################################
+filegroup(
+ name = "testdata",
+ visibility = ["//:__subpackages__"],
+ srcs = glob(["src/google/protobuf/testdata/**/*"]),
+)
+
RELATIVE_LITE_TEST_PROTOS = [
# AUTOGEN(lite_test_protos)
"google/protobuf/map_lite_unittest.proto",
@@ -518,6 +527,57 @@
TEST_PROTOS = ["src/" + s for s in RELATIVE_TEST_PROTOS]
+GENERIC_RELATIVE_TEST_PROTOS = [
+ "google/protobuf/unittest.proto",
+ "google/protobuf/unittest_arena.proto",
+ "google/protobuf/unittest_custom_options.proto",
+ "google/protobuf/unittest_drop_unknown_fields.proto",
+ "google/protobuf/unittest_embed_optimize_for.proto",
+ "google/protobuf/unittest_empty.proto",
+ "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",
+ "google/protobuf/unittest_no_field_presence.proto",
+ "google/protobuf/unittest_no_generic_services.proto",
+ "google/protobuf/unittest_optimize_for.proto",
+ "google/protobuf/unittest_preserve_unknown_enum.proto",
+ "google/protobuf/unittest_preserve_unknown_enum2.proto",
+ "google/protobuf/unittest_proto3.proto",
+ "google/protobuf/unittest_proto3_arena.proto",
+ "google/protobuf/unittest_proto3_arena_lite.proto",
+ "google/protobuf/unittest_proto3_lite.proto",
+ "google/protobuf/unittest_proto3_optional.proto",
+ "google/protobuf/unittest_well_known_types.proto",
+]
+
+GENERIC_TEST_PROTOS = ["src/" + s for s in GENERIC_RELATIVE_TEST_PROTOS]
+
+proto_library(
+ name = "generic_test_protos",
+ visibility = ["//:__subpackages__"],
+ strip_import_prefix = "src",
+ srcs = LITE_TEST_PROTOS + GENERIC_TEST_PROTOS,
+ deps = [
+ "//:any_proto",
+ "//:api_proto",
+ "//:descriptor_proto",
+ "//:duration_proto",
+ "//:empty_proto",
+ "//:field_mask_proto",
+ "//:source_context_proto",
+ "//:struct_proto",
+ "//:timestamp_proto",
+ "//:type_proto",
+ "//:wrappers_proto",
+ ],
+)
+
cc_proto_library(
name = "cc_test_protos",
srcs = LITE_TEST_PROTOS + TEST_PROTOS,
@@ -684,6 +744,15 @@
],
)
+internal_gen_well_known_protos_java(
+ name = "gen_well_known_protos_javalite",
+ deps = [proto + "_proto" for proto in WELL_KNOWN_PROTO_MAP.keys()],
+ javalite = True,
+ visibility = [
+ "//java:__subpackages__",
+ ],
+)
+
alias(
name = "protobuf_java",
actual = "//java/core",
@@ -1110,3 +1179,91 @@
"update_file_lists.sh",
],
)
+
+java_proto_library(
+ name = "test_messages_proto2_java_proto",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = [":test_messages_proto2_proto"],
+)
+
+java_proto_library(
+ name = "test_messages_proto3_java_proto",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = [":test_messages_proto3_proto"],
+)
+
+java_proto_library(
+ name = "conformance_java_proto",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = [":conformance_proto"],
+)
+
+java_lite_proto_library(
+ name = "test_messages_proto2_java_proto_lite",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = [":test_messages_proto2_proto"],
+)
+
+java_lite_proto_library(
+ name = "conformance_java_proto_lite",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = [":conformance_proto"],
+)
+
+java_lite_proto_library(
+ name = "test_messages_proto3_java_proto_lite",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = [":test_messages_proto3_proto"],
+)
+
+java_binary(
+ name = "conformance_java",
+ srcs = ["conformance/ConformanceJava.java"],
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ main_class = "ConformanceJava",
+ deps = [
+ ":conformance_java_proto",
+ ":test_messages_proto2_java_proto",
+ ":test_messages_proto3_java_proto",
+ "//:protobuf_java",
+ "//:protobuf_java_util",
+ ],
+)
+
+java_binary(
+ name = "conformance_java_lite",
+ srcs = ["conformance/ConformanceJavaLite.java"],
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ main_class = "ConformanceJavaLite",
+ deps = [
+ ":conformance_java_proto_lite",
+ ":test_messages_proto2_java_proto_lite",
+ ":test_messages_proto3_java_proto_lite",
+ "//:protobuf_javalite",
+ "//:protobuf_java_util",
+ ],
+)
+
+exports_files([
+ "conformance/conformance_test_runner.sh",
+ "conformance/failure_list_java.txt",
+ "conformance/failure_list_java_lite.txt",
+ "conformance/text_format_failure_list_java.txt",
+ "conformance/text_format_failure_list_java_lite.txt",
+])
diff --git a/CHANGES.txt b/CHANGES.txt
index 1805c9a..91d0b75 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,34 @@
+Unreleased Changes (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Protocol Compiler
+ * Fix the generated source information for reserved values in Enums.
+
+ C++
+ * Fix bug where `Descriptor::DebugString()` printed proto3 synthetic oneofs.
+ * Provide stable versions of `SortAndUnique()`.
+ * Make sure to cache proto3 optional message fields when they are cleared.
+ * Expose UnsafeArena methods to Reflection.
+ * Use std::string::empty() rather than std::string::size() > 0.
+
+ Kotlin
+ * Restrict extension setter and getter operators to non-nullable T.
+
+ Java
+ * Reduce the time spent evaluating isExtensionNumber by storing the extension
+ ranges in a TreeMap for faster queries. This is particularly relevant for
+ protos which define a large number of extension ranges, for example when
+ each tag is defined as an extension.
+ * Fix java bytecode estimation logic for optional fields.
+ * Optimize Descriptor.isExtensionNumber.
+
+ Python
+ * Make JSON parsing match C++ and Java when multiple fields from the same
+ oneof are present and all but one is null.
+
+ Conformance Tests
+ * Added a conformance test for the case of multiple fields from the same
+ oneof.
+
2021-04-06 version 3.16.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
C++
@@ -83,6 +114,11 @@
* add error returns missing from protoc to prevent it from exiting with… (#8409)
+2021-04-07 version 3.15.8 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+ Ruby
+ * Fixed memory leak of Ruby arena objects (#8461)
+
2021-04-02 version 3.15.7 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
C++
diff --git a/Makefile.am b/Makefile.am
index 9151842..cab595d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -530,6 +530,37 @@
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/wrappers_test.proto \
+ java/internal/BUILD \
+ java/internal/testing.bzl \
+ java/kotlin/generate-sources-build.xml \
+ java/kotlin/generate-test-sources-build.xml \
+ java/kotlin/pom.xml \
+ java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt \
+ java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt \
+ java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt \
+ java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt \
+ java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt\
+ java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt \
+ java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt\
+ java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt \
+ java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt \
+ java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt \
+ java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt \
+ java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt\
+ java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt \
+ java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt \
+ java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt \
+ java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto \
+ java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto \
+ java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto \
+ java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto \
+ java/kotlin-lite/generate-sources-build.xml \
+ java/kotlin-lite/generate-test-sources-build.xml \
+ java/kotlin-lite/lite.awk \
+ java/kotlin-lite/pom.xml \
+ java/kotlin-lite/process-lite-sources-build.xml \
+ java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt\
+ java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt \
java/lite.md \
java/lite/BUILD \
java/lite/generate-sources-build.xml \
@@ -539,6 +570,7 @@
java/lite/process-lite-sources-build.xml \
java/lite/src/test/java/com/google/protobuf/LiteTest.java \
java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java \
+ java/BUILD \
java/pom.xml \
java/util/BUILD \
java/util/pom.xml \
@@ -792,7 +824,7 @@
php/ext/google/protobuf/protobuf.h \
php/ext/google/protobuf/wkt.inc \
php/generate_descriptor_protos.sh \
- php/phpunit.xml \
+ php/generate_test_protos.sh \
php/prepare_c_extension.sh \
php/release.sh \
php/src/GPBMetadata/Google/Protobuf/Any.php \
@@ -921,14 +953,12 @@
php/src/Google/Protobuf/Value.php \
php/src/phpdoc.dist.xml \
php/tests/ArrayTest.php \
- php/tests/autoload.php \
- php/tests/bootstrap_phpunit.php \
php/tests/compatibility_test.sh \
php/tests/compile_extension.sh \
php/tests/DescriptorsTest.php \
php/tests/EncodeDecodeTest.php \
+ php/tests/force_c_ext.php \
php/tests/gdb_test.sh \
- php/tests/generate_protos.sh \
php/tests/GeneratedClassTest.php \
php/tests/GeneratedPhpdocTest.php \
php/tests/GeneratedServiceTest.php \
@@ -955,10 +985,8 @@
php/tests/proto/test_service.proto \
php/tests/proto/test_service_namespace.proto \
php/tests/proto/test_wrapper_type_setters.proto \
- php/tests/test.sh \
php/tests/test_base.php \
php/tests/test_util.php \
- php/tests/undefined_test.php \
php/tests/valgrind.supp \
php/tests/WellKnownTest.php \
php/tests/WrapperTypeSettersTest.php
@@ -1008,7 +1036,6 @@
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 \
@@ -1029,7 +1056,6 @@
python/google/protobuf/json_format.py \
python/google/protobuf/message.py \
python/google/protobuf/message_factory.py \
- python/google/protobuf/python_protobuf.h \
python/google/protobuf/proto_api.h \
python/google/protobuf/proto_builder.py \
python/google/protobuf/pyext/README \
diff --git a/WORKSPACE b/WORKSPACE
index 4346dbd..3b78ba1 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -26,64 +26,73 @@
],
)
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-load("//:protobuf_deps.bzl", "protobuf_deps")
-
# Load common dependencies.
+load("//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
-load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")
bind(
name = "python_headers",
actual = "//util/python:python_headers",
)
-jvm_maven_import_external(
- name = "guava_maven",
- artifact = "com.google.guava:guava:18.0",
- artifact_sha256 = "d664fbfc03d2e5ce9cab2a44fb01f1d0bf9dfebeccc1a473b1f9ea31f79f6f99",
- server_urls = [
- "https://jcenter.bintray.com/",
- "https://repo1.maven.org/maven2",
+load("@rules_jvm_external//:defs.bzl", "maven_install")
+maven_install(
+ artifacts = [
+ "com.google.guava:guava:30.1.1-jre",
+ "com.google.code.gson:gson:2.8.6",
+ "com.google.errorprone:error_prone_annotations:2.3.2",
+ "junit:junit:4.12",
+ "org.easymock:easymock:3.2",
+ "org.easymock:easymockclassextension:3.2",
+ "com.google.truth:truth:1.1.2",
],
+ repositories = [
+ "https://repo1.maven.org/maven2",
+ "https://repo.maven.apache.org/maven2",
+ ],
+ # For updating instructions, see:
+ # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson
+ maven_install_json = "//:maven_install.json",
)
+load("@maven//:defs.bzl", "pinned_maven_install")
+pinned_maven_install()
+
bind(
name = "guava",
- actual = "@guava_maven//jar",
-)
-
-jvm_maven_import_external(
- name = "gson_maven",
- artifact = "com.google.code.gson:gson:2.7",
- artifact_sha256 = "2d43eb5ea9e133d2ee2405cc14f5ee08951b8361302fdd93494a3a997b508d32",
- server_urls = [
- "https://jcenter.bintray.com/",
- "https://repo1.maven.org/maven2",
- ],
+ actual = "@maven//:com_google_guava_guava",
)
bind(
name = "gson",
- actual = "@gson_maven//jar",
-)
-
-jvm_maven_import_external(
- name = "error_prone_annotations_maven",
- artifact = "com.google.errorprone:error_prone_annotations:2.3.2",
- artifact_sha256 = "357cd6cfb067c969226c442451502aee13800a24e950fdfde77bcdb4565a668d",
- server_urls = [
- "https://jcenter.bintray.com/",
- "https://repo1.maven.org/maven2",
- ],
+ actual = "@maven//:com_google_code_gson_gson",
)
bind(
name = "error_prone_annotations",
- actual = "@error_prone_annotations_maven//jar",
+ actual = "@maven//:com_google_errorprone_error_prone_annotations",
)
-# For `cc_proto_blacklist_test`.
-load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
+bind(
+ name = "junit",
+ actual = "@maven//:junit_junit",
+)
+bind(
+ name = "easymock",
+ actual = "@maven//:org_easymock_easymock",
+)
+
+bind(
+ name = "easymock_classextension",
+ actual = "@maven//:org_easymock_easymockclassextension",
+)
+
+bind(
+ name = "truth",
+ actual = "@maven//:com_google_truth_truth",
+)
+
+# For `cc_proto_blacklist_test` and `build_test`.
+load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
diff --git a/build_files_updated_unittest.sh b/build_files_updated_unittest.sh
index c863071..87541c3 100755
--- a/build_files_updated_unittest.sh
+++ b/build_files_updated_unittest.sh
@@ -58,5 +58,5 @@
# Test whether there are any differences
for file in ${generated_files[@]}; do
- diff "${golden_dir}/${file}" "${test_dir}/${file}"
+ diff -du "${golden_dir}/${file}" "${test_dir}/${file}"
done
diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
index 5c5799e..ad630af 100644
--- a/cmake/extract_includes.bat.in
+++ b/cmake/extract_includes.bat.in
@@ -26,6 +26,7 @@
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_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_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\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
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index ecb5a85..b70191f 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -12,6 +12,7 @@
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.cc
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -44,6 +45,7 @@
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.cc
+ ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.cc
${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.cc
@@ -96,6 +98,7 @@
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
+ ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.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
diff --git a/conformance/ConformanceJava.java b/conformance/ConformanceJava.java
index 5319982..100bec4 100644
--- a/conformance/ConformanceJava.java
+++ b/conformance/ConformanceJava.java
@@ -54,7 +54,7 @@
while (len > 0) {
int read = System.in.read(buf, ofs, len);
if (read == -1) {
- return false; // EOF
+ return false; // EOF
}
ofs += read;
len -= read;
@@ -81,10 +81,10 @@
private void writeLittleEndianIntToStdout(int val) throws Exception {
byte[] buf = new byte[4];
- buf[0] = (byte)val;
- buf[1] = (byte)(val >> 8);
- buf[2] = (byte)(val >> 16);
- buf[3] = (byte)(val >> 24);
+ buf[0] = (byte) val;
+ buf[1] = (byte) (val >> 8);
+ buf[2] = (byte) (val >> 16);
+ buf[3] = (byte) (val >> 24);
writeToStdout(buf);
}
@@ -98,85 +98,71 @@
INPUT_STREAM_DECODER;
}
- private static class BinaryDecoder <MessageType extends AbstractMessage> {
- public MessageType decode (ByteString bytes, BinaryDecoderType type,
- Parser <MessageType> parser, ExtensionRegistry extensions)
- throws InvalidProtocolBufferException {
+ private static class BinaryDecoder<T extends AbstractMessage> {
+ public T decode(
+ ByteString bytes, BinaryDecoderType type, Parser<T> parser, ExtensionRegistry extensions)
+ throws InvalidProtocolBufferException {
switch (type) {
case BTYE_STRING_DECODER:
- return parser.parseFrom(bytes, extensions);
case BYTE_ARRAY_DECODER:
- return parser.parseFrom(bytes.toByteArray(), extensions);
- case ARRAY_BYTE_BUFFER_DECODER: {
- ByteBuffer buffer = ByteBuffer.allocate(bytes.size());
- bytes.copyTo(buffer);
- buffer.flip();
- try {
+ return parser.parseFrom(bytes, extensions);
+ case ARRAY_BYTE_BUFFER_DECODER:
+ {
+ ByteBuffer buffer = ByteBuffer.allocate(bytes.size());
+ bytes.copyTo(buffer);
+ buffer.flip();
return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
- } catch (InvalidProtocolBufferException e) {
- throw e;
}
- }
- case READONLY_ARRAY_BYTE_BUFFER_DECODER: {
- try {
+ case READONLY_ARRAY_BYTE_BUFFER_DECODER:
+ {
return parser.parseFrom(
CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions);
- } catch (InvalidProtocolBufferException e) {
- throw e;
}
- }
- case DIRECT_BYTE_BUFFER_DECODER: {
- ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
- bytes.copyTo(buffer);
- buffer.flip();
- try {
+ case DIRECT_BYTE_BUFFER_DECODER:
+ {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
+ bytes.copyTo(buffer);
+ buffer.flip();
return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
- } catch (InvalidProtocolBufferException e) {
- throw e;
}
- }
- case READONLY_DIRECT_BYTE_BUFFER_DECODER: {
- ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
- bytes.copyTo(buffer);
- buffer.flip();
- try {
+ case READONLY_DIRECT_BYTE_BUFFER_DECODER:
+ {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
+ bytes.copyTo(buffer);
+ buffer.flip();
return parser.parseFrom(
CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions);
- } catch (InvalidProtocolBufferException e) {
- throw e;
}
- }
- case INPUT_STREAM_DECODER: {
- try {
+ case INPUT_STREAM_DECODER:
+ {
return parser.parseFrom(bytes.newInput(), extensions);
- } catch (InvalidProtocolBufferException e) {
- throw e;
}
- }
- default :
- return null;
}
+ return null;
}
}
- private <MessageType extends AbstractMessage> MessageType parseBinary(
- ByteString bytes, Parser <MessageType> parser, ExtensionRegistry extensions)
+ private <T extends AbstractMessage> T parseBinary(
+ ByteString bytes, Parser<T> parser, ExtensionRegistry extensions)
throws InvalidProtocolBufferException {
- ArrayList <MessageType> messages = new ArrayList <MessageType> ();
- ArrayList <InvalidProtocolBufferException> exceptions =
- new ArrayList <InvalidProtocolBufferException>();
+ ArrayList<T> messages = new ArrayList<>();
+ ArrayList<InvalidProtocolBufferException> exceptions = new ArrayList<>();
for (int i = 0; i < BinaryDecoderType.values().length; i++) {
messages.add(null);
exceptions.add(null);
}
- BinaryDecoder <MessageType> decoder = new BinaryDecoder <MessageType> ();
+ if (messages.isEmpty()) {
+ throw new RuntimeException("binary decoder types missing");
+ }
+
+ BinaryDecoder<T> decoder = new BinaryDecoder<>();
boolean hasMessage = false;
boolean hasException = false;
for (int i = 0; i < BinaryDecoderType.values().length; ++i) {
try {
- //= BinaryDecoderType.values()[i].parseProto3(bytes);
+ // = BinaryDecoderType.values()[i].parseProto3(bytes);
messages.set(i, decoder.decode(bytes, BinaryDecoderType.values()[i], parser, extensions));
hasMessage = true;
} catch (InvalidProtocolBufferException e) {
@@ -202,7 +188,15 @@
if (hasException) {
// We do not check if exceptions are equal. Different implementations may return different
// exception messages. Throw an arbitrary one out instead.
- throw exceptions.get(0);
+ InvalidProtocolBufferException exception = null;
+ for (InvalidProtocolBufferException e : exceptions) {
+ if (exception != null) {
+ exception.addSuppressed(e);
+ } else {
+ exception = e;
+ }
+ }
+ throw exception;
}
// Fast path comparing all the messages with the first message, assuming equality being
@@ -242,115 +236,138 @@
request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");
switch (request.getPayloadCase()) {
- case PROTOBUF_PAYLOAD: {
- if (isProto3) {
- try {
- ExtensionRegistry extensions = ExtensionRegistry.newInstance();
- TestMessagesProto3.registerAllExtensions(extensions);
- testMessage = parseBinary(request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions);
- } catch (InvalidProtocolBufferException e) {
- return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
- }
- } else if (isProto2) {
- try {
- ExtensionRegistry extensions = ExtensionRegistry.newInstance();
- TestMessagesProto2.registerAllExtensions(extensions);
- testMessage = parseBinary(request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions);
- } catch (InvalidProtocolBufferException e) {
- return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
- }
- } else {
- throw new RuntimeException("Protobuf request doesn't have specific payload type.");
- }
- break;
- }
- case JSON_PAYLOAD: {
- try {
- JsonFormat.Parser parser = JsonFormat.parser().usingTypeRegistry(typeRegistry);
- if (request.getTestCategory()
- == Conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST) {
- parser = parser.ignoringUnknownFields();
- }
+ case PROTOBUF_PAYLOAD:
+ {
if (isProto3) {
- TestMessagesProto3.TestAllTypesProto3.Builder builder =
- TestMessagesProto3.TestAllTypesProto3.newBuilder();
- parser.merge(request.getJsonPayload(), builder);
- testMessage = builder.build();
+ try {
+ ExtensionRegistry extensions = ExtensionRegistry.newInstance();
+ TestMessagesProto3.registerAllExtensions(extensions);
+ testMessage =
+ parseBinary(
+ request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions);
+ } catch (InvalidProtocolBufferException e) {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setParseError(e.getMessage())
+ .build();
+ }
} else if (isProto2) {
- TestMessagesProto2.TestAllTypesProto2.Builder builder =
- TestMessagesProto2.TestAllTypesProto2.newBuilder();
- parser.merge(request.getJsonPayload(), builder);
- testMessage = builder.build();
+ try {
+ ExtensionRegistry extensions = ExtensionRegistry.newInstance();
+ TestMessagesProto2.registerAllExtensions(extensions);
+ testMessage =
+ parseBinary(
+ request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions);
+ } catch (InvalidProtocolBufferException e) {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setParseError(e.getMessage())
+ .build();
+ }
} else {
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
}
- } catch (InvalidProtocolBufferException e) {
- return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
+ break;
}
- break;
- }
- case TEXT_PAYLOAD: {
- if (isProto3) {
+ case JSON_PAYLOAD:
+ {
try {
- TestMessagesProto3.TestAllTypesProto3.Builder builder =
- TestMessagesProto3.TestAllTypesProto3.newBuilder();
- TextFormat.merge(request.getTextPayload(), builder);
- testMessage = builder.build();
- } catch (TextFormat.ParseException e) {
+ JsonFormat.Parser parser = JsonFormat.parser().usingTypeRegistry(typeRegistry);
+ if (request.getTestCategory()
+ == Conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST) {
+ parser = parser.ignoringUnknownFields();
+ }
+ if (isProto3) {
+ TestMessagesProto3.TestAllTypesProto3.Builder builder =
+ TestMessagesProto3.TestAllTypesProto3.newBuilder();
+ parser.merge(request.getJsonPayload(), builder);
+ testMessage = builder.build();
+ } else if (isProto2) {
+ TestMessagesProto2.TestAllTypesProto2.Builder builder =
+ TestMessagesProto2.TestAllTypesProto2.newBuilder();
+ parser.merge(request.getJsonPayload(), builder);
+ testMessage = builder.build();
+ } else {
+ throw new RuntimeException("Protobuf request doesn't have specific payload type.");
+ }
+ } catch (InvalidProtocolBufferException e) {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setParseError(e.getMessage())
+ .build();
+ }
+ break;
+ }
+ case TEXT_PAYLOAD:
+ {
+ if (isProto3) {
+ try {
+ TestMessagesProto3.TestAllTypesProto3.Builder builder =
+ TestMessagesProto3.TestAllTypesProto3.newBuilder();
+ TextFormat.merge(request.getTextPayload(), builder);
+ testMessage = builder.build();
+ } catch (TextFormat.ParseException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
- }
- } else if (isProto2) {
- try {
- TestMessagesProto2.TestAllTypesProto2.Builder builder =
- TestMessagesProto2.TestAllTypesProto2.newBuilder();
- TextFormat.merge(request.getTextPayload(), builder);
- testMessage = builder.build();
- } catch (TextFormat.ParseException e) {
+ }
+ } else if (isProto2) {
+ try {
+ TestMessagesProto2.TestAllTypesProto2.Builder builder =
+ TestMessagesProto2.TestAllTypesProto2.newBuilder();
+ TextFormat.merge(request.getTextPayload(), builder);
+ testMessage = builder.build();
+ } catch (TextFormat.ParseException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
+ }
+ } else {
+ throw new RuntimeException("Protobuf request doesn't have specific payload type.");
}
- } else {
- throw new RuntimeException("Protobuf request doesn't have specific payload type.");
+ break;
}
- break;
- }
- case PAYLOAD_NOT_SET: {
- throw new RuntimeException("Request didn't have payload.");
- }
+ case PAYLOAD_NOT_SET:
+ {
+ throw new RuntimeException("Request didn't have payload.");
+ }
- default: {
- throw new RuntimeException("Unexpected payload case.");
- }
+ default:
+ {
+ throw new RuntimeException("Unexpected payload case.");
+ }
}
switch (request.getRequestedOutputFormat()) {
case UNSPECIFIED:
throw new RuntimeException("Unspecified output format.");
- case PROTOBUF: {
- ByteString MessageString = testMessage.toByteString();
- return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(MessageString).build();
- }
+ case PROTOBUF:
+ {
+ ByteString messageString = testMessage.toByteString();
+ return Conformance.ConformanceResponse.newBuilder()
+ .setProtobufPayload(messageString)
+ .build();
+ }
case JSON:
try {
- return Conformance.ConformanceResponse.newBuilder().setJsonPayload(
- JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage)).build();
+ return Conformance.ConformanceResponse.newBuilder()
+ .setJsonPayload(
+ JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage))
+ .build();
} catch (InvalidProtocolBufferException | IllegalArgumentException e) {
- return Conformance.ConformanceResponse.newBuilder().setSerializeError(
- e.getMessage()).build();
+ return Conformance.ConformanceResponse.newBuilder()
+ .setSerializeError(e.getMessage())
+ .build();
}
case TEXT_FORMAT:
- return Conformance.ConformanceResponse.newBuilder().setTextPayload(
- TextFormat.printToString(testMessage)).build();
+ return Conformance.ConformanceResponse.newBuilder()
+ .setTextPayload(TextFormat.printToString(testMessage))
+ .build();
- default: {
- throw new RuntimeException("Unexpected request output.");
- }
+ default:
+ {
+ throw new RuntimeException("Unexpected request output.");
+ }
}
}
@@ -358,7 +375,7 @@
int bytes = readLittleEndianIntFromStdin();
if (bytes == -1) {
- return false; // EOF
+ return false; // EOF
}
byte[] serializedInput = new byte[bytes];
@@ -379,14 +396,16 @@
}
public void run() throws Exception {
- typeRegistry = TypeRegistry.newBuilder().add(
- TestMessagesProto3.TestAllTypesProto3.getDescriptor()).build();
+ typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(TestMessagesProto3.TestAllTypesProto3.getDescriptor())
+ .build();
while (doTestIo()) {
this.testCount++;
}
- System.err.println("ConformanceJava: received EOF from test runner after " +
- this.testCount + " tests");
+ System.err.println(
+ "ConformanceJava: received EOF from test runner after " + this.testCount + " tests");
}
public static void main(String[] args) throws Exception {
diff --git a/conformance/ConformanceJavaLite.java b/conformance/ConformanceJavaLite.java
index 147738d..eb3d06a 100644
--- a/conformance/ConformanceJavaLite.java
+++ b/conformance/ConformanceJavaLite.java
@@ -28,8 +28,19 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import com.google.protobuf.conformance.Conformance;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.CodedInputStream;
+import com.google.protobuf.ExtensionRegistryLite;
import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.MessageLite;
+import com.google.protobuf.Parser;
+import com.google.protobuf.conformance.Conformance;
+import com.google.protobuf_test_messages.proto2.TestMessagesProto2;
+import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2;
+import com.google.protobuf_test_messages.proto3.TestMessagesProto3;
+import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
class ConformanceJavaLite {
private int testCount = 0;
@@ -39,7 +50,7 @@
while (len > 0) {
int read = System.in.read(buf, ofs, len);
if (read == -1) {
- return false; // EOF
+ return false; // EOF
}
ofs += read;
len -= read;
@@ -66,36 +77,214 @@
private void writeLittleEndianIntToStdout(int val) throws Exception {
byte[] buf = new byte[4];
- buf[0] = (byte)val;
- buf[1] = (byte)(val >> 8);
- buf[2] = (byte)(val >> 16);
- buf[3] = (byte)(val >> 24);
+ buf[0] = (byte) val;
+ buf[1] = (byte) (val >> 8);
+ buf[2] = (byte) (val >> 16);
+ buf[3] = (byte) (val >> 24);
writeToStdout(buf);
}
- private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
- Conformance.TestAllTypes testMessage;
+ private enum BinaryDecoderType {
+ BTYE_STRING_DECODER,
+ BYTE_ARRAY_DECODER,
+ ARRAY_BYTE_BUFFER_DECODER,
+ READONLY_ARRAY_BYTE_BUFFER_DECODER,
+ DIRECT_BYTE_BUFFER_DECODER,
+ READONLY_DIRECT_BYTE_BUFFER_DECODER,
+ INPUT_STREAM_DECODER;
+ }
- switch (request.getPayloadCase()) {
- case PROTOBUF_PAYLOAD: {
- try {
- testMessage = Conformance.TestAllTypes.parseFrom(request.getProtobufPayload());
- } catch (InvalidProtocolBufferException e) {
- return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
+ private static class BinaryDecoder<T extends MessageLite> {
+ public T decode(
+ ByteString bytes,
+ BinaryDecoderType type,
+ Parser<T> parser,
+ ExtensionRegistryLite extensions)
+ throws InvalidProtocolBufferException {
+ switch (type) {
+ case BTYE_STRING_DECODER:
+ case BYTE_ARRAY_DECODER:
+ return parser.parseFrom(bytes, extensions);
+ case ARRAY_BYTE_BUFFER_DECODER:
+ {
+ ByteBuffer buffer = ByteBuffer.allocate(bytes.size());
+ bytes.copyTo(buffer);
+ buffer.flip();
+ return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
+ }
+ case READONLY_ARRAY_BYTE_BUFFER_DECODER:
+ {
+ return parser.parseFrom(
+ CodedInputStream.newInstance(bytes.asReadOnlyByteBuffer()), extensions);
+ }
+ case DIRECT_BYTE_BUFFER_DECODER:
+ {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
+ bytes.copyTo(buffer);
+ buffer.flip();
+ return parser.parseFrom(CodedInputStream.newInstance(buffer), extensions);
+ }
+ case READONLY_DIRECT_BYTE_BUFFER_DECODER:
+ {
+ ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
+ bytes.copyTo(buffer);
+ buffer.flip();
+ return parser.parseFrom(
+ CodedInputStream.newInstance(buffer.asReadOnlyBuffer()), extensions);
+ }
+ case INPUT_STREAM_DECODER:
+ {
+ return parser.parseFrom(bytes.newInput(), extensions);
+ }
+ }
+ return null;
+ }
+ }
+
+ private <T extends MessageLite> T parseBinary(
+ ByteString bytes, Parser<T> parser, ExtensionRegistryLite extensions)
+ throws InvalidProtocolBufferException {
+ ArrayList<T> messages = new ArrayList<>();
+ ArrayList<InvalidProtocolBufferException> exceptions = new ArrayList<>();
+
+ for (int i = 0; i < BinaryDecoderType.values().length; i++) {
+ messages.add(null);
+ exceptions.add(null);
+ }
+ if (messages.isEmpty()) {
+ throw new RuntimeException("binary decoder types missing");
+ }
+
+ BinaryDecoder<T> decoder = new BinaryDecoder<>();
+
+ boolean hasMessage = false;
+ boolean hasException = false;
+ for (int i = 0; i < BinaryDecoderType.values().length; ++i) {
+ try {
+ messages.set(i, decoder.decode(bytes, BinaryDecoderType.values()[i], parser, extensions));
+ hasMessage = true;
+ } catch (InvalidProtocolBufferException e) {
+ exceptions.set(i, e);
+ hasException = true;
+ }
+ }
+
+ if (hasMessage && hasException) {
+ StringBuilder sb =
+ new StringBuilder("Binary decoders disagreed on whether the payload was valid.\n");
+ for (int i = 0; i < BinaryDecoderType.values().length; ++i) {
+ sb.append(BinaryDecoderType.values()[i].name());
+ if (messages.get(i) != null) {
+ sb.append(" accepted the payload.\n");
+ } else {
+ sb.append(" rejected the payload.\n");
}
+ }
+ throw new RuntimeException(sb.toString());
+ }
+
+ if (hasException) {
+ // We do not check if exceptions are equal. Different implementations may return different
+ // exception messages. Throw an arbitrary one out instead.
+ InvalidProtocolBufferException exception = null;
+ for (InvalidProtocolBufferException e : exceptions) {
+ if (exception != null) {
+ exception.addSuppressed(e);
+ } else {
+ exception = e;
+ }
+ }
+ throw exception;
+ }
+
+ // Fast path comparing all the messages with the first message, assuming equality being
+ // symmetric and transitive.
+ boolean allEqual = true;
+ for (int i = 1; i < messages.size(); ++i) {
+ if (!messages.get(0).equals(messages.get(i))) {
+ allEqual = false;
break;
}
- case JSON_PAYLOAD: {
- return Conformance.ConformanceResponse.newBuilder().setSkipped(
- "Lite runtime does not support JSON format.").build();
- }
- case PAYLOAD_NOT_SET: {
- throw new RuntimeException("Request didn't have payload.");
- }
+ }
- default: {
- throw new RuntimeException("Unexpected payload case.");
+ // Slow path: compare and find out all unequal pairs.
+ if (!allEqual) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < messages.size() - 1; ++i) {
+ for (int j = i + 1; j < messages.size(); ++j) {
+ if (!messages.get(i).equals(messages.get(j))) {
+ sb.append(BinaryDecoderType.values()[i].name())
+ .append(" and ")
+ .append(BinaryDecoderType.values()[j].name())
+ .append(" parsed the payload differently.\n");
+ }
+ }
}
+ throw new RuntimeException(sb.toString());
+ }
+
+ return messages.get(0);
+ }
+
+ private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
+ com.google.protobuf.MessageLite testMessage;
+ boolean isProto3 =
+ request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3");
+ boolean isProto2 =
+ request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");
+
+ switch (request.getPayloadCase()) {
+ case PROTOBUF_PAYLOAD:
+ {
+ if (isProto3) {
+ try {
+ ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
+ TestMessagesProto3.registerAllExtensions(extensions);
+ testMessage =
+ parseBinary(
+ request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions);
+ } catch (InvalidProtocolBufferException e) {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setParseError(e.getMessage())
+ .build();
+ }
+ } else if (isProto2) {
+ try {
+ ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
+ TestMessagesProto2.registerAllExtensions(extensions);
+ testMessage =
+ parseBinary(
+ request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions);
+ } catch (InvalidProtocolBufferException e) {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setParseError(e.getMessage())
+ .build();
+ }
+ } else {
+ throw new RuntimeException("Protobuf request doesn't have specific payload type.");
+ }
+ break;
+ }
+ case JSON_PAYLOAD:
+ {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setSkipped("Lite runtime does not support JSON format.")
+ .build();
+ }
+ case TEXT_PAYLOAD:
+ {
+ return Conformance.ConformanceResponse.newBuilder()
+ .setSkipped("Lite runtime does not support Text format.")
+ .build();
+ }
+ case PAYLOAD_NOT_SET:
+ {
+ throw new RuntimeException("Request didn't have payload.");
+ }
+ default:
+ {
+ throw new RuntimeException("Unexpected payload case.");
+ }
}
switch (request.getRequestedOutputFormat()) {
@@ -103,15 +292,23 @@
throw new RuntimeException("Unspecified output format.");
case PROTOBUF:
- return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build();
+ return Conformance.ConformanceResponse.newBuilder()
+ .setProtobufPayload(testMessage.toByteString())
+ .build();
case JSON:
- return Conformance.ConformanceResponse.newBuilder().setSkipped(
- "Lite runtime does not support JSON format.").build();
+ return Conformance.ConformanceResponse.newBuilder()
+ .setSkipped("Lite runtime does not support JSON format.")
+ .build();
- default: {
- throw new RuntimeException("Unexpected request output.");
- }
+ case TEXT_FORMAT:
+ return Conformance.ConformanceResponse.newBuilder()
+ .setSkipped("Lite runtime does not support Text format.")
+ .build();
+ default:
+ {
+ throw new RuntimeException("Unexpected request output.");
+ }
}
}
@@ -119,7 +316,7 @@
int bytes = readLittleEndianIntFromStdin();
if (bytes == -1) {
- return false; // EOF
+ return false; // EOF
}
byte[] serializedInput = new byte[bytes];
@@ -144,8 +341,8 @@
this.testCount++;
}
- System.err.println("ConformanceJavaLite: received EOF from test runner after " +
- this.testCount + " tests");
+ System.err.println(
+ "ConformanceJavaLite: received EOF from test runner after " + this.testCount + " tests");
}
public static void main(String[] args) throws Exception {
diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc
index 48bfa96..0275e2e 100644
--- a/conformance/binary_json_conformance_suite.cc
+++ b/conformance/binary_json_conformance_suite.cc
@@ -2329,6 +2329,12 @@
ExpectParseFailureForJson(
"OneofFieldDuplicate", REQUIRED,
R"({"oneofUint32": 1, "oneofString": "test"})");
+ RunValidJsonTest("OneofFieldNullFirst", REQUIRED,
+ R"({"oneofUint32": null, "oneofString": "test"})",
+ "oneof_string: \"test\"");
+ RunValidJsonTest("OneofFieldNullSecond", REQUIRED,
+ R"({"oneofString": "test", "oneofUint32": null})",
+ "oneof_string: \"test\"");
// Ensure zero values for oneof make it out/backs.
TestAllTypesProto3 messageProto3;
TestAllTypesProto2 messageProto2;
diff --git a/conformance/conformance_test_runner.sh b/conformance/conformance_test_runner.sh
new file mode 100755
index 0000000..e9b2e4f
--- /dev/null
+++ b/conformance/conformance_test_runner.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+set -x
+echo $@
+
+set -euo pipefail
+# --- begin runfiles.bash initialization ---
+if [[ ! -d "${RUNFILES_DIR:-/dev/null}" && ! -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
+ if [[ -f "$0.runfiles_manifest" ]]; then
+ export RUNFILES_MANIFEST_FILE="$0.runfiles_manifest"
+ elif [[ -f "$0.runfiles/MANIFEST" ]]; then
+ export RUNFILES_MANIFEST_FILE="$0.runfiles/MANIFEST"
+ elif [[ -f "$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
+ export RUNFILES_DIR="$0.runfiles"
+ fi
+fi
+if [[ -f "${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
+ source "${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
+elif [[ -f "${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
+ source "$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
+ "$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
+else
+ echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash"
+ exit 1
+fi
+# --- end runfiles.bash initialization ---
+
+TESTEE=unset
+FAILURE_LIST=unset
+TEXT_FORMAT_FAILURE_LIST=unset
+
+while [[ -n "$@" ]]; do
+ arg="$1"; shift
+ val="$1"; shift
+ case "$arg" in
+ "--testee") TESTEE="$val" ;;
+ "--failure_list") FAILURE_LIST="$val" ;;
+ "--text_format_failure_list") TEXT_FORMAT_FAILURE_LIST="$val" ;;
+ *) echo "Flag $arg is not recognized." && exit 1 ;;
+ esac
+done
+
+conformance_test_runner=$(rlocation com_google_protobuf/conformance_test_runner)
+conformance_testee=$(rlocation $TESTEE)
+args=(--enforce_recommended)
+
+failure_list=$(rlocation $FAILURE_LIST)
+if [ "$failure_list" != "1" ] ; then
+ args+=(--failure_list $failure_list)
+fi
+
+text_format_failure_list=$(rlocation $TEXT_FORMAT_FAILURE_LIST)
+if [ "$text_format_failure_list" != "1" ]; then
+ args+=(--text_format_failure_list $text_format_failure_list)
+fi
+
+$conformance_test_runner "${args[@]}" $conformance_testee
diff --git a/conformance/failure_list_csharp.txt b/conformance/failure_list_csharp.txt
index 31bdf25..bba295e 100644
--- a/conformance/failure_list_csharp.txt
+++ b/conformance/failure_list_csharp.txt
@@ -1,3 +1,7 @@
+Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
-Recommended.Proto2.JsonInput.FieldNameExtension.Validator
+Required.Proto3.JsonInput.OneofFieldNullFirst.JsonOutput
+Required.Proto3.JsonInput.OneofFieldNullFirst.ProtobufOutput
+Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput
+Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput
diff --git a/conformance/failure_list_java_lite.txt b/conformance/failure_list_java_lite.txt
new file mode 100644
index 0000000..57a082e
--- /dev/null
+++ b/conformance/failure_list_java_lite.txt
@@ -0,0 +1,10 @@
+# This is the list of conformance tests that are known to fail for the Java
+# implementation right now. These should be fixed.
+#
+# 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.
+
+Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
+Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
+Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
+Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
diff --git a/conformance/failure_list_php.txt b/conformance/failure_list_php.txt
index d51a75d..667f80c 100644
--- a/conformance/failure_list_php.txt
+++ b/conformance/failure_list_php.txt
@@ -13,6 +13,8 @@
Required.Proto3.JsonInput.Int32FieldNotInteger
Required.Proto3.JsonInput.Int64FieldNotInteger
Required.Proto3.JsonInput.OneofFieldDuplicate
+Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput
+Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
Required.Proto3.JsonInput.RepeatedListValue.JsonOutput
Required.Proto3.JsonInput.RepeatedListValue.ProtobufOutput
diff --git a/conformance/failure_list_php_c.txt b/conformance/failure_list_php_c.txt
index 63c7e8a..1982029 100644
--- a/conformance/failure_list_php_c.txt
+++ b/conformance/failure_list_php_c.txt
@@ -1,2 +1,4 @@
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
+Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput
+Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput
diff --git a/conformance/failure_list_ruby.txt b/conformance/failure_list_ruby.txt
index 4938202..ea5de36 100644
--- a/conformance/failure_list_ruby.txt
+++ b/conformance/failure_list_ruby.txt
@@ -56,3 +56,5 @@
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
+Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput
+Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput
diff --git a/conformance/text_format_failure_list_java_lite.txt b/conformance/text_format_failure_list_java_lite.txt
new file mode 100644
index 0000000..61f1a96
--- /dev/null
+++ b/conformance/text_format_failure_list_java_lite.txt
@@ -0,0 +1,5 @@
+# This is the list of conformance tests that are known to fail for the Java
+# Lite TextFormat implementation right now. These should be fixed.
+#
+# 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.
diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs
index 042f69e..931fdc1 100644
--- a/csharp/src/AddressBook/Addressbook.cs
+++ b/csharp/src/AddressBook/Addressbook.cs
@@ -32,9 +32,9 @@
"Eg4KBm51bWJlchgBIAEoCRIoCgR0eXBlGAIgASgOMhoudHV0b3JpYWwuUGVy",
"c29uLlBob25lVHlwZSIrCglQaG9uZVR5cGUSCgoGTU9CSUxFEAASCAoESE9N",
"RRABEggKBFdPUksQAiIvCgtBZGRyZXNzQm9vaxIgCgZwZW9wbGUYASADKAsy",
- "EC50dXRvcmlhbC5QZXJzb25CUAoUY29tLmV4YW1wbGUudHV0b3JpYWxCEUFk",
- "ZHJlc3NCb29rUHJvdG9zqgIkR29vZ2xlLlByb3RvYnVmLkV4YW1wbGVzLkFk",
- "ZHJlc3NCb29rYgZwcm90bzM="));
+ "EC50dXRvcmlhbC5QZXJzb25CZgobY29tLmV4YW1wbGUudHV0b3JpYWwucHJv",
+ "dG9zQhFBZGRyZXNzQm9va1Byb3Rvc1ABWgsuLi90dXRvcmlhbKoCJEdvb2ds",
+ "ZS5Qcm90b2J1Zi5FeGFtcGxlcy5BZGRyZXNzQm9va2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
diff --git a/docs/third_party.md b/docs/third_party.md
index 9d490c0..4075327 100644
--- a/docs/third_party.md
+++ b/docs/third_party.md
@@ -65,9 +65,11 @@
* Javascript: http://code.google.com/p/protostuff/
* Javascript: https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h)
* Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port of the Google-official implementation)
+* Javascript: https://github.com/ButterCam/sisyphus-js
* Julia: https://github.com/tanmaykm/ProtoBuf.jl
* Kotlin: https://github.com/marcoferrer/kroto-plus
* Kotlin: https://github.com/Kotlin/kotlinx.serialization
+* Kotlin: https://github.com/ButterCam/sisyphus
* Lua: http://code.google.com/p/protoc-gen-lua/
* Lua: http://github.com/indygreg/lua-protobuf
* Lua: https://github.com/Neopallium/lua-pb
@@ -102,6 +104,7 @@
* Solidity: https://github.com/celer-network/pb3-gen-sol
* Swift: https://github.com/alexeyxo/protobuf-swift
* Swift: https://github.com/apple/swift-protobuf/
+* Typescript: https://github.com/thesayyn/protoc-gen-ts
* Vala: https://launchpad.net/protobuf-vala
* Visual Basic: http://code.google.com/p/protobuf-net/
@@ -158,6 +161,7 @@
* [Another JSON encoder/decoder for Java](https://github.com/sijuv/protobuf-codec)
* [Editor for serialized protobufs](http://code.google.com/p/protobufeditor/)
* [IntelliJ IDEA plugin](http://github.com/jvolkman/intellij-protobuf-editor)
+* [IntelliJ Protobuf Plugin](https://github.com/devkanro/intellij-protobuf-plugin)
* [TextMate syntax highlighting](http://github.com/michaeledgar/protobuf-tmbundle)
* [Oracle PL SQL plugin](http://code.google.com/p/protocol-buffer-plsql/)
* [Eclipse editor for protobuf (from Google)](http://code.google.com/p/protobuf-dt/)
diff --git a/examples/AddPerson.java b/examples/AddPerson.java
index c262ab7..2f6a231 100644
--- a/examples/AddPerson.java
+++ b/examples/AddPerson.java
@@ -1,7 +1,7 @@
// See README.txt for information and build instructions.
-import com.example.tutorial.AddressBookProtos.AddressBook;
-import com.example.tutorial.AddressBookProtos.Person;
+import com.example.tutorial.protos.AddressBook;
+import com.example.tutorial.protos.Person;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 3e8e654..1136296 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -8,7 +8,7 @@
find_package(protobuf CONFIG REQUIRED)
if(protobuf_VERBOSE)
- message(STATUS "Using Protocol Buffers ${Protobuf_VERSION}")
+ message(STATUS "Using Protocol Buffers ${protobuf_VERSION}")
endif()
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
diff --git a/examples/ListPeople.java b/examples/ListPeople.java
index 580f7ac..ab07b79 100644
--- a/examples/ListPeople.java
+++ b/examples/ListPeople.java
@@ -1,7 +1,7 @@
// See README.txt for information and build instructions.
-import com.example.tutorial.AddressBookProtos.AddressBook;
-import com.example.tutorial.AddressBookProtos.Person;
+import com.example.tutorial.protos.AddressBook;
+import com.example.tutorial.protos.Person;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
diff --git a/examples/Makefile b/examples/Makefile
index e9f9635..8ed2492 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -16,7 +16,7 @@
rm -f javac_middleman AddPerson*.class ListPeople*.class com/example/tutorial/*.class
rm -f protoc_middleman addressbook.pb.cc addressbook.pb.h addressbook_pb2.py com/example/tutorial/AddressBookProtos.java
rm -f *.pyc
- rm -f protoc_middleman_go tutorial/*.pb.go add_person_go list_people_go
+ rm -f protoc_middleman_go tutorial/*.pb.go add_person_go list_people_go go.mod go.sum
rm -f protoc_middleman_dart dart_tutorial/*.pb*.dart
rmdir dart_tutorial 2>/dev/null || true
rmdir tutorial 2>/dev/null || true
@@ -51,16 +51,20 @@
list_people_dart: list_people.dart protoc_middleman_dart
-add_person_go: add_person.go protoc_middleman_go
+go_mod:
+ go mod init github.com/protocolbuffers/protobuf/examples
+ go mod tidy
+
+add_person_go: add_person.go protoc_middleman_go go_mod
go build -o add_person_go add_person.go
-add_person_gotest: add_person_test.go add_person_go
+add_person_gotest: add_person_test.go add_person_go go_mod
go test add_person.go add_person_test.go
-list_people_go: list_people.go protoc_middleman_go
+list_people_go: list_people.go protoc_middleman_go go_mod
go build -o list_people_go list_people.go
-list_people_gotest: list_people.go list_people_go
+list_people_gotest: list_people.go list_people_go go_mod
go test list_people.go list_people_test.go
javac_middleman: AddPerson.java ListPeople.java protoc_middleman
diff --git a/examples/addressbook.proto b/examples/addressbook.proto
index b4b33b4..5bb3577 100644
--- a/examples/addressbook.proto
+++ b/examples/addressbook.proto
@@ -14,7 +14,8 @@
// [END declaration]
// [START java_declaration]
-option java_package = "com.example.tutorial";
+option java_multiple_files = true;
+option java_package = "com.example.tutorial.protos";
option java_outer_classname = "AddressBookProtos";
// [END java_declaration]
@@ -22,6 +23,10 @@
option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
// [END csharp_declaration]
+// [START go_declaration]
+option go_package = "../tutorial";
+// [END go_declaration]
+
// [START messages]
message Person {
string name = 1;
diff --git a/internal.bzl b/internal.bzl
new file mode 100644
index 0000000..a281418
--- /dev/null
+++ b/internal.bzl
@@ -0,0 +1,29 @@
+# PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE.
+
+def conformance_test(name, testee, failure_list = None, text_format_failure_list = None):
+ args = ["--testee %s" % _strip_bazel(testee)]
+ failure_lists = []
+ if failure_list:
+ args = args + ["--failure_list %s" % _strip_bazel(failure_list)]
+ failure_lists = failure_lists + [failure_list]
+ if text_format_failure_list:
+ args = args + ["--text_format_failure_list %s" % _strip_bazel(text_format_failure_list)]
+ failure_lists = failure_lists + [text_format_failure_list]
+
+ native.sh_test(
+ name = name,
+ srcs = ["//:conformance/conformance_test_runner.sh"],
+ data = [testee] + failure_lists + [
+ "//:conformance_test_runner",
+ ],
+ args = args,
+ deps = [
+ "@bazel_tools//tools/bash/runfiles",
+ ],
+ )
+
+
+def _strip_bazel(testee):
+ if testee.startswith("//"):
+ testee = testee.replace("//", "com_google_protobuf")
+ return testee.replace(":", "/")
diff --git a/java/BUILD b/java/BUILD
new file mode 100644
index 0000000..8778bf9
--- /dev/null
+++ b/java/BUILD
@@ -0,0 +1,8 @@
+test_suite(
+ name = "tests",
+ tests = [
+ "//java/core:tests",
+ "//java/lite:tests",
+ "//java/util:tests",
+ ],
+)
diff --git a/java/README.md b/java/README.md
index c343414..48c3aec 100644
--- a/java/README.md
+++ b/java/README.md
@@ -45,7 +45,7 @@
If you are using Gradle, add the following to your `build.gradle` file's dependencies:
```
- implementation 'com.google.protobuf:protobuf-java:3.11.0'
+ implementation 'com.google.protobuf:protobuf-java:3.15.3'
```
Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using.
@@ -178,3 +178,8 @@
web at:
https://developers.google.com/protocol-buffers/
+
+## Kotlin Protocol Buffers
+
+Code to support more idiomatic Kotlin protocol buffers has been added to the
+repository, and Kotlin support will be launched in the next numbered release.
diff --git a/java/compatibility_tests/README.md b/java/compatibility_tests/README.md
deleted file mode 100644
index 72c6034..0000000
--- a/java/compatibility_tests/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Protobuf Java Compatibility Tests
-
-This directory contains tests to ensure protobuf library is compatible with
-previously released versions.
-
-## Directory Layout
-
-For each released protobuf version we are testing compatibility with, there
-is a sub-directory with the following layout (take v2.5.0 as an example):
-
- * v2.5.0
- * test.sh
- * pom.xml
- * protos/ - unittest protos.
- * more_protos/ - unittest protos that import the ones in "protos".
- * tests/ - actual Java test classes.
-
-The testing code is extracted from regular protobuf unittests by removing:
-
- * tests that access package private methods/classes.
- * tests that are known to be broken by an intended behavior change (e.g., we
- changed the parsing recursion limit from 64 to 100).
- * all lite runtime tests.
-
-It's also divided into 3 submodule with tests depending on more_protos and
-more_protos depending on protos. This way we can test scenarios where only part
-of the dependency is upgraded to the new version.
-
-## How to Run The Tests
-
-We use a shell script to drive the test of different scenarios so the test
-will only run on unix-like environments. The script expects a few command
-line tools to be available on PATH: git, mvn, wget, grep, sed, java.
-
-Before running the tests, make sure you have already built the protoc binary
-following [the C++ installation instructions](../../src/README.md). The test
-scripts will use the built binary located at ${protobuf}/src/protoc.
-
-To start a test, simply run the test.sh script in each version directory. For
-example:
-
- $ v2.5.0/test.sh
-
-For each version, the test script will test:
-
- * only upgrading protos to the new version
- * only upgrading more_protos to the new version
-
-and see whether everything builds/runs fine. Both source compatibility and
-binary compatibility will be tested.
diff --git a/java/compatibility_tests/v2.5.0/deps/pom.xml b/java/compatibility_tests/v2.5.0/deps/pom.xml
deleted file mode 100644
index 7ceb960..0000000
--- a/java/compatibility_tests/v2.5.0/deps/pom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-test-deps</artifactId>
- <version>2.5.0</version>
-
- <name>Compatibility Test Dependencies</name>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <version>2.2.1</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.6</version>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/java/compatibility_tests/v2.5.0/more_protos/pom.xml b/java/compatibility_tests/v2.5.0/more_protos/pom.xml
deleted file mode 100644
index ff0c413..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-test-suite</artifactId>
- <version>2.5.0</version>
- <relativePath>..</relativePath>
- </parent>
-
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-more-protos</artifactId>
- <version>2.5.0</version>
-
- <name>More protos for Compatibility test</name>
-
- <dependencies>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>${more_protos.protobuf.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-protos</artifactId>
- <version>2.5.0</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.3</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <mkdir dir="target/generated-sources" />
- <exec executable="${more_protos.protoc.path}">
- <arg value="--java_out=target/generated-sources" />
- <arg value="--proto_path=src/proto" />
- <arg value="src/proto/google/protobuf/unittest.proto" />
- <arg value="src/proto/google/protobuf/unittest_optimize_for.proto" />
- <arg value="src/proto/com/google/protobuf/multiple_files_test.proto" />
- </exec>
- </tasks>
- <sourceRoot>target/generated-sources</sourceRoot>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto
deleted file mode 100644
index 9a04014..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/multiple_files_test.proto
+++ /dev/null
@@ -1,71 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// A proto file which tests the java_multiple_files option.
-
-
-// Some generic_services option(s) added automatically.
-// See: http://go/proto2-generic-services-default
-option java_generic_services = true; // auto-added
-
-import "google/protobuf/unittest.proto";
-
-package protobuf_unittest;
-
-option java_multiple_files = true;
-option java_outer_classname = "MultipleFilesTestProto";
-
-message MessageWithNoOuter {
- message NestedMessage {
- optional int32 i = 1;
- }
- enum NestedEnum {
- BAZ = 3;
- }
- optional NestedMessage nested = 1;
- repeated TestAllTypes foreign = 2;
- optional NestedEnum nested_enum = 3;
- optional EnumWithNoOuter foreign_enum = 4;
-}
-
-enum EnumWithNoOuter {
- FOO = 1;
- BAR = 2;
-}
-
-service ServiceWithNoOuter {
- rpc Foo(MessageWithNoOuter) returns(TestAllTypes);
-}
-
-extend TestAllExtensions {
- optional int32 extension_with_outer = 1234567;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto
deleted file mode 100644
index abffb9d..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_builders_test.proto
+++ /dev/null
@@ -1,53 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: jonp@google.com (Jon Perlow)
-//
-
-package protobuf_unittest;
-
-option java_multiple_files = true;
-option java_outer_classname = "NestedBuilders";
-
-
-message Vehicle {
- optional Engine engine = 1;
- repeated Wheel wheel = 2;
-}
-
-message Engine {
- optional int32 cylinder = 1;
- optional int32 liters = 2;
-}
-
-message Wheel {
- optional int32 radius = 1;
- optional int32 width = 2;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto
deleted file mode 100644
index 9fe5d56..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension.proto
+++ /dev/null
@@ -1,45 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with nested extensions. Note that this must be defined in
-// a separate file to properly test the initialization of the outer class.
-
-
-import "com/google/protobuf/non_nested_extension.proto";
-
-package protobuf_unittest;
-
-message MyNestedExtension {
- extend MessageToBeExtended {
- optional MessageToBeExtended recursiveExtension = 2;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto
deleted file mode 100644
index 16ee46e..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/nested_extension_lite.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with nested extensions for a MessageLite messages. Note that
-// this must be defined in a separate file to properly test the initialization
-// of the outer class.
-
-
-package protobuf_unittest;
-
-option optimize_for = LITE_RUNTIME;
-
-import "com/google/protobuf/non_nested_extension_lite.proto";
-
-message MyNestedExtensionLite {
- extend MessageLiteToBeExtended {
- optional MessageLiteToBeExtended recursiveExtensionLite = 3;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto
deleted file mode 100644
index f61b419..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with extensions.
-
-
-package protobuf_unittest;
-
-message MessageToBeExtended {
- extensions 1 to max;
-}
-
-message MyNonNestedExtension {
-}
-
-extend MessageToBeExtended {
- optional MyNonNestedExtension nonNestedExtension = 1;
-}
-
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
deleted file mode 100644
index 3c82659..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
+++ /dev/null
@@ -1,50 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with extensions for a MessageLite messages.
-
-
-package protobuf_unittest;
-
-option optimize_for = LITE_RUNTIME;
-
-message MessageLiteToBeExtended {
- extensions 1 to max;
-}
-
-message MyNonNestedExtensionLite {
-}
-
-extend MessageLiteToBeExtended {
- optional MyNonNestedExtensionLite nonNestedExtensionLite = 1;
-}
-
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
deleted file mode 100644
index 6e67d97..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
+++ /dev/null
@@ -1,108 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: jonp@google.com (Jon Perlow)
-
-// This file tests that various identifiers work as field and type names even
-// though the same identifiers are used internally by the java code generator.
-
-
-// Some generic_services option(s) added automatically.
-// See: http://go/proto2-generic-services-default
-option java_generic_services = true; // auto-added
-
-package io_protocol_tests;
-
-option java_package = "com.google.protobuf";
-option java_outer_classname = "TestBadIdentifiersProto";
-
-message TestMessage {
-}
-
-message Descriptor {
- option no_standard_descriptor_accessor = true;
- optional string descriptor = 1;
- message NestedDescriptor {
- option no_standard_descriptor_accessor = true;
- optional string descriptor = 1;
- }
- optional NestedDescriptor nested_descriptor = 2;
-}
-
-message Parser {
- enum ParserEnum {
- PARSER = 1;
- }
- optional ParserEnum parser = 1;
-}
-
-message Deprecated {
- enum TestEnum {
- FOO = 1;
- }
-
- optional int32 field1 = 1 [deprecated=true];
- optional TestEnum field2 = 2 [deprecated=true];
- optional TestMessage field3 = 3 [deprecated=true];
-}
-
-message Override {
- optional int32 override = 1;
-}
-
-message Object {
- optional int32 object = 1;
- optional string string_object = 2;
-}
-
-message String {
- optional string string = 1;
-}
-
-message Integer {
- optional int32 integer = 1;
-}
-
-message Long {
- optional int32 long = 1;
-}
-
-message Float {
- optional float float = 1;
-}
-
-message Double {
- optional double double = 1;
-}
-
-service TestConflictingMethodNames {
- rpc Override(TestMessage) returns (TestMessage);
-}
-
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto
deleted file mode 100644
index 95c8d4d..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/descriptor.proto
+++ /dev/null
@@ -1,620 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// The messages in this file describe the definitions found in .proto files.
-// A valid .proto file can be translated directly to a FileDescriptorProto
-// without any other information (e.g. without reading its imports).
-
-
-
-package google.protobuf;
-option java_package = "com.google.protobuf";
-option java_outer_classname = "DescriptorProtos";
-
-// descriptor.proto must be optimized for speed because reflection-based
-// algorithms don't work during bootstrapping.
-option optimize_for = SPEED;
-
-// The protocol compiler can output a FileDescriptorSet containing the .proto
-// files it parses.
-message FileDescriptorSet {
- repeated FileDescriptorProto file = 1;
-}
-
-// Describes a complete .proto file.
-message FileDescriptorProto {
- optional string name = 1; // file name, relative to root of source tree
- optional string package = 2; // e.g. "foo", "foo.bar", etc.
-
- // Names of files imported by this file.
- repeated string dependency = 3;
- // Indexes of the public imported files in the dependency list above.
- repeated int32 public_dependency = 10;
- // Indexes of the weak imported files in the dependency list.
- // For Google-internal migration only. Do not use.
- repeated int32 weak_dependency = 11;
-
- // All top-level definitions in this file.
- repeated DescriptorProto message_type = 4;
- repeated EnumDescriptorProto enum_type = 5;
- repeated ServiceDescriptorProto service = 6;
- repeated FieldDescriptorProto extension = 7;
-
- optional FileOptions options = 8;
-
- // 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.
- optional SourceCodeInfo source_code_info = 9;
-}
-
-// Describes a message type.
-message DescriptorProto {
- optional string name = 1;
-
- repeated FieldDescriptorProto field = 2;
- repeated FieldDescriptorProto extension = 6;
-
- repeated DescriptorProto nested_type = 3;
- repeated EnumDescriptorProto enum_type = 4;
-
- message ExtensionRange {
- optional int32 start = 1;
- optional int32 end = 2;
- }
- repeated ExtensionRange extension_range = 5;
-
- optional MessageOptions options = 7;
-}
-
-// Describes a field within a message.
-message FieldDescriptorProto {
- enum Type {
- // 0 is reserved for errors.
- // Order is weird for historical reasons.
- TYPE_DOUBLE = 1;
- TYPE_FLOAT = 2;
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
- // negative values are likely.
- TYPE_INT64 = 3;
- TYPE_UINT64 = 4;
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
- // negative values are likely.
- TYPE_INT32 = 5;
- TYPE_FIXED64 = 6;
- TYPE_FIXED32 = 7;
- TYPE_BOOL = 8;
- TYPE_STRING = 9;
- TYPE_GROUP = 10; // Tag-delimited aggregate.
- TYPE_MESSAGE = 11; // Length-delimited aggregate.
-
- // New in version 2.
- TYPE_BYTES = 12;
- TYPE_UINT32 = 13;
- TYPE_ENUM = 14;
- TYPE_SFIXED32 = 15;
- TYPE_SFIXED64 = 16;
- TYPE_SINT32 = 17; // Uses ZigZag encoding.
- TYPE_SINT64 = 18; // Uses ZigZag encoding.
- };
-
- enum Label {
- // 0 is reserved for errors
- LABEL_OPTIONAL = 1;
- LABEL_REQUIRED = 2;
- LABEL_REPEATED = 3;
- // TODO(sanjay): Should we add LABEL_MAP?
- };
-
- optional string name = 1;
- optional int32 number = 3;
- optional Label label = 4;
-
- // If type_name is set, this need not be set. If both this and type_name
- // are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
- optional Type type = 5;
-
- // 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).
- optional string type_name = 6;
-
- // For extensions, this is the name of the type being extended. It is
- // resolved in the same manner as type_name.
- optional string extendee = 2;
-
- // 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?
- optional string default_value = 7;
-
- optional FieldOptions options = 8;
-}
-
-// Describes an enum type.
-message EnumDescriptorProto {
- optional string name = 1;
-
- repeated EnumValueDescriptorProto value = 2;
-
- optional EnumOptions options = 3;
-}
-
-// Describes a value within an enum.
-message EnumValueDescriptorProto {
- optional string name = 1;
- optional int32 number = 2;
-
- optional EnumValueOptions options = 3;
-}
-
-// Describes a service.
-message ServiceDescriptorProto {
- optional string name = 1;
- repeated MethodDescriptorProto method = 2;
-
- optional ServiceOptions options = 3;
-}
-
-// Describes a method of a service.
-message MethodDescriptorProto {
- optional string name = 1;
-
- // Input and output type names. These are resolved in the same way as
- // FieldDescriptorProto.type_name, but must refer to a message type.
- optional string input_type = 2;
- optional string output_type = 3;
-
- optional MethodOptions options = 4;
-}
-
-
-// ===================================================================
-// Options
-
-// Each of the definitions above may have "options" attached. These are
-// just annotations which may cause code to be generated slightly differently
-// or may contain hints for code that manipulates protocol messages.
-//
-// Clients may define custom options as extensions of the *Options messages.
-// These extensions may not yet be known at parsing time, so the parser cannot
-// store the values in them. Instead it stores them in a field in the *Options
-// message called uninterpreted_option. This field must have the same name
-// across all *Options messages. We then use this field to populate the
-// extensions when we build a descriptor, at which point all protos have been
-// parsed and so all extensions are known.
-//
-// Extension numbers for custom options may be chosen as follows:
-// * For options which will only be used within a single application or
-// organization, or for experimental options, use field numbers 50000
-// through 99999. It is up to you to ensure that you do not use the
-// same number for multiple options.
-// * For options which will be published and used publicly by multiple
-// independent entities, e-mail protobuf-global-extension-registry@google.com
-// to reserve extension numbers. Simply provide your project name (e.g.
-// Object-C plugin) and your project website (if available) -- there's no need
-// to explain how you intend to use them. Usually you only need one extension
-// number. You can declare multiple options with only one extension number by
-// putting them in a sub-message. See the Custom Options section of the docs
-// for examples:
-// http://code.google.com/apis/protocolbuffers/docs/proto.html#options
-// If this turns out to be popular, a web service will be set up
-// to automatically assign option numbers.
-
-
-message FileOptions {
-
- // 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.
- optional string java_package = 1;
-
-
- // 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).
- optional string java_outer_classname = 8;
-
- // 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.
- optional bool java_multiple_files = 10 [default=false];
-
- // If set true, then the Java code generator will generate equals() and
- // hashCode() methods for all messages defined in the .proto file. This is
- // purely a speed optimization, as the AbstractMessage base class includes
- // reflection-based implementations of these methods.
- optional bool java_generate_equals_and_hash = 20 [default=false];
-
- // Generated classes can be optimized for speed or code size.
- enum OptimizeMode {
- SPEED = 1; // Generate complete code for parsing, serialization,
- // etc.
- CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
- LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
- }
- optional OptimizeMode optimize_for = 9 [default=SPEED];
-
- // Sets the Go package where structs generated from this .proto will be
- // placed. There is no default.
- optional string go_package = 11;
-
-
-
- // 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 proto2.
- //
- // 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.
- optional bool cc_generic_services = 16 [default=false];
- optional bool java_generic_services = 17 [default=false];
- optional bool py_generic_services = 18 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message MessageOptions {
- // 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.
- //
- // 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.
- optional bool message_set_wire_format = 1 [default=false];
-
- // 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".
- optional bool no_standard_descriptor_accessor = 2 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message FieldOptions {
- // 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!
- optional CType ctype = 1 [default = STRING];
- enum CType {
- // Default mode.
- STRING = 0;
-
- CORD = 1;
-
- STRING_PIECE = 2;
- }
- // 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.
- optional bool packed = 2;
-
-
-
- // 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 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.
- optional bool lazy = 5 [default=false];
-
- // 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.
- optional bool deprecated = 3 [default=false];
-
- // EXPERIMENTAL. DO NOT USE.
- // For "map" fields, the name of the field in the enclosed type that
- // is the key for this map. For example, suppose we have:
- // message Item {
- // required string name = 1;
- // required string value = 2;
- // }
- // message Config {
- // repeated Item items = 1 [experimental_map_key="name"];
- // }
- // In this situation, the map key for Item will be set to "name".
- // TODO: Fully-implement this, then remove the "experimental_" prefix.
- optional string experimental_map_key = 9;
-
- // For Google-internal migration only. Do not use.
- optional bool weak = 10 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message EnumOptions {
-
- // Set this option to false to disallow mapping different tag names to a same
- // value.
- optional bool allow_alias = 2 [default=true];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message EnumValueOptions {
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message ServiceOptions {
-
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
- // framework. We apologize for hoarding these numbers to ourselves, but
- // we were already using them long before we decided to release Protocol
- // Buffers.
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message MethodOptions {
-
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
- // framework. We apologize for hoarding these numbers to ourselves, but
- // we were already using them long before we decided to release Protocol
- // Buffers.
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-
-// 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.
-message UninterpretedOption {
- // 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".
- message NamePart {
- required string name_part = 1;
- required bool is_extension = 2;
- }
- repeated NamePart name = 2;
-
- // The value of the uninterpreted option, in whatever type the tokenizer
- // identified it as during parsing. Exactly one of these should be set.
- optional string identifier_value = 3;
- optional uint64 positive_int_value = 4;
- optional int64 negative_int_value = 5;
- optional double double_value = 6;
- optional bytes string_value = 7;
- optional string aggregate_value = 8;
-}
-
-// ===================================================================
-// Optional source code info
-
-// Encapsulates information about the original source file from which a
-// FileDescriptorProto was generated.
-message SourceCodeInfo {
- // 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).
- //
- // 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.
- repeated Location location = 1;
- message 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;
- //
- // 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).
- repeated int32 path = 1 [packed=true];
-
- // 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.
- repeated int32 span = 2 [packed=true];
-
- // 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.
- //
- // 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:
- //
- // 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.
- //
- // // Comment attached to qux.
- // //
- // // Another line attached to qux.
- // optional double qux = 4;
- //
- // 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 leading_comments = 3;
- optional string trailing_comments = 4;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto
deleted file mode 100644
index 6eb2d86..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest.proto
+++ /dev/null
@@ -1,719 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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.
-
-
-// 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
-
-import "google/protobuf/unittest_import.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.
- optional int32 bb = 1;
- }
-
- enum NestedEnum {
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- }
-
- // Singular
- optional int32 optional_int32 = 1;
- optional int64 optional_int64 = 2;
- optional uint32 optional_uint32 = 3;
- optional uint64 optional_uint64 = 4;
- optional sint32 optional_sint32 = 5;
- optional sint64 optional_sint64 = 6;
- optional fixed32 optional_fixed32 = 7;
- optional fixed64 optional_fixed64 = 8;
- optional sfixed32 optional_sfixed32 = 9;
- optional sfixed64 optional_sfixed64 = 10;
- optional float optional_float = 11;
- optional double optional_double = 12;
- optional bool optional_bool = 13;
- optional string optional_string = 14;
- optional bytes optional_bytes = 15;
-
- optional group OptionalGroup = 16 {
- optional int32 a = 17;
- }
-
- optional NestedMessage optional_nested_message = 18;
- optional ForeignMessage optional_foreign_message = 19;
- optional protobuf_unittest_import.ImportMessage optional_import_message = 20;
-
- optional NestedEnum optional_nested_enum = 21;
- optional ForeignEnum optional_foreign_enum = 22;
- optional protobuf_unittest_import.ImportEnum optional_import_enum = 23;
-
- optional string optional_string_piece = 24 [ctype=STRING_PIECE];
- optional string optional_cord = 25 [ctype=CORD];
-
- // Defined in unittest_import_public.proto
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message = 26;
-
- optional NestedMessage optional_lazy_message = 27 [lazy=true];
-
- // 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 group RepeatedGroup = 46 {
- optional int32 a = 47;
- }
-
- 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;
-
- repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord = 55 [ctype=CORD];
-
- repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32 = 61 [default = 41 ];
- optional int64 default_int64 = 62 [default = 42 ];
- optional uint32 default_uint32 = 63 [default = 43 ];
- optional uint64 default_uint64 = 64 [default = 44 ];
- optional sint32 default_sint32 = 65 [default = -45 ];
- optional sint64 default_sint64 = 66 [default = 46 ];
- optional fixed32 default_fixed32 = 67 [default = 47 ];
- optional fixed64 default_fixed64 = 68 [default = 48 ];
- optional sfixed32 default_sfixed32 = 69 [default = 49 ];
- optional sfixed64 default_sfixed64 = 70 [default = -50 ];
- optional float default_float = 71 [default = 51.5 ];
- optional double default_double = 72 [default = 52e3 ];
- optional bool default_bool = 73 [default = true ];
- optional string default_string = 74 [default = "hello"];
- optional bytes default_bytes = 75 [default = "world"];
-
- optional NestedEnum default_nested_enum = 81 [default = BAR ];
- optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
- optional protobuf_unittest_import.ImportEnum
- default_import_enum = 83 [default = IMPORT_BAR];
-
- optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
- optional string default_cord = 85 [ctype=CORD,default="123"];
-}
-
-message TestDeprecatedFields {
- optional int32 deprecated_int32 = 1 [deprecated=true];
-}
-
-// Define these after TestAllTypes to make sure the compiler can handle
-// that.
-message ForeignMessage {
- optional int32 c = 1;
-}
-
-enum ForeignEnum {
- FOREIGN_FOO = 4;
- FOREIGN_BAR = 5;
- FOREIGN_BAZ = 6;
-}
-
-message TestAllExtensions {
- extensions 1 to max;
-}
-
-extend TestAllExtensions {
- // Singular
- optional int32 optional_int32_extension = 1;
- optional int64 optional_int64_extension = 2;
- optional uint32 optional_uint32_extension = 3;
- optional uint64 optional_uint64_extension = 4;
- optional sint32 optional_sint32_extension = 5;
- optional sint64 optional_sint64_extension = 6;
- optional fixed32 optional_fixed32_extension = 7;
- optional fixed64 optional_fixed64_extension = 8;
- optional sfixed32 optional_sfixed32_extension = 9;
- optional sfixed64 optional_sfixed64_extension = 10;
- optional float optional_float_extension = 11;
- optional double optional_double_extension = 12;
- optional bool optional_bool_extension = 13;
- optional string optional_string_extension = 14;
- optional bytes optional_bytes_extension = 15;
-
- optional group OptionalGroup_extension = 16 {
- optional int32 a = 17;
- }
-
- optional TestAllTypes.NestedMessage optional_nested_message_extension = 18;
- optional ForeignMessage optional_foreign_message_extension = 19;
- optional protobuf_unittest_import.ImportMessage
- optional_import_message_extension = 20;
-
- optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
- optional ForeignEnum optional_foreign_enum_extension = 22;
- optional protobuf_unittest_import.ImportEnum
- optional_import_enum_extension = 23;
-
- optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
- optional string optional_cord_extension = 25 [ctype=CORD];
-
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message_extension = 26;
-
- optional TestAllTypes.NestedMessage
- optional_lazy_message_extension = 27 [lazy=true];
-
- // Repeated
- repeated int32 repeated_int32_extension = 31;
- repeated int64 repeated_int64_extension = 32;
- repeated uint32 repeated_uint32_extension = 33;
- repeated uint64 repeated_uint64_extension = 34;
- repeated sint32 repeated_sint32_extension = 35;
- repeated sint64 repeated_sint64_extension = 36;
- repeated fixed32 repeated_fixed32_extension = 37;
- repeated fixed64 repeated_fixed64_extension = 38;
- repeated sfixed32 repeated_sfixed32_extension = 39;
- repeated sfixed64 repeated_sfixed64_extension = 40;
- repeated float repeated_float_extension = 41;
- repeated double repeated_double_extension = 42;
- repeated bool repeated_bool_extension = 43;
- repeated string repeated_string_extension = 44;
- repeated bytes repeated_bytes_extension = 45;
-
- repeated group RepeatedGroup_extension = 46 {
- optional int32 a = 47;
- }
-
- repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
- repeated ForeignMessage repeated_foreign_message_extension = 49;
- repeated protobuf_unittest_import.ImportMessage
- repeated_import_message_extension = 50;
-
- repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
- repeated ForeignEnum repeated_foreign_enum_extension = 52;
- repeated protobuf_unittest_import.ImportEnum
- repeated_import_enum_extension = 53;
-
- repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord_extension = 55 [ctype=CORD];
-
- repeated TestAllTypes.NestedMessage
- repeated_lazy_message_extension = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32_extension = 61 [default = 41 ];
- optional int64 default_int64_extension = 62 [default = 42 ];
- optional uint32 default_uint32_extension = 63 [default = 43 ];
- optional uint64 default_uint64_extension = 64 [default = 44 ];
- optional sint32 default_sint32_extension = 65 [default = -45 ];
- optional sint64 default_sint64_extension = 66 [default = 46 ];
- optional fixed32 default_fixed32_extension = 67 [default = 47 ];
- optional fixed64 default_fixed64_extension = 68 [default = 48 ];
- optional sfixed32 default_sfixed32_extension = 69 [default = 49 ];
- optional sfixed64 default_sfixed64_extension = 70 [default = -50 ];
- optional float default_float_extension = 71 [default = 51.5 ];
- optional double default_double_extension = 72 [default = 52e3 ];
- optional bool default_bool_extension = 73 [default = true ];
- optional string default_string_extension = 74 [default = "hello"];
- optional bytes default_bytes_extension = 75 [default = "world"];
-
- optional TestAllTypes.NestedEnum
- default_nested_enum_extension = 81 [default = BAR];
- optional ForeignEnum
- default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
- optional protobuf_unittest_import.ImportEnum
- default_import_enum_extension = 83 [default = IMPORT_BAR];
-
- optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,
- default="abc"];
- optional string default_cord_extension = 85 [ctype=CORD, default="123"];
-}
-
-message TestNestedExtension {
- extend TestAllExtensions {
- // Check for bug where string extensions declared in tested scope did not
- // compile.
- optional string test = 1002 [default="test"];
- }
-}
-
-// We have separate messages for testing required fields because it's
-// annoying to have to fill in required fields in TestProto in order to
-// do anything with it. Note that we don't need to test every type of
-// required filed because the code output is basically identical to
-// optional fields for all types.
-message TestRequired {
- required int32 a = 1;
- optional int32 dummy2 = 2;
- required int32 b = 3;
-
- extend TestAllExtensions {
- optional TestRequired single = 1000;
- repeated TestRequired multi = 1001;
- }
-
- // Pad the field count to 32 so that we can test that IsInitialized()
- // properly checks multiple elements of has_bits_.
- optional int32 dummy4 = 4;
- optional int32 dummy5 = 5;
- optional int32 dummy6 = 6;
- optional int32 dummy7 = 7;
- optional int32 dummy8 = 8;
- optional int32 dummy9 = 9;
- optional int32 dummy10 = 10;
- optional int32 dummy11 = 11;
- optional int32 dummy12 = 12;
- optional int32 dummy13 = 13;
- optional int32 dummy14 = 14;
- optional int32 dummy15 = 15;
- optional int32 dummy16 = 16;
- optional int32 dummy17 = 17;
- optional int32 dummy18 = 18;
- optional int32 dummy19 = 19;
- optional int32 dummy20 = 20;
- optional int32 dummy21 = 21;
- optional int32 dummy22 = 22;
- optional int32 dummy23 = 23;
- optional int32 dummy24 = 24;
- optional int32 dummy25 = 25;
- optional int32 dummy26 = 26;
- optional int32 dummy27 = 27;
- optional int32 dummy28 = 28;
- optional int32 dummy29 = 29;
- optional int32 dummy30 = 30;
- optional int32 dummy31 = 31;
- optional int32 dummy32 = 32;
-
- required int32 c = 33;
-}
-
-message TestRequiredForeign {
- optional TestRequired optional_message = 1;
- repeated TestRequired repeated_message = 2;
- optional int32 dummy = 3;
-}
-
-// Test that we can use NestedMessage from outside TestAllTypes.
-message TestForeignNested {
- optional TestAllTypes.NestedMessage foreign_nested = 1;
-}
-
-// TestEmptyMessage is used to test unknown field support.
-message TestEmptyMessage {
-}
-
-// Like above, but declare all field numbers as potential extensions. No
-// actual extensions should ever be defined for this type.
-message TestEmptyMessageWithExtensions {
- extensions 1 to max;
-}
-
-message TestMultipleExtensionRanges {
- extensions 42;
- extensions 4143 to 4243;
- extensions 65536 to max;
-}
-
-// 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.
- optional int32 a = 1;
- optional int32 bb = 268435455;
-}
-
-message TestRecursiveMessage {
- optional TestRecursiveMessage a = 1;
- optional int32 i = 2;
-}
-
-// Test that mutual recursion works.
-message TestMutualRecursionA {
- optional TestMutualRecursionB bb = 1;
-}
-
-message TestMutualRecursionB {
- optional TestMutualRecursionA a = 1;
- optional int32 optional_int32 = 2;
-}
-
-// Test that groups have disjoint field numbers from their siblings and
-// parents. This is NOT possible in proto1; only proto2. When attempting
-// to compile with proto1, this will emit an error; so we only include it
-// in protobuf_unittest_proto.
-message TestDupFieldNumber { // NO_PROTO1
- optional int32 a = 1; // NO_PROTO1
- optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1
- optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1
-} // NO_PROTO1
-
-// Additional messages for testing lazy fields.
-message TestEagerMessage {
- optional TestAllTypes sub_message = 1 [lazy=false];
-}
-message TestLazyMessage {
- optional TestAllTypes sub_message = 1 [lazy=true];
-}
-
-// Needed for a Python test.
-message TestNestedMessageHasBits {
- message NestedMessage {
- repeated int32 nestedmessage_repeated_int32 = 1;
- repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2;
- }
- optional NestedMessage optional_nested_message = 1;
-}
-
-
-// Test an enum that has multiple values with the same number.
-enum TestEnumWithDupValue {
- option allow_alias = true;
- FOO1 = 1;
- BAR1 = 2;
- BAZ = 3;
- FOO2 = 1;
- BAR2 = 2;
-}
-
-// Test an enum with large, unordered values.
-enum TestSparseEnum {
- SPARSE_A = 123;
- SPARSE_B = 62374;
- SPARSE_C = 12589234;
- SPARSE_D = -15;
- SPARSE_E = -53452;
- SPARSE_F = 0;
- SPARSE_G = 2;
-}
-
-// Test message with CamelCase field names. This violates Protocol Buffer
-// standard style.
-message TestCamelCaseFieldNames {
- optional int32 PrimitiveField = 1;
- optional string StringField = 2;
- optional ForeignEnum EnumField = 3;
- optional ForeignMessage MessageField = 4;
- optional string StringPieceField = 5 [ctype=STRING_PIECE];
- optional string CordField = 6 [ctype=CORD];
-
- repeated int32 RepeatedPrimitiveField = 7;
- repeated string RepeatedStringField = 8;
- repeated ForeignEnum RepeatedEnumField = 9;
- repeated ForeignMessage RepeatedMessageField = 10;
- repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE];
- repeated string RepeatedCordField = 12 [ctype=CORD];
-}
-
-
-// We list fields out of order, to ensure that we're using field number and not
-// field index to determine serialization order.
-message TestFieldOrderings {
- optional string my_string = 11;
- extensions 2 to 10;
- optional int64 my_int = 1;
- extensions 12 to 100;
- optional float my_float = 101;
-}
-
-
-extend TestFieldOrderings {
- optional string my_extension_string = 50;
- optional int32 my_extension_int = 5;
-}
-
-
-message TestExtremeDefaultValues {
- optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
- optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
- optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
- optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
- optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
- optional int32 really_small_int32 = 21 [default = -0x80000000];
- optional int64 really_small_int64 = 22 [default = -0x8000000000000000];
-
- // The default value here is UTF-8 for "\u1234". (We could also just type
- // the UTF-8 text directly into this text file rather than escape it, but
- // lots of people use editors that would be confused by this.)
- optional string utf8_string = 6 [default = "\341\210\264"];
-
- // Tests for single-precision floating-point values.
- optional float zero_float = 7 [default = 0];
- optional float one_float = 8 [default = 1];
- optional float small_float = 9 [default = 1.5];
- optional float negative_one_float = 10 [default = -1];
- optional float negative_float = 11 [default = -1.5];
- // Using exponents
- optional float large_float = 12 [default = 2E8];
- optional float small_negative_float = 13 [default = -8e-28];
-
- // Text for nonfinite floating-point values.
- optional double inf_double = 14 [default = inf];
- optional double neg_inf_double = 15 [default = -inf];
- optional double nan_double = 16 [default = nan];
- optional float inf_float = 17 [default = inf];
- optional float neg_inf_float = 18 [default = -inf];
- optional float nan_float = 19 [default = nan];
-
- // Tests for C++ trigraphs.
- // Trigraphs should be escaped in C++ generated files, but they should not be
- // escaped for other languages.
- // Note that in .proto file, "\?" is a valid way to escape ? in string
- // literals.
- optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
-
- // String defaults containing the character '\000'
- optional string string_with_zero = 23 [default = "hel\000lo"];
- optional bytes bytes_with_zero = 24 [default = "wor\000ld"];
- optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
- default="ab\000c"];
- optional string cord_with_zero = 26 [ctype=CORD,
- default="12\0003"];
-}
-
-message SparseEnumMessage {
- optional TestSparseEnum sparse_enum = 1;
-}
-
-// Test String and Bytes: string is for valid UTF-8 strings
-message OneString {
- optional string data = 1;
-}
-
-message MoreString {
- repeated string data = 1;
-}
-
-message OneBytes {
- optional bytes data = 1;
-}
-
-message MoreBytes {
- repeated bytes data = 1;
-}
-
-
-// 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 TestPackedExtensions {
- extensions 1 to max;
-}
-
-extend TestPackedExtensions {
- repeated int32 packed_int32_extension = 90 [packed = true];
- repeated int64 packed_int64_extension = 91 [packed = true];
- repeated uint32 packed_uint32_extension = 92 [packed = true];
- repeated uint64 packed_uint64_extension = 93 [packed = true];
- repeated sint32 packed_sint32_extension = 94 [packed = true];
- repeated sint64 packed_sint64_extension = 95 [packed = true];
- repeated fixed32 packed_fixed32_extension = 96 [packed = true];
- repeated fixed64 packed_fixed64_extension = 97 [packed = true];
- repeated sfixed32 packed_sfixed32_extension = 98 [packed = true];
- repeated sfixed64 packed_sfixed64_extension = 99 [packed = true];
- repeated float packed_float_extension = 100 [packed = true];
- repeated double packed_double_extension = 101 [packed = true];
- repeated bool packed_bool_extension = 102 [packed = true];
- repeated ForeignEnum packed_enum_extension = 103 [packed = true];
-}
-
-// Used by ExtensionSetTest/DynamicExtensions. The test actually builds
-// a set of extensions to TestAllExtensions dynamically, based on the fields
-// of this message type.
-message TestDynamicExtensions {
- enum DynamicEnumType {
- DYNAMIC_FOO = 2200;
- DYNAMIC_BAR = 2201;
- DYNAMIC_BAZ = 2202;
- }
- message DynamicMessageType {
- optional int32 dynamic_field = 2100;
- }
-
- optional fixed32 scalar_extension = 2000;
- optional ForeignEnum enum_extension = 2001;
- optional DynamicEnumType dynamic_enum_extension = 2002;
-
- optional ForeignMessage message_extension = 2003;
- optional DynamicMessageType dynamic_message_extension = 2004;
-
- repeated string repeated_extension = 2005;
- repeated sint32 packed_extension = 2006 [packed = true];
-}
-
-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;
-}
-
-// Test that if an optional or required message/group field appears multiple
-// times in the input, they need to be merged.
-message TestParsingMerge {
- // RepeatedFieldsGenerator defines matching field types as TestParsingMerge,
- // except that all fields are repeated. In the tests, we will serialize the
- // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge.
- // Repeated fields in RepeatedFieldsGenerator are expected to be merged into
- // the corresponding required/optional fields in TestParsingMerge.
- message RepeatedFieldsGenerator {
- repeated TestAllTypes field1 = 1;
- repeated TestAllTypes field2 = 2;
- repeated TestAllTypes field3 = 3;
- repeated group Group1 = 10 {
- optional TestAllTypes field1 = 11;
- }
- repeated group Group2 = 20 {
- optional TestAllTypes field1 = 21;
- }
- repeated TestAllTypes ext1 = 1000;
- repeated TestAllTypes ext2 = 1001;
- }
- required TestAllTypes required_all_types = 1;
- optional TestAllTypes optional_all_types = 2;
- repeated TestAllTypes repeated_all_types = 3;
- optional group OptionalGroup = 10 {
- optional TestAllTypes optional_group_all_types = 11;
- }
- repeated group RepeatedGroup = 20 {
- optional TestAllTypes repeated_group_all_types = 21;
- }
- extensions 1000 to max;
- extend TestParsingMerge {
- optional TestAllTypes optional_ext = 1000;
- repeated TestAllTypes repeated_ext = 1001;
- }
-}
-
-message TestCommentInjectionMessage {
- // */ <- This should not close the generated doc comment
- optional string a = 1 [default="*/ <- Neither should this."];
-}
-
-
-// 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/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto
deleted file mode 100644
index 2f4e3fd..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_custom_options.proto
+++ /dev/null
@@ -1,387 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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 proto2.
-
-
-// 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;
-
-// 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;
-
-
-// Some simple test custom options of various types.
-
-extend google.protobuf.FileOptions {
- optional uint64 file_opt1 = 7736974;
-}
-
-extend google.protobuf.MessageOptions {
- optional int32 message_opt1 = 7739036;
-}
-
-extend google.protobuf.FieldOptions {
- optional fixed64 field_opt1 = 7740936;
- // This is useful for testing that we correctly register default values for
- // extension options.
- optional int32 field_opt2 = 7753913 [default=42];
-}
-
-extend google.protobuf.EnumOptions {
- optional sfixed32 enum_opt1 = 7753576;
-}
-
-extend google.protobuf.EnumValueOptions {
- optional int32 enum_value_opt1 = 1560678;
-}
-
-extend google.protobuf.ServiceOptions {
- optional sint64 service_opt1 = 7887650;
-}
-
-enum MethodOpt1 {
- METHODOPT1_VAL1 = 1;
- METHODOPT1_VAL2 = 2;
-}
-
-extend google.protobuf.MethodOptions {
- optional 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;
-
- optional string field1 = 1 [ctype=CORD,
- (field_opt1)=8765432109];
-
- enum AnEnum {
- option (enum_opt1) = -789;
-
- 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_TYPE1 = 22;
- TEST_OPTION_ENUM_TYPE2 = -23;
- }
-}
-
-message DummyMessageInvalidAsOptionType {
-}
-
-extend google.protobuf.MessageOptions {
- optional bool bool_opt = 7706090;
- optional int32 int32_opt = 7705709;
- optional int64 int64_opt = 7705542;
- optional uint32 uint32_opt = 7704880;
- optional uint64 uint64_opt = 7702367;
- optional sint32 sint32_opt = 7701568;
- optional sint64 sint64_opt = 7700863;
- optional fixed32 fixed32_opt = 7700307;
- optional fixed64 fixed64_opt = 7700194;
- optional sfixed32 sfixed32_opt = 7698645;
- optional sfixed64 sfixed64_opt = 7685475;
- optional float float_opt = 7675390;
- optional double double_opt = 7673293;
- optional string string_opt = 7673285;
- optional bytes bytes_opt = 7673238;
- optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233;
- optional 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 {
- optional int32 foo = 1;
- optional int32 foo2 = 2;
- optional int32 foo3 = 3;
-
- extensions 100 to max;
-}
-
-message ComplexOptionType2 {
- optional ComplexOptionType1 bar = 1;
- optional int32 baz = 2;
-
- message ComplexOptionType4 {
- optional int32 waldo = 1;
-
- extend google.protobuf.MessageOptions {
- optional ComplexOptionType4 complex_opt4 = 7633546;
- }
- }
-
- optional ComplexOptionType4 fred = 3;
-
- extensions 100 to max;
-}
-
-message ComplexOptionType3 {
- optional int32 qux = 1;
-
- optional group ComplexOptionType5 = 2 {
- optional int32 plugh = 3;
- }
-}
-
-extend ComplexOptionType1 {
- optional int32 quux = 7663707;
- optional ComplexOptionType3 corge = 7663442;
-}
-
-extend ComplexOptionType2 {
- optional int32 grault = 7650927;
- optional ComplexOptionType1 garply = 7649992;
-}
-
-extend google.protobuf.MessageOptions {
- optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756;
- optional ComplexOptionType2 complex_opt2 = 7636949;
- optional ComplexOptionType3 complex_opt3 = 7636463;
- optional group ComplexOpt6 = 7595468 {
- optional int32 xyzzy = 7593951;
- }
-}
-
-// 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).(.protobuf_unittest.quux) = 324;
- option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
- option (complex_opt2).baz = 987;
- option (complex_opt2).(grault) = 654;
- option (complex_opt2).bar.foo = 743;
- option (complex_opt2).bar.(quux) = 1999;
- option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
- option (complex_opt2).(garply).foo = 741;
- option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
- option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
- option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
- option (complex_opt2).fred.waldo = 321;
- option (protobuf_unittest.complex_opt3).qux = 9;
- option (complex_opt3).complexoptiontype5.plugh = 22;
- option (complexopt6).xyzzy = 24;
-}
-
-// ------------------------------------------------------
-// Definitions for testing aggregate option parsing.
-// See descriptor_unittest.cc.
-
-message AggregateMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
-
-message AggregateMessageSetElement {
- extend AggregateMessageSet {
- optional AggregateMessageSetElement message_set_extension = 15447542;
- }
- optional string s = 1;
-}
-
-// A helper type used to test aggregate option parsing
-message Aggregate {
- optional int32 i = 1;
- optional string s = 2;
-
- // A nested object
- optional Aggregate sub = 3;
-
- // To test the parsing of extensions inside aggregate values
- optional google.protobuf.FileOptions file = 4;
- extend google.protobuf.FileOptions {
- optional Aggregate nested = 15476903;
- }
-
- // An embedded message set
- optional AggregateMessageSet mset = 5;
-}
-
-// Allow Aggregate to be used as an option at all possible locations
-// in the .proto grammar.
-extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; }
-extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; }
-extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; }
-extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; }
-extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
-extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; }
-extend google.protobuf.MethodOptions { optional 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' }
-
- // Include a google.protobuf.FileOptions and recursively extend it with
- // another fileopt.
- file {
- [protobuf_unittest.fileopt] {
- s:'FileExtensionAnnotation'
- }
- }
-
- // A message set inside an option value
- mset {
- [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
- s: 'EmbeddedMessageSetElement'
- }
- }
-};
-
-message AggregateMessage {
- option (msgopt) = { i:101 s:'MessageAnnotation' };
- optional 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' };
- VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
-}
-
-// Test custom options for nested type.
-message NestedOptionType {
- message NestedMessage {
- option (message_opt1) = 1001;
- optional int32 nested_field = 1 [(field_opt1) = 1002];
- }
- enum NestedEnum {
- option (enum_opt1) = 1003;
- NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004];
- }
- extend google.protobuf.FileOptions {
- optional int32 nested_extension = 7912573 [(field_opt2) = 1005];
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
deleted file mode 100644
index fa17625..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
+++ /dev/null
@@ -1,50 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// A proto file which imports a proto file that uses optimize_for = CODE_SIZE.
-
-import "google/protobuf/unittest_optimize_for.proto";
-
-package protobuf_unittest;
-
-// We optimize for speed here, but we are importing a proto that is optimized
-// for code size.
-option optimize_for = SPEED;
-
-message TestEmbedOptimizedForSize {
- // Test that embedding a message which has optimize_for = CODE_SIZE into
- // one optimized for speed works.
- optional TestOptimizedForSize optional_message = 1;
- repeated TestOptimizedForSize repeated_message = 2;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto
deleted file mode 100644
index ab12d1f..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_empty.proto
+++ /dev/null
@@ -1,37 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file intentionally left blank. (At one point this wouldn't compile
-// correctly.)
-
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
deleted file mode 100644
index bc0b7c1..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
+++ /dev/null
@@ -1,1046 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// A proto file that has an extremely large descriptor. Used to test that
-// descriptors over 64k don't break the string literal length limit in Java.
-
-
-package google.protobuf;
-option java_package = "com.google.protobuf";
-
-// Avoid generating insanely long methods.
-option optimize_for = CODE_SIZE;
-
-message TestEnormousDescriptor {
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1 = 1 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_2 = 2 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_3 = 3 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_4 = 4 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_5 = 5 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_6 = 6 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_7 = 7 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_8 = 8 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_9 = 9 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_10 = 10 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_11 = 11 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_12 = 12 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_13 = 13 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_14 = 14 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_15 = 15 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_16 = 16 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_17 = 17 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_18 = 18 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_19 = 19 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_20 = 20 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_21 = 21 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_22 = 22 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_23 = 23 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_24 = 24 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_25 = 25 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_26 = 26 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_27 = 27 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_28 = 28 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_29 = 29 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_30 = 30 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_31 = 31 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_32 = 32 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_33 = 33 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_34 = 34 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_35 = 35 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_36 = 36 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_37 = 37 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_38 = 38 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_39 = 39 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_40 = 40 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_41 = 41 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_42 = 42 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_43 = 43 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_44 = 44 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_45 = 45 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_46 = 46 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_47 = 47 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_48 = 48 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_49 = 49 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_50 = 50 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_51 = 51 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_52 = 52 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_53 = 53 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_54 = 54 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_55 = 55 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_56 = 56 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_57 = 57 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_58 = 58 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_59 = 59 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_60 = 60 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_61 = 61 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_62 = 62 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_63 = 63 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_64 = 64 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_65 = 65 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_66 = 66 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_67 = 67 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_68 = 68 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_69 = 69 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_70 = 70 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_71 = 71 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_72 = 72 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_73 = 73 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_74 = 74 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_75 = 75 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_76 = 76 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_77 = 77 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_78 = 78 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_79 = 79 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_80 = 80 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_81 = 81 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_82 = 82 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_83 = 83 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_84 = 84 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_85 = 85 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_86 = 86 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_87 = 87 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_88 = 88 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_89 = 89 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_90 = 90 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_91 = 91 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_92 = 92 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_93 = 93 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_94 = 94 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_95 = 95 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_96 = 96 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_97 = 97 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_98 = 98 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_99 = 99 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_100 = 100 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_101 = 101 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_102 = 102 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_103 = 103 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_104 = 104 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_105 = 105 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_106 = 106 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_107 = 107 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_108 = 108 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_109 = 109 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_110 = 110 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_111 = 111 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_112 = 112 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_113 = 113 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_114 = 114 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_115 = 115 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_116 = 116 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_117 = 117 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_118 = 118 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_119 = 119 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_120 = 120 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_121 = 121 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_122 = 122 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_123 = 123 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_124 = 124 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_125 = 125 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_126 = 126 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_127 = 127 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_128 = 128 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_129 = 129 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_130 = 130 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_131 = 131 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_132 = 132 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_133 = 133 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_134 = 134 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_135 = 135 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_136 = 136 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_137 = 137 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_138 = 138 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_139 = 139 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_140 = 140 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_141 = 141 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_142 = 142 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_143 = 143 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_144 = 144 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_145 = 145 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_146 = 146 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_147 = 147 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_148 = 148 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_149 = 149 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_150 = 150 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_151 = 151 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_152 = 152 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_153 = 153 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_154 = 154 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_155 = 155 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_156 = 156 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_157 = 157 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_158 = 158 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_159 = 159 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_160 = 160 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_161 = 161 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_162 = 162 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_163 = 163 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_164 = 164 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_165 = 165 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_166 = 166 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_167 = 167 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_168 = 168 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_169 = 169 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_170 = 170 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_171 = 171 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_172 = 172 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_173 = 173 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_174 = 174 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_175 = 175 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_176 = 176 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_177 = 177 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_178 = 178 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_179 = 179 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_180 = 180 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_181 = 181 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_182 = 182 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_183 = 183 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_184 = 184 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_185 = 185 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_186 = 186 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_187 = 187 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_188 = 188 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_189 = 189 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_190 = 190 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_191 = 191 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_192 = 192 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_193 = 193 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_194 = 194 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_195 = 195 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_196 = 196 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_197 = 197 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_198 = 198 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_199 = 199 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_200 = 200 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_201 = 201 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_202 = 202 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_203 = 203 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_204 = 204 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_205 = 205 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_206 = 206 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_207 = 207 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_208 = 208 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_209 = 209 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_210 = 210 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_211 = 211 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_212 = 212 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_213 = 213 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_214 = 214 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_215 = 215 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_216 = 216 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_217 = 217 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_218 = 218 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_219 = 219 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_220 = 220 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_221 = 221 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_222 = 222 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_223 = 223 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_224 = 224 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_225 = 225 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_226 = 226 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_227 = 227 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_228 = 228 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_229 = 229 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_230 = 230 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_231 = 231 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_232 = 232 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_233 = 233 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_234 = 234 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_235 = 235 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_236 = 236 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_237 = 237 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_238 = 238 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_239 = 239 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_240 = 240 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_241 = 241 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_242 = 242 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_243 = 243 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_244 = 244 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_245 = 245 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_246 = 246 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_247 = 247 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_248 = 248 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_249 = 249 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_250 = 250 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_251 = 251 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_252 = 252 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_253 = 253 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_254 = 254 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_255 = 255 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_256 = 256 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_257 = 257 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_258 = 258 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_259 = 259 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_260 = 260 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_261 = 261 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_262 = 262 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_263 = 263 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_264 = 264 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_265 = 265 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_266 = 266 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_267 = 267 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_268 = 268 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_269 = 269 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_270 = 270 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_271 = 271 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_272 = 272 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_273 = 273 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_274 = 274 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_275 = 275 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_276 = 276 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_277 = 277 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_278 = 278 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_279 = 279 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_280 = 280 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_281 = 281 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_282 = 282 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_283 = 283 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_284 = 284 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_285 = 285 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_286 = 286 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_287 = 287 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_288 = 288 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_289 = 289 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_290 = 290 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_291 = 291 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_292 = 292 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_293 = 293 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_294 = 294 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_295 = 295 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_296 = 296 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_297 = 297 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_298 = 298 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_299 = 299 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_300 = 300 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_301 = 301 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_302 = 302 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_303 = 303 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_304 = 304 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_305 = 305 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_306 = 306 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_307 = 307 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_308 = 308 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_309 = 309 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_310 = 310 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_311 = 311 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_312 = 312 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_313 = 313 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_314 = 314 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_315 = 315 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_316 = 316 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_317 = 317 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_318 = 318 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_319 = 319 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_320 = 320 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_321 = 321 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_322 = 322 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_323 = 323 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_324 = 324 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_325 = 325 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_326 = 326 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_327 = 327 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_328 = 328 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_329 = 329 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_330 = 330 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_331 = 331 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_332 = 332 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_333 = 333 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_334 = 334 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_335 = 335 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_336 = 336 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_337 = 337 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_338 = 338 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_339 = 339 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_340 = 340 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_341 = 341 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_342 = 342 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_343 = 343 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_344 = 344 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_345 = 345 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_346 = 346 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_347 = 347 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_348 = 348 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_349 = 349 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_350 = 350 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_351 = 351 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_352 = 352 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_353 = 353 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_354 = 354 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_355 = 355 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_356 = 356 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_357 = 357 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_358 = 358 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_359 = 359 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_360 = 360 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_361 = 361 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_362 = 362 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_363 = 363 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_364 = 364 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_365 = 365 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_366 = 366 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_367 = 367 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_368 = 368 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_369 = 369 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_370 = 370 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_371 = 371 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_372 = 372 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_373 = 373 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_374 = 374 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_375 = 375 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_376 = 376 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_377 = 377 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_378 = 378 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_379 = 379 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_380 = 380 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_381 = 381 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_382 = 382 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_383 = 383 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_384 = 384 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_385 = 385 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_386 = 386 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_387 = 387 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_388 = 388 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_389 = 389 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_390 = 390 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_391 = 391 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_392 = 392 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_393 = 393 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_394 = 394 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_395 = 395 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_396 = 396 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_397 = 397 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_398 = 398 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_399 = 399 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_400 = 400 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_401 = 401 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_402 = 402 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_403 = 403 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_404 = 404 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_405 = 405 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_406 = 406 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_407 = 407 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_408 = 408 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_409 = 409 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_410 = 410 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_411 = 411 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_412 = 412 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_413 = 413 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_414 = 414 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_415 = 415 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_416 = 416 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_417 = 417 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_418 = 418 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_419 = 419 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_420 = 420 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_421 = 421 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_422 = 422 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_423 = 423 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_424 = 424 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_425 = 425 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_426 = 426 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_427 = 427 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_428 = 428 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_429 = 429 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_430 = 430 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_431 = 431 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_432 = 432 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_433 = 433 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_434 = 434 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_435 = 435 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_436 = 436 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_437 = 437 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_438 = 438 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_439 = 439 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_440 = 440 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_441 = 441 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_442 = 442 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_443 = 443 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_444 = 444 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_445 = 445 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_446 = 446 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_447 = 447 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_448 = 448 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_449 = 449 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_450 = 450 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_451 = 451 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_452 = 452 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_453 = 453 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_454 = 454 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_455 = 455 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_456 = 456 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_457 = 457 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_458 = 458 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_459 = 459 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_460 = 460 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_461 = 461 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_462 = 462 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_463 = 463 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_464 = 464 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_465 = 465 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_466 = 466 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_467 = 467 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_468 = 468 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_469 = 469 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_470 = 470 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_471 = 471 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_472 = 472 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_473 = 473 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_474 = 474 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_475 = 475 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_476 = 476 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_477 = 477 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_478 = 478 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_479 = 479 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_480 = 480 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_481 = 481 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_482 = 482 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_483 = 483 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_484 = 484 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_485 = 485 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_486 = 486 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_487 = 487 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_488 = 488 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_489 = 489 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_490 = 490 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_491 = 491 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_492 = 492 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_493 = 493 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_494 = 494 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_495 = 495 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_496 = 496 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_497 = 497 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_498 = 498 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_499 = 499 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_500 = 500 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_501 = 501 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_502 = 502 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_503 = 503 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_504 = 504 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_505 = 505 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_506 = 506 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_507 = 507 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_508 = 508 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_509 = 509 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_510 = 510 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_511 = 511 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_512 = 512 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_513 = 513 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_514 = 514 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_515 = 515 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_516 = 516 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_517 = 517 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_518 = 518 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_519 = 519 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_520 = 520 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_521 = 521 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_522 = 522 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_523 = 523 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_524 = 524 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_525 = 525 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_526 = 526 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_527 = 527 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_528 = 528 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_529 = 529 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_530 = 530 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_531 = 531 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_532 = 532 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_533 = 533 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_534 = 534 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_535 = 535 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_536 = 536 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_537 = 537 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_538 = 538 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_539 = 539 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_540 = 540 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_541 = 541 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_542 = 542 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_543 = 543 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_544 = 544 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_545 = 545 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_546 = 546 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_547 = 547 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_548 = 548 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_549 = 549 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_550 = 550 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_551 = 551 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_552 = 552 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_553 = 553 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_554 = 554 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_555 = 555 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_556 = 556 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_557 = 557 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_558 = 558 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_559 = 559 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_560 = 560 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_561 = 561 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_562 = 562 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_563 = 563 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_564 = 564 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_565 = 565 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_566 = 566 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_567 = 567 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_568 = 568 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_569 = 569 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_570 = 570 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_571 = 571 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_572 = 572 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_573 = 573 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_574 = 574 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_575 = 575 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_576 = 576 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_577 = 577 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_578 = 578 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_579 = 579 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_580 = 580 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_581 = 581 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_582 = 582 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_583 = 583 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_584 = 584 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_585 = 585 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_586 = 586 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_587 = 587 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_588 = 588 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_589 = 589 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_590 = 590 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_591 = 591 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_592 = 592 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_593 = 593 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_594 = 594 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_595 = 595 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_596 = 596 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_597 = 597 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_598 = 598 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_599 = 599 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_600 = 600 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_601 = 601 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_602 = 602 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_603 = 603 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_604 = 604 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_605 = 605 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_606 = 606 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_607 = 607 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_608 = 608 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_609 = 609 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_610 = 610 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_611 = 611 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_612 = 612 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_613 = 613 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_614 = 614 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_615 = 615 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_616 = 616 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_617 = 617 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_618 = 618 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_619 = 619 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_620 = 620 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_621 = 621 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_622 = 622 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_623 = 623 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_624 = 624 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_625 = 625 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_626 = 626 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_627 = 627 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_628 = 628 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_629 = 629 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_630 = 630 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_631 = 631 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_632 = 632 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_633 = 633 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_634 = 634 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_635 = 635 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_636 = 636 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_637 = 637 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_638 = 638 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_639 = 639 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_640 = 640 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_641 = 641 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_642 = 642 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_643 = 643 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_644 = 644 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_645 = 645 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_646 = 646 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_647 = 647 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_648 = 648 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_649 = 649 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_650 = 650 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_651 = 651 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_652 = 652 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_653 = 653 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_654 = 654 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_655 = 655 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_656 = 656 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_657 = 657 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_658 = 658 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_659 = 659 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_660 = 660 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_661 = 661 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_662 = 662 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_663 = 663 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_664 = 664 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_665 = 665 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_666 = 666 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_667 = 667 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_668 = 668 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_669 = 669 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_670 = 670 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_671 = 671 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_672 = 672 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_673 = 673 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_674 = 674 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_675 = 675 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_676 = 676 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_677 = 677 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_678 = 678 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_679 = 679 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_680 = 680 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_681 = 681 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_682 = 682 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_683 = 683 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_684 = 684 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_685 = 685 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_686 = 686 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_687 = 687 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_688 = 688 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_689 = 689 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_690 = 690 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_691 = 691 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_692 = 692 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_693 = 693 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_694 = 694 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_695 = 695 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_696 = 696 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_697 = 697 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_698 = 698 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_699 = 699 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_700 = 700 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_701 = 701 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_702 = 702 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_703 = 703 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_704 = 704 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_705 = 705 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_706 = 706 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_707 = 707 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_708 = 708 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_709 = 709 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_710 = 710 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_711 = 711 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_712 = 712 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_713 = 713 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_714 = 714 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_715 = 715 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_716 = 716 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_717 = 717 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_718 = 718 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_719 = 719 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_720 = 720 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_721 = 721 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_722 = 722 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_723 = 723 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_724 = 724 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_725 = 725 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_726 = 726 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_727 = 727 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_728 = 728 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_729 = 729 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_730 = 730 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_731 = 731 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_732 = 732 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_733 = 733 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_734 = 734 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_735 = 735 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_736 = 736 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_737 = 737 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_738 = 738 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_739 = 739 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_740 = 740 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_741 = 741 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_742 = 742 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_743 = 743 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_744 = 744 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_745 = 745 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_746 = 746 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_747 = 747 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_748 = 748 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_749 = 749 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_750 = 750 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_751 = 751 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_752 = 752 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_753 = 753 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_754 = 754 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_755 = 755 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_756 = 756 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_757 = 757 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_758 = 758 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_759 = 759 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_760 = 760 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_761 = 761 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_762 = 762 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_763 = 763 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_764 = 764 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_765 = 765 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_766 = 766 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_767 = 767 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_768 = 768 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_769 = 769 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_770 = 770 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_771 = 771 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_772 = 772 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_773 = 773 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_774 = 774 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_775 = 775 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_776 = 776 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_777 = 777 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_778 = 778 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_779 = 779 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_780 = 780 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_781 = 781 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_782 = 782 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_783 = 783 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_784 = 784 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_785 = 785 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_786 = 786 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_787 = 787 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_788 = 788 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_789 = 789 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_790 = 790 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_791 = 791 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_792 = 792 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_793 = 793 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_794 = 794 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_795 = 795 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_796 = 796 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_797 = 797 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_798 = 798 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_799 = 799 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_800 = 800 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_801 = 801 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_802 = 802 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_803 = 803 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_804 = 804 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_805 = 805 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_806 = 806 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_807 = 807 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_808 = 808 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_809 = 809 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_810 = 810 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_811 = 811 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_812 = 812 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_813 = 813 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_814 = 814 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_815 = 815 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_816 = 816 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_817 = 817 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_818 = 818 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_819 = 819 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_820 = 820 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_821 = 821 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_822 = 822 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_823 = 823 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_824 = 824 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_825 = 825 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_826 = 826 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_827 = 827 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_828 = 828 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_829 = 829 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_830 = 830 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_831 = 831 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_832 = 832 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_833 = 833 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_834 = 834 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_835 = 835 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_836 = 836 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_837 = 837 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_838 = 838 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_839 = 839 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_840 = 840 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_841 = 841 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_842 = 842 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_843 = 843 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_844 = 844 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_845 = 845 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_846 = 846 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_847 = 847 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_848 = 848 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_849 = 849 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_850 = 850 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_851 = 851 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_852 = 852 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_853 = 853 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_854 = 854 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_855 = 855 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_856 = 856 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_857 = 857 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_858 = 858 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_859 = 859 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_860 = 860 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_861 = 861 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_862 = 862 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_863 = 863 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_864 = 864 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_865 = 865 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_866 = 866 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_867 = 867 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_868 = 868 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_869 = 869 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_870 = 870 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_871 = 871 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_872 = 872 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_873 = 873 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_874 = 874 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_875 = 875 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_876 = 876 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_877 = 877 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_878 = 878 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_879 = 879 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_880 = 880 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_881 = 881 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_882 = 882 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_883 = 883 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_884 = 884 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_885 = 885 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_886 = 886 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_887 = 887 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_888 = 888 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_889 = 889 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_890 = 890 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_891 = 891 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_892 = 892 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_893 = 893 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_894 = 894 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_895 = 895 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_896 = 896 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_897 = 897 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_898 = 898 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_899 = 899 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_900 = 900 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_901 = 901 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_902 = 902 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_903 = 903 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_904 = 904 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_905 = 905 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_906 = 906 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_907 = 907 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_908 = 908 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_909 = 909 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_910 = 910 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_911 = 911 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_912 = 912 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_913 = 913 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_914 = 914 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_915 = 915 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_916 = 916 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_917 = 917 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_918 = 918 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_919 = 919 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_920 = 920 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_921 = 921 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_922 = 922 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_923 = 923 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_924 = 924 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_925 = 925 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_926 = 926 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_927 = 927 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_928 = 928 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_929 = 929 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_930 = 930 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_931 = 931 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_932 = 932 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_933 = 933 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_934 = 934 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_935 = 935 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_936 = 936 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_937 = 937 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_938 = 938 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_939 = 939 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_940 = 940 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_941 = 941 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_942 = 942 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_943 = 943 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_944 = 944 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_945 = 945 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_946 = 946 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_947 = 947 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_948 = 948 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_949 = 949 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_950 = 950 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_951 = 951 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_952 = 952 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_953 = 953 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_954 = 954 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_955 = 955 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_956 = 956 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_957 = 957 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_958 = 958 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_959 = 959 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_960 = 960 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_961 = 961 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_962 = 962 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_963 = 963 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_964 = 964 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_965 = 965 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_966 = 966 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_967 = 967 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_968 = 968 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_969 = 969 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_970 = 970 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_971 = 971 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_972 = 972 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_973 = 973 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_974 = 974 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_975 = 975 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_976 = 976 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_977 = 977 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_978 = 978 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_979 = 979 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_980 = 980 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_981 = 981 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_982 = 982 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_983 = 983 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_984 = 984 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_985 = 985 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_986 = 986 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_987 = 987 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_988 = 988 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_989 = 989 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_990 = 990 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_991 = 991 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_992 = 992 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_993 = 993 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_994 = 994 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_995 = 995 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_996 = 996 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_997 = 997 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_998 = 998 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_999 = 999 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1000 = 1000 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto
deleted file mode 100644
index ec36cca..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import.proto
+++ /dev/null
@@ -1,64 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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.proto to test importing.
-
-
-// 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;
-
-option optimize_for = SPEED;
-
-// Exercise the java_package option.
-option java_package = "com.google.protobuf.test";
-
-// 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.proto";
-
-message ImportMessage {
- optional int32 d = 1;
-}
-
-enum ImportEnum {
- IMPORT_FOO = 7;
- IMPORT_BAR = 8;
- IMPORT_BAZ = 9;
-}
-
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto
deleted file mode 100644
index 81b117f..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_lite.proto
+++ /dev/null
@@ -1,51 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME.
-
-package protobuf_unittest_import;
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.google.protobuf";
-
-import public "google/protobuf/unittest_import_public_lite.proto";
-
-message ImportMessageLite {
- optional int32 d = 1;
-}
-
-enum ImportEnumLite {
- IMPORT_LITE_FOO = 7;
- IMPORT_LITE_BAR = 8;
- IMPORT_LITE_BAZ = 9;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto
deleted file mode 100644
index ea5d1b1..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public.proto
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: liujisi@google.com (Pherl Liu)
-
-
-package protobuf_unittest_import;
-
-option java_package = "com.google.protobuf.test";
-
-message PublicImportMessage {
- optional int32 e = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto
deleted file mode 100644
index d077563..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_import_public_lite.proto
+++ /dev/null
@@ -1,42 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: liujisi@google.com (Pherl Liu)
-
-
-package protobuf_unittest_import;
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.google.protobuf";
-
-message PublicImportMessageLite {
- optional int32 e = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto
deleted file mode 100644
index a1764aa..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite.proto
+++ /dev/null
@@ -1,360 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// This is like unittest.proto but with optimize_for = LITE_RUNTIME.
-
-package protobuf_unittest;
-
-import "google/protobuf/unittest_import_lite.proto";
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.google.protobuf";
-
-// Same as TestAllTypes but with the lite runtime.
-message TestAllTypesLite {
- message NestedMessage {
- optional int32 bb = 1;
- }
-
- enum NestedEnum {
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- }
-
- // Singular
- optional int32 optional_int32 = 1;
- optional int64 optional_int64 = 2;
- optional uint32 optional_uint32 = 3;
- optional uint64 optional_uint64 = 4;
- optional sint32 optional_sint32 = 5;
- optional sint64 optional_sint64 = 6;
- optional fixed32 optional_fixed32 = 7;
- optional fixed64 optional_fixed64 = 8;
- optional sfixed32 optional_sfixed32 = 9;
- optional sfixed64 optional_sfixed64 = 10;
- optional float optional_float = 11;
- optional double optional_double = 12;
- optional bool optional_bool = 13;
- optional string optional_string = 14;
- optional bytes optional_bytes = 15;
-
- optional group OptionalGroup = 16 {
- optional int32 a = 17;
- }
-
- optional NestedMessage optional_nested_message = 18;
- optional ForeignMessageLite optional_foreign_message = 19;
- optional protobuf_unittest_import.ImportMessageLite
- optional_import_message = 20;
-
- optional NestedEnum optional_nested_enum = 21;
- optional ForeignEnumLite optional_foreign_enum = 22;
- optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23;
-
- optional string optional_string_piece = 24 [ctype=STRING_PIECE];
- optional string optional_cord = 25 [ctype=CORD];
-
- // Defined in unittest_import_public.proto
- optional protobuf_unittest_import.PublicImportMessageLite
- optional_public_import_message = 26;
-
- optional NestedMessage optional_lazy_message = 27 [lazy=true];
-
- // 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 group RepeatedGroup = 46 {
- optional int32 a = 47;
- }
-
- repeated NestedMessage repeated_nested_message = 48;
- repeated ForeignMessageLite repeated_foreign_message = 49;
- repeated protobuf_unittest_import.ImportMessageLite
- repeated_import_message = 50;
-
- repeated NestedEnum repeated_nested_enum = 51;
- repeated ForeignEnumLite repeated_foreign_enum = 52;
- repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53;
-
- repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord = 55 [ctype=CORD];
-
- repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32 = 61 [default = 41 ];
- optional int64 default_int64 = 62 [default = 42 ];
- optional uint32 default_uint32 = 63 [default = 43 ];
- optional uint64 default_uint64 = 64 [default = 44 ];
- optional sint32 default_sint32 = 65 [default = -45 ];
- optional sint64 default_sint64 = 66 [default = 46 ];
- optional fixed32 default_fixed32 = 67 [default = 47 ];
- optional fixed64 default_fixed64 = 68 [default = 48 ];
- optional sfixed32 default_sfixed32 = 69 [default = 49 ];
- optional sfixed64 default_sfixed64 = 70 [default = -50 ];
- optional float default_float = 71 [default = 51.5 ];
- optional double default_double = 72 [default = 52e3 ];
- optional bool default_bool = 73 [default = true ];
- optional string default_string = 74 [default = "hello"];
- optional bytes default_bytes = 75 [default = "world"];
-
- optional NestedEnum default_nested_enum = 81 [default = BAR];
- optional ForeignEnumLite default_foreign_enum = 82
- [default = FOREIGN_LITE_BAR];
- optional protobuf_unittest_import.ImportEnumLite
- default_import_enum = 83 [default = IMPORT_LITE_BAR];
-
- optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
- optional string default_cord = 85 [ctype=CORD,default="123"];
-}
-
-message ForeignMessageLite {
- optional int32 c = 1;
-}
-
-enum ForeignEnumLite {
- FOREIGN_LITE_FOO = 4;
- FOREIGN_LITE_BAR = 5;
- FOREIGN_LITE_BAZ = 6;
-}
-
-message TestPackedTypesLite {
- 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 ForeignEnumLite packed_enum = 103 [packed = true];
-}
-
-message TestAllExtensionsLite {
- extensions 1 to max;
-}
-
-extend TestAllExtensionsLite {
- // Singular
- optional int32 optional_int32_extension_lite = 1;
- optional int64 optional_int64_extension_lite = 2;
- optional uint32 optional_uint32_extension_lite = 3;
- optional uint64 optional_uint64_extension_lite = 4;
- optional sint32 optional_sint32_extension_lite = 5;
- optional sint64 optional_sint64_extension_lite = 6;
- optional fixed32 optional_fixed32_extension_lite = 7;
- optional fixed64 optional_fixed64_extension_lite = 8;
- optional sfixed32 optional_sfixed32_extension_lite = 9;
- optional sfixed64 optional_sfixed64_extension_lite = 10;
- optional float optional_float_extension_lite = 11;
- optional double optional_double_extension_lite = 12;
- optional bool optional_bool_extension_lite = 13;
- optional string optional_string_extension_lite = 14;
- optional bytes optional_bytes_extension_lite = 15;
-
- optional group OptionalGroup_extension_lite = 16 {
- optional int32 a = 17;
- }
-
- optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite
- = 18;
- optional ForeignMessageLite optional_foreign_message_extension_lite = 19;
- optional protobuf_unittest_import.ImportMessageLite
- optional_import_message_extension_lite = 20;
-
- optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21;
- optional ForeignEnumLite optional_foreign_enum_extension_lite = 22;
- optional protobuf_unittest_import.ImportEnumLite
- optional_import_enum_extension_lite = 23;
-
- optional string optional_string_piece_extension_lite = 24
- [ctype=STRING_PIECE];
- optional string optional_cord_extension_lite = 25 [ctype=CORD];
-
- optional protobuf_unittest_import.PublicImportMessageLite
- optional_public_import_message_extension_lite = 26;
-
- optional TestAllTypesLite.NestedMessage
- optional_lazy_message_extension_lite = 27 [lazy=true];
-
- // Repeated
- repeated int32 repeated_int32_extension_lite = 31;
- repeated int64 repeated_int64_extension_lite = 32;
- repeated uint32 repeated_uint32_extension_lite = 33;
- repeated uint64 repeated_uint64_extension_lite = 34;
- repeated sint32 repeated_sint32_extension_lite = 35;
- repeated sint64 repeated_sint64_extension_lite = 36;
- repeated fixed32 repeated_fixed32_extension_lite = 37;
- repeated fixed64 repeated_fixed64_extension_lite = 38;
- repeated sfixed32 repeated_sfixed32_extension_lite = 39;
- repeated sfixed64 repeated_sfixed64_extension_lite = 40;
- repeated float repeated_float_extension_lite = 41;
- repeated double repeated_double_extension_lite = 42;
- repeated bool repeated_bool_extension_lite = 43;
- repeated string repeated_string_extension_lite = 44;
- repeated bytes repeated_bytes_extension_lite = 45;
-
- repeated group RepeatedGroup_extension_lite = 46 {
- optional int32 a = 47;
- }
-
- repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite
- = 48;
- repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49;
- repeated protobuf_unittest_import.ImportMessageLite
- repeated_import_message_extension_lite = 50;
-
- repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51;
- repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52;
- repeated protobuf_unittest_import.ImportEnumLite
- repeated_import_enum_extension_lite = 53;
-
- repeated string repeated_string_piece_extension_lite = 54
- [ctype=STRING_PIECE];
- repeated string repeated_cord_extension_lite = 55 [ctype=CORD];
-
- repeated TestAllTypesLite.NestedMessage
- repeated_lazy_message_extension_lite = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32_extension_lite = 61 [default = 41 ];
- optional int64 default_int64_extension_lite = 62 [default = 42 ];
- optional uint32 default_uint32_extension_lite = 63 [default = 43 ];
- optional uint64 default_uint64_extension_lite = 64 [default = 44 ];
- optional sint32 default_sint32_extension_lite = 65 [default = -45 ];
- optional sint64 default_sint64_extension_lite = 66 [default = 46 ];
- optional fixed32 default_fixed32_extension_lite = 67 [default = 47 ];
- optional fixed64 default_fixed64_extension_lite = 68 [default = 48 ];
- optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49 ];
- optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50 ];
- optional float default_float_extension_lite = 71 [default = 51.5 ];
- optional double default_double_extension_lite = 72 [default = 52e3 ];
- optional bool default_bool_extension_lite = 73 [default = true ];
- optional string default_string_extension_lite = 74 [default = "hello"];
- optional bytes default_bytes_extension_lite = 75 [default = "world"];
-
- optional TestAllTypesLite.NestedEnum
- default_nested_enum_extension_lite = 81 [default = BAR];
- optional ForeignEnumLite
- default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR];
- optional protobuf_unittest_import.ImportEnumLite
- default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR];
-
- optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE,
- default="abc"];
- optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"];
-}
-
-message TestPackedExtensionsLite {
- extensions 1 to max;
-}
-
-extend TestPackedExtensionsLite {
- repeated int32 packed_int32_extension_lite = 90 [packed = true];
- repeated int64 packed_int64_extension_lite = 91 [packed = true];
- repeated uint32 packed_uint32_extension_lite = 92 [packed = true];
- repeated uint64 packed_uint64_extension_lite = 93 [packed = true];
- repeated sint32 packed_sint32_extension_lite = 94 [packed = true];
- repeated sint64 packed_sint64_extension_lite = 95 [packed = true];
- repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true];
- repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true];
- repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true];
- repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true];
- repeated float packed_float_extension_lite = 100 [packed = true];
- repeated double packed_double_extension_lite = 101 [packed = true];
- repeated bool packed_bool_extension_lite = 102 [packed = true];
- repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true];
-}
-
-message TestNestedExtensionLite {
- extend TestAllExtensionsLite {
- optional int32 nested_extension = 12345;
- }
-}
-
-// Test that deprecated fields work. We only verify that they compile (at one
-// point this failed).
-message TestDeprecatedLite {
- optional int32 deprecated_field = 1 [deprecated = true];
-}
-
-// See the comments of the same type in unittest.proto.
-message TestParsingMergeLite {
- message RepeatedFieldsGenerator {
- repeated TestAllTypesLite field1 = 1;
- repeated TestAllTypesLite field2 = 2;
- repeated TestAllTypesLite field3 = 3;
- repeated group Group1 = 10 {
- optional TestAllTypesLite field1 = 11;
- }
- repeated group Group2 = 20 {
- optional TestAllTypesLite field1 = 21;
- }
- repeated TestAllTypesLite ext1 = 1000;
- repeated TestAllTypesLite ext2 = 1001;
- }
- required TestAllTypesLite required_all_types = 1;
- optional TestAllTypesLite optional_all_types = 2;
- repeated TestAllTypesLite repeated_all_types = 3;
- optional group OptionalGroup = 10 {
- optional TestAllTypesLite optional_group_all_types = 11;
- }
- repeated group RepeatedGroup = 20 {
- optional TestAllTypesLite repeated_group_all_types = 21;
- }
- extensions 1000 to max;
- extend TestParsingMergeLite {
- optional TestAllTypesLite optional_ext = 1000;
- repeated TestAllTypesLite repeated_ext = 1001;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
deleted file mode 100644
index d52cb8c..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
+++ /dev/null
@@ -1,43 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// Tests that a "lite" message can import a regular message.
-
-package protobuf_unittest;
-
-import "google/protobuf/unittest.proto";
-
-option optimize_for = LITE_RUNTIME;
-
-message TestLiteImportsNonlite {
- optional TestAllTypes message = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto
deleted file mode 100644
index 3497f09..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_mset.proto
+++ /dev/null
@@ -1,72 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file contains messages for testing message_set_wire_format.
-
-package protobuf_unittest;
-
-option optimize_for = SPEED;
-
-// A message with message_set_wire_format.
-message TestMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
-
-message TestMessageSetContainer {
- optional TestMessageSet message_set = 1;
-}
-
-message TestMessageSetExtension1 {
- extend TestMessageSet {
- optional TestMessageSetExtension1 message_set_extension = 1545008;
- }
- optional int32 i = 15;
-}
-
-message TestMessageSetExtension2 {
- extend TestMessageSet {
- optional TestMessageSetExtension2 message_set_extension = 1547769;
- }
- optional string str = 25;
-}
-
-// MessageSet wire format is equivalent to this.
-message RawMessageSet {
- repeated group Item = 1 {
- required int32 type_id = 2;
- required bytes message = 3;
- }
-}
-
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto
deleted file mode 100644
index cffb412..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_no_generic_services.proto
+++ /dev/null
@@ -1,52 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-
-package google.protobuf.no_generic_services_test;
-
-// *_generic_services are false by default.
-
-message TestMessage {
- optional int32 a = 1;
- extensions 1000 to max;
-}
-
-enum TestEnum {
- FOO = 1;
-}
-
-extend TestMessage {
- optional int32 test_extension = 1000;
-}
-
-service TestService {
- rpc Foo(TestMessage) returns(TestMessage);
-}
diff --git a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto b/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto
deleted file mode 100644
index 658c6a9..0000000
--- a/java/compatibility_tests/v2.5.0/more_protos/src/proto/google/protobuf/unittest_optimize_for.proto
+++ /dev/null
@@ -1,61 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// A proto file which uses optimize_for = CODE_SIZE.
-
-import "google/protobuf/unittest.proto";
-
-package protobuf_unittest;
-
-option optimize_for = CODE_SIZE;
-
-message TestOptimizedForSize {
- optional int32 i = 1;
- optional ForeignMessage msg = 19;
-
- extensions 1000 to max;
-
- extend TestOptimizedForSize {
- optional int32 test_extension = 1234;
- optional TestRequiredOptimizedForSize test_extension2 = 1235;
- }
-}
-
-message TestRequiredOptimizedForSize {
- required int32 x = 1;
-}
-
-message TestOptionalOptimizedForSize {
- optional TestRequiredOptimizedForSize o = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/pom.xml b/java/compatibility_tests/v2.5.0/pom.xml
deleted file mode 100644
index 83a7563..0000000
--- a/java/compatibility_tests/v2.5.0/pom.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-test-suite</artifactId>
- <version>2.5.0</version>
- <name>Protocol Buffer Java API compatibility tests</name>
- <packaging>pom</packaging>
- <modules>
- <module>protos</module>
- <module>more_protos</module>
- <module>tests</module>
- </modules>
- <properties>
- <protoc.path>protoc</protoc.path>
- <protobuf.version>2.5.0</protobuf.version>
-
- <protos.protoc.path>${protoc.path}</protos.protoc.path>
- <protos.protobuf.version>${protobuf.version}</protos.protobuf.version>
-
- <more_protos.protoc.path>${protoc.path}</more_protos.protoc.path>
- <more_protos.protobuf.version>${protobuf.version}</more_protos.protobuf.version>
-
- <tests.protobuf.version>${protobuf.version}</tests.protobuf.version>
-
- <protobuf.test.source.path>.</protobuf.test.source.path>
- </properties>
-</project>
diff --git a/java/compatibility_tests/v2.5.0/protos/pom.xml b/java/compatibility_tests/v2.5.0/protos/pom.xml
deleted file mode 100644
index a22e91e..0000000
--- a/java/compatibility_tests/v2.5.0/protos/pom.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-test-suite</artifactId>
- <version>2.5.0</version>
- <relativePath>..</relativePath>
- </parent>
-
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-protos</artifactId>
- <version>2.5.0</version>
-
- <name>Protos for Compatibility test</name>
-
- <dependencies>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>${protos.protobuf.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.6.0</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <mkdir dir="target/generated-sources" />
- <exec executable="${protos.protoc.path}">
- <arg value="--java_out=target/generated-sources" />
- <arg value="--proto_path=src/proto" />
- <arg value="src/proto/google/protobuf/unittest_custom_options.proto" />
- <arg value="src/proto/google/protobuf/unittest_enormous_descriptor.proto" />
- <arg value="src/proto/google/protobuf/unittest_import.proto" />
- <arg value="src/proto/google/protobuf/unittest_import_public.proto" />
- <arg value="src/proto/google/protobuf/unittest_mset.proto" />
- <arg value="src/proto/google/protobuf/unittest_no_generic_services.proto" />
- <arg value="src/proto/com/google/protobuf/nested_builders_test.proto" />
- <arg value="src/proto/com/google/protobuf/nested_extension.proto" />
- <arg value="src/proto/com/google/protobuf/non_nested_extension.proto" />
- <arg value="src/proto/com/google/protobuf/test_bad_identifiers.proto" />
- </exec>
- </tasks>
- <sourceRoot>target/generated-sources</sourceRoot>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto
deleted file mode 100644
index 9a04014..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/multiple_files_test.proto
+++ /dev/null
@@ -1,71 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// A proto file which tests the java_multiple_files option.
-
-
-// Some generic_services option(s) added automatically.
-// See: http://go/proto2-generic-services-default
-option java_generic_services = true; // auto-added
-
-import "google/protobuf/unittest.proto";
-
-package protobuf_unittest;
-
-option java_multiple_files = true;
-option java_outer_classname = "MultipleFilesTestProto";
-
-message MessageWithNoOuter {
- message NestedMessage {
- optional int32 i = 1;
- }
- enum NestedEnum {
- BAZ = 3;
- }
- optional NestedMessage nested = 1;
- repeated TestAllTypes foreign = 2;
- optional NestedEnum nested_enum = 3;
- optional EnumWithNoOuter foreign_enum = 4;
-}
-
-enum EnumWithNoOuter {
- FOO = 1;
- BAR = 2;
-}
-
-service ServiceWithNoOuter {
- rpc Foo(MessageWithNoOuter) returns(TestAllTypes);
-}
-
-extend TestAllExtensions {
- optional int32 extension_with_outer = 1234567;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto
deleted file mode 100644
index abffb9d..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_builders_test.proto
+++ /dev/null
@@ -1,53 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: jonp@google.com (Jon Perlow)
-//
-
-package protobuf_unittest;
-
-option java_multiple_files = true;
-option java_outer_classname = "NestedBuilders";
-
-
-message Vehicle {
- optional Engine engine = 1;
- repeated Wheel wheel = 2;
-}
-
-message Engine {
- optional int32 cylinder = 1;
- optional int32 liters = 2;
-}
-
-message Wheel {
- optional int32 radius = 1;
- optional int32 width = 2;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto
deleted file mode 100644
index 9fe5d56..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension.proto
+++ /dev/null
@@ -1,45 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with nested extensions. Note that this must be defined in
-// a separate file to properly test the initialization of the outer class.
-
-
-import "com/google/protobuf/non_nested_extension.proto";
-
-package protobuf_unittest;
-
-message MyNestedExtension {
- extend MessageToBeExtended {
- optional MessageToBeExtended recursiveExtension = 2;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto
deleted file mode 100644
index 16ee46e..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/nested_extension_lite.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with nested extensions for a MessageLite messages. Note that
-// this must be defined in a separate file to properly test the initialization
-// of the outer class.
-
-
-package protobuf_unittest;
-
-option optimize_for = LITE_RUNTIME;
-
-import "com/google/protobuf/non_nested_extension_lite.proto";
-
-message MyNestedExtensionLite {
- extend MessageLiteToBeExtended {
- optional MessageLiteToBeExtended recursiveExtensionLite = 3;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto
deleted file mode 100644
index f61b419..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension.proto
+++ /dev/null
@@ -1,48 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with extensions.
-
-
-package protobuf_unittest;
-
-message MessageToBeExtended {
- extensions 1 to max;
-}
-
-message MyNonNestedExtension {
-}
-
-extend MessageToBeExtended {
- optional MyNonNestedExtension nonNestedExtension = 1;
-}
-
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
deleted file mode 100644
index 3c82659..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/non_nested_extension_lite.proto
+++ /dev/null
@@ -1,50 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: Darick Tong (darick@google.com)
-//
-// A proto file with extensions for a MessageLite messages.
-
-
-package protobuf_unittest;
-
-option optimize_for = LITE_RUNTIME;
-
-message MessageLiteToBeExtended {
- extensions 1 to max;
-}
-
-message MyNonNestedExtensionLite {
-}
-
-extend MessageLiteToBeExtended {
- optional MyNonNestedExtensionLite nonNestedExtensionLite = 1;
-}
-
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
deleted file mode 100644
index 6e67d97..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/com/google/protobuf/test_bad_identifiers.proto
+++ /dev/null
@@ -1,108 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: jonp@google.com (Jon Perlow)
-
-// This file tests that various identifiers work as field and type names even
-// though the same identifiers are used internally by the java code generator.
-
-
-// Some generic_services option(s) added automatically.
-// See: http://go/proto2-generic-services-default
-option java_generic_services = true; // auto-added
-
-package io_protocol_tests;
-
-option java_package = "com.google.protobuf";
-option java_outer_classname = "TestBadIdentifiersProto";
-
-message TestMessage {
-}
-
-message Descriptor {
- option no_standard_descriptor_accessor = true;
- optional string descriptor = 1;
- message NestedDescriptor {
- option no_standard_descriptor_accessor = true;
- optional string descriptor = 1;
- }
- optional NestedDescriptor nested_descriptor = 2;
-}
-
-message Parser {
- enum ParserEnum {
- PARSER = 1;
- }
- optional ParserEnum parser = 1;
-}
-
-message Deprecated {
- enum TestEnum {
- FOO = 1;
- }
-
- optional int32 field1 = 1 [deprecated=true];
- optional TestEnum field2 = 2 [deprecated=true];
- optional TestMessage field3 = 3 [deprecated=true];
-}
-
-message Override {
- optional int32 override = 1;
-}
-
-message Object {
- optional int32 object = 1;
- optional string string_object = 2;
-}
-
-message String {
- optional string string = 1;
-}
-
-message Integer {
- optional int32 integer = 1;
-}
-
-message Long {
- optional int32 long = 1;
-}
-
-message Float {
- optional float float = 1;
-}
-
-message Double {
- optional double double = 1;
-}
-
-service TestConflictingMethodNames {
- rpc Override(TestMessage) returns (TestMessage);
-}
-
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
deleted file mode 100644
index 95c8d4d..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
+++ /dev/null
@@ -1,620 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// The messages in this file describe the definitions found in .proto files.
-// A valid .proto file can be translated directly to a FileDescriptorProto
-// without any other information (e.g. without reading its imports).
-
-
-
-package google.protobuf;
-option java_package = "com.google.protobuf";
-option java_outer_classname = "DescriptorProtos";
-
-// descriptor.proto must be optimized for speed because reflection-based
-// algorithms don't work during bootstrapping.
-option optimize_for = SPEED;
-
-// The protocol compiler can output a FileDescriptorSet containing the .proto
-// files it parses.
-message FileDescriptorSet {
- repeated FileDescriptorProto file = 1;
-}
-
-// Describes a complete .proto file.
-message FileDescriptorProto {
- optional string name = 1; // file name, relative to root of source tree
- optional string package = 2; // e.g. "foo", "foo.bar", etc.
-
- // Names of files imported by this file.
- repeated string dependency = 3;
- // Indexes of the public imported files in the dependency list above.
- repeated int32 public_dependency = 10;
- // Indexes of the weak imported files in the dependency list.
- // For Google-internal migration only. Do not use.
- repeated int32 weak_dependency = 11;
-
- // All top-level definitions in this file.
- repeated DescriptorProto message_type = 4;
- repeated EnumDescriptorProto enum_type = 5;
- repeated ServiceDescriptorProto service = 6;
- repeated FieldDescriptorProto extension = 7;
-
- optional FileOptions options = 8;
-
- // 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.
- optional SourceCodeInfo source_code_info = 9;
-}
-
-// Describes a message type.
-message DescriptorProto {
- optional string name = 1;
-
- repeated FieldDescriptorProto field = 2;
- repeated FieldDescriptorProto extension = 6;
-
- repeated DescriptorProto nested_type = 3;
- repeated EnumDescriptorProto enum_type = 4;
-
- message ExtensionRange {
- optional int32 start = 1;
- optional int32 end = 2;
- }
- repeated ExtensionRange extension_range = 5;
-
- optional MessageOptions options = 7;
-}
-
-// Describes a field within a message.
-message FieldDescriptorProto {
- enum Type {
- // 0 is reserved for errors.
- // Order is weird for historical reasons.
- TYPE_DOUBLE = 1;
- TYPE_FLOAT = 2;
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
- // negative values are likely.
- TYPE_INT64 = 3;
- TYPE_UINT64 = 4;
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
- // negative values are likely.
- TYPE_INT32 = 5;
- TYPE_FIXED64 = 6;
- TYPE_FIXED32 = 7;
- TYPE_BOOL = 8;
- TYPE_STRING = 9;
- TYPE_GROUP = 10; // Tag-delimited aggregate.
- TYPE_MESSAGE = 11; // Length-delimited aggregate.
-
- // New in version 2.
- TYPE_BYTES = 12;
- TYPE_UINT32 = 13;
- TYPE_ENUM = 14;
- TYPE_SFIXED32 = 15;
- TYPE_SFIXED64 = 16;
- TYPE_SINT32 = 17; // Uses ZigZag encoding.
- TYPE_SINT64 = 18; // Uses ZigZag encoding.
- };
-
- enum Label {
- // 0 is reserved for errors
- LABEL_OPTIONAL = 1;
- LABEL_REQUIRED = 2;
- LABEL_REPEATED = 3;
- // TODO(sanjay): Should we add LABEL_MAP?
- };
-
- optional string name = 1;
- optional int32 number = 3;
- optional Label label = 4;
-
- // If type_name is set, this need not be set. If both this and type_name
- // are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
- optional Type type = 5;
-
- // 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).
- optional string type_name = 6;
-
- // For extensions, this is the name of the type being extended. It is
- // resolved in the same manner as type_name.
- optional string extendee = 2;
-
- // 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?
- optional string default_value = 7;
-
- optional FieldOptions options = 8;
-}
-
-// Describes an enum type.
-message EnumDescriptorProto {
- optional string name = 1;
-
- repeated EnumValueDescriptorProto value = 2;
-
- optional EnumOptions options = 3;
-}
-
-// Describes a value within an enum.
-message EnumValueDescriptorProto {
- optional string name = 1;
- optional int32 number = 2;
-
- optional EnumValueOptions options = 3;
-}
-
-// Describes a service.
-message ServiceDescriptorProto {
- optional string name = 1;
- repeated MethodDescriptorProto method = 2;
-
- optional ServiceOptions options = 3;
-}
-
-// Describes a method of a service.
-message MethodDescriptorProto {
- optional string name = 1;
-
- // Input and output type names. These are resolved in the same way as
- // FieldDescriptorProto.type_name, but must refer to a message type.
- optional string input_type = 2;
- optional string output_type = 3;
-
- optional MethodOptions options = 4;
-}
-
-
-// ===================================================================
-// Options
-
-// Each of the definitions above may have "options" attached. These are
-// just annotations which may cause code to be generated slightly differently
-// or may contain hints for code that manipulates protocol messages.
-//
-// Clients may define custom options as extensions of the *Options messages.
-// These extensions may not yet be known at parsing time, so the parser cannot
-// store the values in them. Instead it stores them in a field in the *Options
-// message called uninterpreted_option. This field must have the same name
-// across all *Options messages. We then use this field to populate the
-// extensions when we build a descriptor, at which point all protos have been
-// parsed and so all extensions are known.
-//
-// Extension numbers for custom options may be chosen as follows:
-// * For options which will only be used within a single application or
-// organization, or for experimental options, use field numbers 50000
-// through 99999. It is up to you to ensure that you do not use the
-// same number for multiple options.
-// * For options which will be published and used publicly by multiple
-// independent entities, e-mail protobuf-global-extension-registry@google.com
-// to reserve extension numbers. Simply provide your project name (e.g.
-// Object-C plugin) and your project website (if available) -- there's no need
-// to explain how you intend to use them. Usually you only need one extension
-// number. You can declare multiple options with only one extension number by
-// putting them in a sub-message. See the Custom Options section of the docs
-// for examples:
-// http://code.google.com/apis/protocolbuffers/docs/proto.html#options
-// If this turns out to be popular, a web service will be set up
-// to automatically assign option numbers.
-
-
-message FileOptions {
-
- // 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.
- optional string java_package = 1;
-
-
- // 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).
- optional string java_outer_classname = 8;
-
- // 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.
- optional bool java_multiple_files = 10 [default=false];
-
- // If set true, then the Java code generator will generate equals() and
- // hashCode() methods for all messages defined in the .proto file. This is
- // purely a speed optimization, as the AbstractMessage base class includes
- // reflection-based implementations of these methods.
- optional bool java_generate_equals_and_hash = 20 [default=false];
-
- // Generated classes can be optimized for speed or code size.
- enum OptimizeMode {
- SPEED = 1; // Generate complete code for parsing, serialization,
- // etc.
- CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
- LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
- }
- optional OptimizeMode optimize_for = 9 [default=SPEED];
-
- // Sets the Go package where structs generated from this .proto will be
- // placed. There is no default.
- optional string go_package = 11;
-
-
-
- // 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 proto2.
- //
- // 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.
- optional bool cc_generic_services = 16 [default=false];
- optional bool java_generic_services = 17 [default=false];
- optional bool py_generic_services = 18 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message MessageOptions {
- // 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.
- //
- // 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.
- optional bool message_set_wire_format = 1 [default=false];
-
- // 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".
- optional bool no_standard_descriptor_accessor = 2 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message FieldOptions {
- // 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!
- optional CType ctype = 1 [default = STRING];
- enum CType {
- // Default mode.
- STRING = 0;
-
- CORD = 1;
-
- STRING_PIECE = 2;
- }
- // 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.
- optional bool packed = 2;
-
-
-
- // 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 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.
- optional bool lazy = 5 [default=false];
-
- // 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.
- optional bool deprecated = 3 [default=false];
-
- // EXPERIMENTAL. DO NOT USE.
- // For "map" fields, the name of the field in the enclosed type that
- // is the key for this map. For example, suppose we have:
- // message Item {
- // required string name = 1;
- // required string value = 2;
- // }
- // message Config {
- // repeated Item items = 1 [experimental_map_key="name"];
- // }
- // In this situation, the map key for Item will be set to "name".
- // TODO: Fully-implement this, then remove the "experimental_" prefix.
- optional string experimental_map_key = 9;
-
- // For Google-internal migration only. Do not use.
- optional bool weak = 10 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message EnumOptions {
-
- // Set this option to false to disallow mapping different tag names to a same
- // value.
- optional bool allow_alias = 2 [default=true];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message EnumValueOptions {
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message ServiceOptions {
-
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
- // framework. We apologize for hoarding these numbers to ourselves, but
- // we were already using them long before we decided to release Protocol
- // Buffers.
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message MethodOptions {
-
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
- // framework. We apologize for hoarding these numbers to ourselves, but
- // we were already using them long before we decided to release Protocol
- // Buffers.
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-
-// 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.
-message UninterpretedOption {
- // 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".
- message NamePart {
- required string name_part = 1;
- required bool is_extension = 2;
- }
- repeated NamePart name = 2;
-
- // The value of the uninterpreted option, in whatever type the tokenizer
- // identified it as during parsing. Exactly one of these should be set.
- optional string identifier_value = 3;
- optional uint64 positive_int_value = 4;
- optional int64 negative_int_value = 5;
- optional double double_value = 6;
- optional bytes string_value = 7;
- optional string aggregate_value = 8;
-}
-
-// ===================================================================
-// Optional source code info
-
-// Encapsulates information about the original source file from which a
-// FileDescriptorProto was generated.
-message SourceCodeInfo {
- // 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).
- //
- // 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.
- repeated Location location = 1;
- message 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;
- //
- // 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).
- repeated int32 path = 1 [packed=true];
-
- // 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.
- repeated int32 span = 2 [packed=true];
-
- // 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.
- //
- // 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:
- //
- // 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.
- //
- // // Comment attached to qux.
- // //
- // // Another line attached to qux.
- // optional double qux = 4;
- //
- // 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 leading_comments = 3;
- optional string trailing_comments = 4;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
deleted file mode 100644
index 6eb2d86..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
+++ /dev/null
@@ -1,719 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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.
-
-
-// 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
-
-import "google/protobuf/unittest_import.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.
- optional int32 bb = 1;
- }
-
- enum NestedEnum {
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- }
-
- // Singular
- optional int32 optional_int32 = 1;
- optional int64 optional_int64 = 2;
- optional uint32 optional_uint32 = 3;
- optional uint64 optional_uint64 = 4;
- optional sint32 optional_sint32 = 5;
- optional sint64 optional_sint64 = 6;
- optional fixed32 optional_fixed32 = 7;
- optional fixed64 optional_fixed64 = 8;
- optional sfixed32 optional_sfixed32 = 9;
- optional sfixed64 optional_sfixed64 = 10;
- optional float optional_float = 11;
- optional double optional_double = 12;
- optional bool optional_bool = 13;
- optional string optional_string = 14;
- optional bytes optional_bytes = 15;
-
- optional group OptionalGroup = 16 {
- optional int32 a = 17;
- }
-
- optional NestedMessage optional_nested_message = 18;
- optional ForeignMessage optional_foreign_message = 19;
- optional protobuf_unittest_import.ImportMessage optional_import_message = 20;
-
- optional NestedEnum optional_nested_enum = 21;
- optional ForeignEnum optional_foreign_enum = 22;
- optional protobuf_unittest_import.ImportEnum optional_import_enum = 23;
-
- optional string optional_string_piece = 24 [ctype=STRING_PIECE];
- optional string optional_cord = 25 [ctype=CORD];
-
- // Defined in unittest_import_public.proto
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message = 26;
-
- optional NestedMessage optional_lazy_message = 27 [lazy=true];
-
- // 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 group RepeatedGroup = 46 {
- optional int32 a = 47;
- }
-
- 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;
-
- repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord = 55 [ctype=CORD];
-
- repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32 = 61 [default = 41 ];
- optional int64 default_int64 = 62 [default = 42 ];
- optional uint32 default_uint32 = 63 [default = 43 ];
- optional uint64 default_uint64 = 64 [default = 44 ];
- optional sint32 default_sint32 = 65 [default = -45 ];
- optional sint64 default_sint64 = 66 [default = 46 ];
- optional fixed32 default_fixed32 = 67 [default = 47 ];
- optional fixed64 default_fixed64 = 68 [default = 48 ];
- optional sfixed32 default_sfixed32 = 69 [default = 49 ];
- optional sfixed64 default_sfixed64 = 70 [default = -50 ];
- optional float default_float = 71 [default = 51.5 ];
- optional double default_double = 72 [default = 52e3 ];
- optional bool default_bool = 73 [default = true ];
- optional string default_string = 74 [default = "hello"];
- optional bytes default_bytes = 75 [default = "world"];
-
- optional NestedEnum default_nested_enum = 81 [default = BAR ];
- optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
- optional protobuf_unittest_import.ImportEnum
- default_import_enum = 83 [default = IMPORT_BAR];
-
- optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
- optional string default_cord = 85 [ctype=CORD,default="123"];
-}
-
-message TestDeprecatedFields {
- optional int32 deprecated_int32 = 1 [deprecated=true];
-}
-
-// Define these after TestAllTypes to make sure the compiler can handle
-// that.
-message ForeignMessage {
- optional int32 c = 1;
-}
-
-enum ForeignEnum {
- FOREIGN_FOO = 4;
- FOREIGN_BAR = 5;
- FOREIGN_BAZ = 6;
-}
-
-message TestAllExtensions {
- extensions 1 to max;
-}
-
-extend TestAllExtensions {
- // Singular
- optional int32 optional_int32_extension = 1;
- optional int64 optional_int64_extension = 2;
- optional uint32 optional_uint32_extension = 3;
- optional uint64 optional_uint64_extension = 4;
- optional sint32 optional_sint32_extension = 5;
- optional sint64 optional_sint64_extension = 6;
- optional fixed32 optional_fixed32_extension = 7;
- optional fixed64 optional_fixed64_extension = 8;
- optional sfixed32 optional_sfixed32_extension = 9;
- optional sfixed64 optional_sfixed64_extension = 10;
- optional float optional_float_extension = 11;
- optional double optional_double_extension = 12;
- optional bool optional_bool_extension = 13;
- optional string optional_string_extension = 14;
- optional bytes optional_bytes_extension = 15;
-
- optional group OptionalGroup_extension = 16 {
- optional int32 a = 17;
- }
-
- optional TestAllTypes.NestedMessage optional_nested_message_extension = 18;
- optional ForeignMessage optional_foreign_message_extension = 19;
- optional protobuf_unittest_import.ImportMessage
- optional_import_message_extension = 20;
-
- optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
- optional ForeignEnum optional_foreign_enum_extension = 22;
- optional protobuf_unittest_import.ImportEnum
- optional_import_enum_extension = 23;
-
- optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
- optional string optional_cord_extension = 25 [ctype=CORD];
-
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message_extension = 26;
-
- optional TestAllTypes.NestedMessage
- optional_lazy_message_extension = 27 [lazy=true];
-
- // Repeated
- repeated int32 repeated_int32_extension = 31;
- repeated int64 repeated_int64_extension = 32;
- repeated uint32 repeated_uint32_extension = 33;
- repeated uint64 repeated_uint64_extension = 34;
- repeated sint32 repeated_sint32_extension = 35;
- repeated sint64 repeated_sint64_extension = 36;
- repeated fixed32 repeated_fixed32_extension = 37;
- repeated fixed64 repeated_fixed64_extension = 38;
- repeated sfixed32 repeated_sfixed32_extension = 39;
- repeated sfixed64 repeated_sfixed64_extension = 40;
- repeated float repeated_float_extension = 41;
- repeated double repeated_double_extension = 42;
- repeated bool repeated_bool_extension = 43;
- repeated string repeated_string_extension = 44;
- repeated bytes repeated_bytes_extension = 45;
-
- repeated group RepeatedGroup_extension = 46 {
- optional int32 a = 47;
- }
-
- repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
- repeated ForeignMessage repeated_foreign_message_extension = 49;
- repeated protobuf_unittest_import.ImportMessage
- repeated_import_message_extension = 50;
-
- repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
- repeated ForeignEnum repeated_foreign_enum_extension = 52;
- repeated protobuf_unittest_import.ImportEnum
- repeated_import_enum_extension = 53;
-
- repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord_extension = 55 [ctype=CORD];
-
- repeated TestAllTypes.NestedMessage
- repeated_lazy_message_extension = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32_extension = 61 [default = 41 ];
- optional int64 default_int64_extension = 62 [default = 42 ];
- optional uint32 default_uint32_extension = 63 [default = 43 ];
- optional uint64 default_uint64_extension = 64 [default = 44 ];
- optional sint32 default_sint32_extension = 65 [default = -45 ];
- optional sint64 default_sint64_extension = 66 [default = 46 ];
- optional fixed32 default_fixed32_extension = 67 [default = 47 ];
- optional fixed64 default_fixed64_extension = 68 [default = 48 ];
- optional sfixed32 default_sfixed32_extension = 69 [default = 49 ];
- optional sfixed64 default_sfixed64_extension = 70 [default = -50 ];
- optional float default_float_extension = 71 [default = 51.5 ];
- optional double default_double_extension = 72 [default = 52e3 ];
- optional bool default_bool_extension = 73 [default = true ];
- optional string default_string_extension = 74 [default = "hello"];
- optional bytes default_bytes_extension = 75 [default = "world"];
-
- optional TestAllTypes.NestedEnum
- default_nested_enum_extension = 81 [default = BAR];
- optional ForeignEnum
- default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
- optional protobuf_unittest_import.ImportEnum
- default_import_enum_extension = 83 [default = IMPORT_BAR];
-
- optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,
- default="abc"];
- optional string default_cord_extension = 85 [ctype=CORD, default="123"];
-}
-
-message TestNestedExtension {
- extend TestAllExtensions {
- // Check for bug where string extensions declared in tested scope did not
- // compile.
- optional string test = 1002 [default="test"];
- }
-}
-
-// We have separate messages for testing required fields because it's
-// annoying to have to fill in required fields in TestProto in order to
-// do anything with it. Note that we don't need to test every type of
-// required filed because the code output is basically identical to
-// optional fields for all types.
-message TestRequired {
- required int32 a = 1;
- optional int32 dummy2 = 2;
- required int32 b = 3;
-
- extend TestAllExtensions {
- optional TestRequired single = 1000;
- repeated TestRequired multi = 1001;
- }
-
- // Pad the field count to 32 so that we can test that IsInitialized()
- // properly checks multiple elements of has_bits_.
- optional int32 dummy4 = 4;
- optional int32 dummy5 = 5;
- optional int32 dummy6 = 6;
- optional int32 dummy7 = 7;
- optional int32 dummy8 = 8;
- optional int32 dummy9 = 9;
- optional int32 dummy10 = 10;
- optional int32 dummy11 = 11;
- optional int32 dummy12 = 12;
- optional int32 dummy13 = 13;
- optional int32 dummy14 = 14;
- optional int32 dummy15 = 15;
- optional int32 dummy16 = 16;
- optional int32 dummy17 = 17;
- optional int32 dummy18 = 18;
- optional int32 dummy19 = 19;
- optional int32 dummy20 = 20;
- optional int32 dummy21 = 21;
- optional int32 dummy22 = 22;
- optional int32 dummy23 = 23;
- optional int32 dummy24 = 24;
- optional int32 dummy25 = 25;
- optional int32 dummy26 = 26;
- optional int32 dummy27 = 27;
- optional int32 dummy28 = 28;
- optional int32 dummy29 = 29;
- optional int32 dummy30 = 30;
- optional int32 dummy31 = 31;
- optional int32 dummy32 = 32;
-
- required int32 c = 33;
-}
-
-message TestRequiredForeign {
- optional TestRequired optional_message = 1;
- repeated TestRequired repeated_message = 2;
- optional int32 dummy = 3;
-}
-
-// Test that we can use NestedMessage from outside TestAllTypes.
-message TestForeignNested {
- optional TestAllTypes.NestedMessage foreign_nested = 1;
-}
-
-// TestEmptyMessage is used to test unknown field support.
-message TestEmptyMessage {
-}
-
-// Like above, but declare all field numbers as potential extensions. No
-// actual extensions should ever be defined for this type.
-message TestEmptyMessageWithExtensions {
- extensions 1 to max;
-}
-
-message TestMultipleExtensionRanges {
- extensions 42;
- extensions 4143 to 4243;
- extensions 65536 to max;
-}
-
-// 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.
- optional int32 a = 1;
- optional int32 bb = 268435455;
-}
-
-message TestRecursiveMessage {
- optional TestRecursiveMessage a = 1;
- optional int32 i = 2;
-}
-
-// Test that mutual recursion works.
-message TestMutualRecursionA {
- optional TestMutualRecursionB bb = 1;
-}
-
-message TestMutualRecursionB {
- optional TestMutualRecursionA a = 1;
- optional int32 optional_int32 = 2;
-}
-
-// Test that groups have disjoint field numbers from their siblings and
-// parents. This is NOT possible in proto1; only proto2. When attempting
-// to compile with proto1, this will emit an error; so we only include it
-// in protobuf_unittest_proto.
-message TestDupFieldNumber { // NO_PROTO1
- optional int32 a = 1; // NO_PROTO1
- optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1
- optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1
-} // NO_PROTO1
-
-// Additional messages for testing lazy fields.
-message TestEagerMessage {
- optional TestAllTypes sub_message = 1 [lazy=false];
-}
-message TestLazyMessage {
- optional TestAllTypes sub_message = 1 [lazy=true];
-}
-
-// Needed for a Python test.
-message TestNestedMessageHasBits {
- message NestedMessage {
- repeated int32 nestedmessage_repeated_int32 = 1;
- repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2;
- }
- optional NestedMessage optional_nested_message = 1;
-}
-
-
-// Test an enum that has multiple values with the same number.
-enum TestEnumWithDupValue {
- option allow_alias = true;
- FOO1 = 1;
- BAR1 = 2;
- BAZ = 3;
- FOO2 = 1;
- BAR2 = 2;
-}
-
-// Test an enum with large, unordered values.
-enum TestSparseEnum {
- SPARSE_A = 123;
- SPARSE_B = 62374;
- SPARSE_C = 12589234;
- SPARSE_D = -15;
- SPARSE_E = -53452;
- SPARSE_F = 0;
- SPARSE_G = 2;
-}
-
-// Test message with CamelCase field names. This violates Protocol Buffer
-// standard style.
-message TestCamelCaseFieldNames {
- optional int32 PrimitiveField = 1;
- optional string StringField = 2;
- optional ForeignEnum EnumField = 3;
- optional ForeignMessage MessageField = 4;
- optional string StringPieceField = 5 [ctype=STRING_PIECE];
- optional string CordField = 6 [ctype=CORD];
-
- repeated int32 RepeatedPrimitiveField = 7;
- repeated string RepeatedStringField = 8;
- repeated ForeignEnum RepeatedEnumField = 9;
- repeated ForeignMessage RepeatedMessageField = 10;
- repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE];
- repeated string RepeatedCordField = 12 [ctype=CORD];
-}
-
-
-// We list fields out of order, to ensure that we're using field number and not
-// field index to determine serialization order.
-message TestFieldOrderings {
- optional string my_string = 11;
- extensions 2 to 10;
- optional int64 my_int = 1;
- extensions 12 to 100;
- optional float my_float = 101;
-}
-
-
-extend TestFieldOrderings {
- optional string my_extension_string = 50;
- optional int32 my_extension_int = 5;
-}
-
-
-message TestExtremeDefaultValues {
- optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
- optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
- optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
- optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
- optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
- optional int32 really_small_int32 = 21 [default = -0x80000000];
- optional int64 really_small_int64 = 22 [default = -0x8000000000000000];
-
- // The default value here is UTF-8 for "\u1234". (We could also just type
- // the UTF-8 text directly into this text file rather than escape it, but
- // lots of people use editors that would be confused by this.)
- optional string utf8_string = 6 [default = "\341\210\264"];
-
- // Tests for single-precision floating-point values.
- optional float zero_float = 7 [default = 0];
- optional float one_float = 8 [default = 1];
- optional float small_float = 9 [default = 1.5];
- optional float negative_one_float = 10 [default = -1];
- optional float negative_float = 11 [default = -1.5];
- // Using exponents
- optional float large_float = 12 [default = 2E8];
- optional float small_negative_float = 13 [default = -8e-28];
-
- // Text for nonfinite floating-point values.
- optional double inf_double = 14 [default = inf];
- optional double neg_inf_double = 15 [default = -inf];
- optional double nan_double = 16 [default = nan];
- optional float inf_float = 17 [default = inf];
- optional float neg_inf_float = 18 [default = -inf];
- optional float nan_float = 19 [default = nan];
-
- // Tests for C++ trigraphs.
- // Trigraphs should be escaped in C++ generated files, but they should not be
- // escaped for other languages.
- // Note that in .proto file, "\?" is a valid way to escape ? in string
- // literals.
- optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
-
- // String defaults containing the character '\000'
- optional string string_with_zero = 23 [default = "hel\000lo"];
- optional bytes bytes_with_zero = 24 [default = "wor\000ld"];
- optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
- default="ab\000c"];
- optional string cord_with_zero = 26 [ctype=CORD,
- default="12\0003"];
-}
-
-message SparseEnumMessage {
- optional TestSparseEnum sparse_enum = 1;
-}
-
-// Test String and Bytes: string is for valid UTF-8 strings
-message OneString {
- optional string data = 1;
-}
-
-message MoreString {
- repeated string data = 1;
-}
-
-message OneBytes {
- optional bytes data = 1;
-}
-
-message MoreBytes {
- repeated bytes data = 1;
-}
-
-
-// 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 TestPackedExtensions {
- extensions 1 to max;
-}
-
-extend TestPackedExtensions {
- repeated int32 packed_int32_extension = 90 [packed = true];
- repeated int64 packed_int64_extension = 91 [packed = true];
- repeated uint32 packed_uint32_extension = 92 [packed = true];
- repeated uint64 packed_uint64_extension = 93 [packed = true];
- repeated sint32 packed_sint32_extension = 94 [packed = true];
- repeated sint64 packed_sint64_extension = 95 [packed = true];
- repeated fixed32 packed_fixed32_extension = 96 [packed = true];
- repeated fixed64 packed_fixed64_extension = 97 [packed = true];
- repeated sfixed32 packed_sfixed32_extension = 98 [packed = true];
- repeated sfixed64 packed_sfixed64_extension = 99 [packed = true];
- repeated float packed_float_extension = 100 [packed = true];
- repeated double packed_double_extension = 101 [packed = true];
- repeated bool packed_bool_extension = 102 [packed = true];
- repeated ForeignEnum packed_enum_extension = 103 [packed = true];
-}
-
-// Used by ExtensionSetTest/DynamicExtensions. The test actually builds
-// a set of extensions to TestAllExtensions dynamically, based on the fields
-// of this message type.
-message TestDynamicExtensions {
- enum DynamicEnumType {
- DYNAMIC_FOO = 2200;
- DYNAMIC_BAR = 2201;
- DYNAMIC_BAZ = 2202;
- }
- message DynamicMessageType {
- optional int32 dynamic_field = 2100;
- }
-
- optional fixed32 scalar_extension = 2000;
- optional ForeignEnum enum_extension = 2001;
- optional DynamicEnumType dynamic_enum_extension = 2002;
-
- optional ForeignMessage message_extension = 2003;
- optional DynamicMessageType dynamic_message_extension = 2004;
-
- repeated string repeated_extension = 2005;
- repeated sint32 packed_extension = 2006 [packed = true];
-}
-
-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;
-}
-
-// Test that if an optional or required message/group field appears multiple
-// times in the input, they need to be merged.
-message TestParsingMerge {
- // RepeatedFieldsGenerator defines matching field types as TestParsingMerge,
- // except that all fields are repeated. In the tests, we will serialize the
- // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge.
- // Repeated fields in RepeatedFieldsGenerator are expected to be merged into
- // the corresponding required/optional fields in TestParsingMerge.
- message RepeatedFieldsGenerator {
- repeated TestAllTypes field1 = 1;
- repeated TestAllTypes field2 = 2;
- repeated TestAllTypes field3 = 3;
- repeated group Group1 = 10 {
- optional TestAllTypes field1 = 11;
- }
- repeated group Group2 = 20 {
- optional TestAllTypes field1 = 21;
- }
- repeated TestAllTypes ext1 = 1000;
- repeated TestAllTypes ext2 = 1001;
- }
- required TestAllTypes required_all_types = 1;
- optional TestAllTypes optional_all_types = 2;
- repeated TestAllTypes repeated_all_types = 3;
- optional group OptionalGroup = 10 {
- optional TestAllTypes optional_group_all_types = 11;
- }
- repeated group RepeatedGroup = 20 {
- optional TestAllTypes repeated_group_all_types = 21;
- }
- extensions 1000 to max;
- extend TestParsingMerge {
- optional TestAllTypes optional_ext = 1000;
- repeated TestAllTypes repeated_ext = 1001;
- }
-}
-
-message TestCommentInjectionMessage {
- // */ <- This should not close the generated doc comment
- optional string a = 1 [default="*/ <- Neither should this."];
-}
-
-
-// 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/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
deleted file mode 100644
index 2f4e3fd..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
+++ /dev/null
@@ -1,387 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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 proto2.
-
-
-// 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;
-
-// 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;
-
-
-// Some simple test custom options of various types.
-
-extend google.protobuf.FileOptions {
- optional uint64 file_opt1 = 7736974;
-}
-
-extend google.protobuf.MessageOptions {
- optional int32 message_opt1 = 7739036;
-}
-
-extend google.protobuf.FieldOptions {
- optional fixed64 field_opt1 = 7740936;
- // This is useful for testing that we correctly register default values for
- // extension options.
- optional int32 field_opt2 = 7753913 [default=42];
-}
-
-extend google.protobuf.EnumOptions {
- optional sfixed32 enum_opt1 = 7753576;
-}
-
-extend google.protobuf.EnumValueOptions {
- optional int32 enum_value_opt1 = 1560678;
-}
-
-extend google.protobuf.ServiceOptions {
- optional sint64 service_opt1 = 7887650;
-}
-
-enum MethodOpt1 {
- METHODOPT1_VAL1 = 1;
- METHODOPT1_VAL2 = 2;
-}
-
-extend google.protobuf.MethodOptions {
- optional 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;
-
- optional string field1 = 1 [ctype=CORD,
- (field_opt1)=8765432109];
-
- enum AnEnum {
- option (enum_opt1) = -789;
-
- 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_TYPE1 = 22;
- TEST_OPTION_ENUM_TYPE2 = -23;
- }
-}
-
-message DummyMessageInvalidAsOptionType {
-}
-
-extend google.protobuf.MessageOptions {
- optional bool bool_opt = 7706090;
- optional int32 int32_opt = 7705709;
- optional int64 int64_opt = 7705542;
- optional uint32 uint32_opt = 7704880;
- optional uint64 uint64_opt = 7702367;
- optional sint32 sint32_opt = 7701568;
- optional sint64 sint64_opt = 7700863;
- optional fixed32 fixed32_opt = 7700307;
- optional fixed64 fixed64_opt = 7700194;
- optional sfixed32 sfixed32_opt = 7698645;
- optional sfixed64 sfixed64_opt = 7685475;
- optional float float_opt = 7675390;
- optional double double_opt = 7673293;
- optional string string_opt = 7673285;
- optional bytes bytes_opt = 7673238;
- optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233;
- optional 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 {
- optional int32 foo = 1;
- optional int32 foo2 = 2;
- optional int32 foo3 = 3;
-
- extensions 100 to max;
-}
-
-message ComplexOptionType2 {
- optional ComplexOptionType1 bar = 1;
- optional int32 baz = 2;
-
- message ComplexOptionType4 {
- optional int32 waldo = 1;
-
- extend google.protobuf.MessageOptions {
- optional ComplexOptionType4 complex_opt4 = 7633546;
- }
- }
-
- optional ComplexOptionType4 fred = 3;
-
- extensions 100 to max;
-}
-
-message ComplexOptionType3 {
- optional int32 qux = 1;
-
- optional group ComplexOptionType5 = 2 {
- optional int32 plugh = 3;
- }
-}
-
-extend ComplexOptionType1 {
- optional int32 quux = 7663707;
- optional ComplexOptionType3 corge = 7663442;
-}
-
-extend ComplexOptionType2 {
- optional int32 grault = 7650927;
- optional ComplexOptionType1 garply = 7649992;
-}
-
-extend google.protobuf.MessageOptions {
- optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756;
- optional ComplexOptionType2 complex_opt2 = 7636949;
- optional ComplexOptionType3 complex_opt3 = 7636463;
- optional group ComplexOpt6 = 7595468 {
- optional int32 xyzzy = 7593951;
- }
-}
-
-// 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).(.protobuf_unittest.quux) = 324;
- option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
- option (complex_opt2).baz = 987;
- option (complex_opt2).(grault) = 654;
- option (complex_opt2).bar.foo = 743;
- option (complex_opt2).bar.(quux) = 1999;
- option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
- option (complex_opt2).(garply).foo = 741;
- option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
- option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
- option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
- option (complex_opt2).fred.waldo = 321;
- option (protobuf_unittest.complex_opt3).qux = 9;
- option (complex_opt3).complexoptiontype5.plugh = 22;
- option (complexopt6).xyzzy = 24;
-}
-
-// ------------------------------------------------------
-// Definitions for testing aggregate option parsing.
-// See descriptor_unittest.cc.
-
-message AggregateMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
-
-message AggregateMessageSetElement {
- extend AggregateMessageSet {
- optional AggregateMessageSetElement message_set_extension = 15447542;
- }
- optional string s = 1;
-}
-
-// A helper type used to test aggregate option parsing
-message Aggregate {
- optional int32 i = 1;
- optional string s = 2;
-
- // A nested object
- optional Aggregate sub = 3;
-
- // To test the parsing of extensions inside aggregate values
- optional google.protobuf.FileOptions file = 4;
- extend google.protobuf.FileOptions {
- optional Aggregate nested = 15476903;
- }
-
- // An embedded message set
- optional AggregateMessageSet mset = 5;
-}
-
-// Allow Aggregate to be used as an option at all possible locations
-// in the .proto grammar.
-extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; }
-extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; }
-extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; }
-extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; }
-extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
-extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; }
-extend google.protobuf.MethodOptions { optional 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' }
-
- // Include a google.protobuf.FileOptions and recursively extend it with
- // another fileopt.
- file {
- [protobuf_unittest.fileopt] {
- s:'FileExtensionAnnotation'
- }
- }
-
- // A message set inside an option value
- mset {
- [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
- s: 'EmbeddedMessageSetElement'
- }
- }
-};
-
-message AggregateMessage {
- option (msgopt) = { i:101 s:'MessageAnnotation' };
- optional 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' };
- VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
-}
-
-// Test custom options for nested type.
-message NestedOptionType {
- message NestedMessage {
- option (message_opt1) = 1001;
- optional int32 nested_field = 1 [(field_opt1) = 1002];
- }
- enum NestedEnum {
- option (enum_opt1) = 1003;
- NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004];
- }
- extend google.protobuf.FileOptions {
- optional int32 nested_extension = 7912573 [(field_opt2) = 1005];
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
deleted file mode 100644
index fa17625..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_embed_optimize_for.proto
+++ /dev/null
@@ -1,50 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// A proto file which imports a proto file that uses optimize_for = CODE_SIZE.
-
-import "google/protobuf/unittest_optimize_for.proto";
-
-package protobuf_unittest;
-
-// We optimize for speed here, but we are importing a proto that is optimized
-// for code size.
-option optimize_for = SPEED;
-
-message TestEmbedOptimizedForSize {
- // Test that embedding a message which has optimize_for = CODE_SIZE into
- // one optimized for speed works.
- optional TestOptimizedForSize optional_message = 1;
- repeated TestOptimizedForSize repeated_message = 2;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto
deleted file mode 100644
index ab12d1f..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_empty.proto
+++ /dev/null
@@ -1,37 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file intentionally left blank. (At one point this wouldn't compile
-// correctly.)
-
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
deleted file mode 100644
index bc0b7c1..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_enormous_descriptor.proto
+++ /dev/null
@@ -1,1046 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// A proto file that has an extremely large descriptor. Used to test that
-// descriptors over 64k don't break the string literal length limit in Java.
-
-
-package google.protobuf;
-option java_package = "com.google.protobuf";
-
-// Avoid generating insanely long methods.
-option optimize_for = CODE_SIZE;
-
-message TestEnormousDescriptor {
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1 = 1 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_2 = 2 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_3 = 3 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_4 = 4 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_5 = 5 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_6 = 6 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_7 = 7 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_8 = 8 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_9 = 9 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_10 = 10 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_11 = 11 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_12 = 12 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_13 = 13 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_14 = 14 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_15 = 15 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_16 = 16 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_17 = 17 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_18 = 18 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_19 = 19 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_20 = 20 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_21 = 21 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_22 = 22 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_23 = 23 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_24 = 24 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_25 = 25 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_26 = 26 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_27 = 27 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_28 = 28 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_29 = 29 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_30 = 30 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_31 = 31 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_32 = 32 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_33 = 33 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_34 = 34 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_35 = 35 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_36 = 36 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_37 = 37 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_38 = 38 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_39 = 39 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_40 = 40 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_41 = 41 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_42 = 42 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_43 = 43 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_44 = 44 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_45 = 45 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_46 = 46 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_47 = 47 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_48 = 48 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_49 = 49 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_50 = 50 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_51 = 51 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_52 = 52 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_53 = 53 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_54 = 54 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_55 = 55 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_56 = 56 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_57 = 57 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_58 = 58 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_59 = 59 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_60 = 60 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_61 = 61 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_62 = 62 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_63 = 63 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_64 = 64 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_65 = 65 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_66 = 66 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_67 = 67 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_68 = 68 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_69 = 69 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_70 = 70 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_71 = 71 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_72 = 72 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_73 = 73 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_74 = 74 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_75 = 75 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_76 = 76 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_77 = 77 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_78 = 78 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_79 = 79 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_80 = 80 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_81 = 81 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_82 = 82 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_83 = 83 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_84 = 84 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_85 = 85 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_86 = 86 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_87 = 87 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_88 = 88 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_89 = 89 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_90 = 90 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_91 = 91 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_92 = 92 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_93 = 93 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_94 = 94 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_95 = 95 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_96 = 96 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_97 = 97 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_98 = 98 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_99 = 99 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_100 = 100 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_101 = 101 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_102 = 102 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_103 = 103 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_104 = 104 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_105 = 105 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_106 = 106 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_107 = 107 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_108 = 108 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_109 = 109 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_110 = 110 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_111 = 111 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_112 = 112 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_113 = 113 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_114 = 114 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_115 = 115 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_116 = 116 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_117 = 117 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_118 = 118 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_119 = 119 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_120 = 120 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_121 = 121 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_122 = 122 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_123 = 123 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_124 = 124 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_125 = 125 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_126 = 126 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_127 = 127 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_128 = 128 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_129 = 129 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_130 = 130 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_131 = 131 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_132 = 132 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_133 = 133 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_134 = 134 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_135 = 135 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_136 = 136 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_137 = 137 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_138 = 138 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_139 = 139 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_140 = 140 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_141 = 141 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_142 = 142 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_143 = 143 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_144 = 144 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_145 = 145 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_146 = 146 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_147 = 147 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_148 = 148 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_149 = 149 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_150 = 150 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_151 = 151 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_152 = 152 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_153 = 153 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_154 = 154 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_155 = 155 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_156 = 156 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_157 = 157 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_158 = 158 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_159 = 159 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_160 = 160 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_161 = 161 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_162 = 162 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_163 = 163 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_164 = 164 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_165 = 165 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_166 = 166 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_167 = 167 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_168 = 168 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_169 = 169 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_170 = 170 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_171 = 171 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_172 = 172 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_173 = 173 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_174 = 174 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_175 = 175 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_176 = 176 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_177 = 177 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_178 = 178 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_179 = 179 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_180 = 180 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_181 = 181 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_182 = 182 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_183 = 183 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_184 = 184 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_185 = 185 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_186 = 186 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_187 = 187 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_188 = 188 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_189 = 189 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_190 = 190 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_191 = 191 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_192 = 192 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_193 = 193 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_194 = 194 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_195 = 195 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_196 = 196 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_197 = 197 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_198 = 198 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_199 = 199 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_200 = 200 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_201 = 201 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_202 = 202 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_203 = 203 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_204 = 204 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_205 = 205 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_206 = 206 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_207 = 207 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_208 = 208 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_209 = 209 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_210 = 210 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_211 = 211 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_212 = 212 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_213 = 213 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_214 = 214 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_215 = 215 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_216 = 216 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_217 = 217 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_218 = 218 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_219 = 219 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_220 = 220 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_221 = 221 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_222 = 222 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_223 = 223 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_224 = 224 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_225 = 225 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_226 = 226 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_227 = 227 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_228 = 228 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_229 = 229 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_230 = 230 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_231 = 231 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_232 = 232 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_233 = 233 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_234 = 234 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_235 = 235 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_236 = 236 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_237 = 237 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_238 = 238 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_239 = 239 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_240 = 240 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_241 = 241 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_242 = 242 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_243 = 243 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_244 = 244 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_245 = 245 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_246 = 246 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_247 = 247 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_248 = 248 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_249 = 249 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_250 = 250 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_251 = 251 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_252 = 252 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_253 = 253 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_254 = 254 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_255 = 255 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_256 = 256 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_257 = 257 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_258 = 258 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_259 = 259 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_260 = 260 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_261 = 261 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_262 = 262 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_263 = 263 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_264 = 264 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_265 = 265 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_266 = 266 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_267 = 267 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_268 = 268 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_269 = 269 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_270 = 270 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_271 = 271 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_272 = 272 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_273 = 273 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_274 = 274 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_275 = 275 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_276 = 276 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_277 = 277 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_278 = 278 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_279 = 279 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_280 = 280 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_281 = 281 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_282 = 282 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_283 = 283 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_284 = 284 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_285 = 285 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_286 = 286 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_287 = 287 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_288 = 288 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_289 = 289 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_290 = 290 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_291 = 291 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_292 = 292 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_293 = 293 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_294 = 294 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_295 = 295 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_296 = 296 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_297 = 297 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_298 = 298 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_299 = 299 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_300 = 300 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_301 = 301 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_302 = 302 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_303 = 303 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_304 = 304 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_305 = 305 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_306 = 306 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_307 = 307 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_308 = 308 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_309 = 309 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_310 = 310 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_311 = 311 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_312 = 312 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_313 = 313 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_314 = 314 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_315 = 315 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_316 = 316 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_317 = 317 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_318 = 318 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_319 = 319 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_320 = 320 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_321 = 321 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_322 = 322 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_323 = 323 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_324 = 324 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_325 = 325 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_326 = 326 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_327 = 327 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_328 = 328 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_329 = 329 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_330 = 330 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_331 = 331 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_332 = 332 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_333 = 333 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_334 = 334 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_335 = 335 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_336 = 336 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_337 = 337 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_338 = 338 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_339 = 339 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_340 = 340 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_341 = 341 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_342 = 342 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_343 = 343 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_344 = 344 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_345 = 345 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_346 = 346 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_347 = 347 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_348 = 348 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_349 = 349 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_350 = 350 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_351 = 351 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_352 = 352 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_353 = 353 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_354 = 354 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_355 = 355 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_356 = 356 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_357 = 357 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_358 = 358 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_359 = 359 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_360 = 360 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_361 = 361 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_362 = 362 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_363 = 363 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_364 = 364 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_365 = 365 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_366 = 366 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_367 = 367 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_368 = 368 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_369 = 369 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_370 = 370 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_371 = 371 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_372 = 372 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_373 = 373 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_374 = 374 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_375 = 375 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_376 = 376 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_377 = 377 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_378 = 378 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_379 = 379 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_380 = 380 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_381 = 381 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_382 = 382 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_383 = 383 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_384 = 384 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_385 = 385 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_386 = 386 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_387 = 387 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_388 = 388 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_389 = 389 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_390 = 390 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_391 = 391 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_392 = 392 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_393 = 393 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_394 = 394 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_395 = 395 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_396 = 396 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_397 = 397 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_398 = 398 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_399 = 399 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_400 = 400 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_401 = 401 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_402 = 402 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_403 = 403 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_404 = 404 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_405 = 405 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_406 = 406 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_407 = 407 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_408 = 408 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_409 = 409 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_410 = 410 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_411 = 411 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_412 = 412 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_413 = 413 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_414 = 414 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_415 = 415 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_416 = 416 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_417 = 417 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_418 = 418 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_419 = 419 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_420 = 420 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_421 = 421 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_422 = 422 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_423 = 423 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_424 = 424 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_425 = 425 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_426 = 426 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_427 = 427 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_428 = 428 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_429 = 429 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_430 = 430 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_431 = 431 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_432 = 432 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_433 = 433 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_434 = 434 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_435 = 435 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_436 = 436 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_437 = 437 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_438 = 438 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_439 = 439 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_440 = 440 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_441 = 441 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_442 = 442 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_443 = 443 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_444 = 444 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_445 = 445 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_446 = 446 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_447 = 447 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_448 = 448 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_449 = 449 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_450 = 450 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_451 = 451 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_452 = 452 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_453 = 453 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_454 = 454 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_455 = 455 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_456 = 456 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_457 = 457 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_458 = 458 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_459 = 459 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_460 = 460 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_461 = 461 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_462 = 462 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_463 = 463 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_464 = 464 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_465 = 465 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_466 = 466 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_467 = 467 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_468 = 468 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_469 = 469 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_470 = 470 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_471 = 471 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_472 = 472 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_473 = 473 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_474 = 474 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_475 = 475 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_476 = 476 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_477 = 477 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_478 = 478 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_479 = 479 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_480 = 480 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_481 = 481 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_482 = 482 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_483 = 483 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_484 = 484 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_485 = 485 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_486 = 486 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_487 = 487 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_488 = 488 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_489 = 489 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_490 = 490 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_491 = 491 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_492 = 492 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_493 = 493 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_494 = 494 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_495 = 495 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_496 = 496 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_497 = 497 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_498 = 498 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_499 = 499 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_500 = 500 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_501 = 501 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_502 = 502 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_503 = 503 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_504 = 504 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_505 = 505 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_506 = 506 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_507 = 507 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_508 = 508 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_509 = 509 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_510 = 510 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_511 = 511 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_512 = 512 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_513 = 513 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_514 = 514 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_515 = 515 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_516 = 516 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_517 = 517 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_518 = 518 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_519 = 519 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_520 = 520 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_521 = 521 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_522 = 522 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_523 = 523 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_524 = 524 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_525 = 525 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_526 = 526 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_527 = 527 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_528 = 528 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_529 = 529 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_530 = 530 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_531 = 531 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_532 = 532 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_533 = 533 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_534 = 534 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_535 = 535 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_536 = 536 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_537 = 537 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_538 = 538 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_539 = 539 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_540 = 540 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_541 = 541 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_542 = 542 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_543 = 543 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_544 = 544 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_545 = 545 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_546 = 546 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_547 = 547 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_548 = 548 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_549 = 549 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_550 = 550 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_551 = 551 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_552 = 552 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_553 = 553 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_554 = 554 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_555 = 555 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_556 = 556 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_557 = 557 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_558 = 558 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_559 = 559 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_560 = 560 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_561 = 561 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_562 = 562 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_563 = 563 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_564 = 564 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_565 = 565 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_566 = 566 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_567 = 567 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_568 = 568 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_569 = 569 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_570 = 570 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_571 = 571 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_572 = 572 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_573 = 573 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_574 = 574 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_575 = 575 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_576 = 576 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_577 = 577 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_578 = 578 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_579 = 579 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_580 = 580 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_581 = 581 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_582 = 582 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_583 = 583 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_584 = 584 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_585 = 585 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_586 = 586 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_587 = 587 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_588 = 588 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_589 = 589 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_590 = 590 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_591 = 591 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_592 = 592 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_593 = 593 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_594 = 594 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_595 = 595 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_596 = 596 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_597 = 597 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_598 = 598 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_599 = 599 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_600 = 600 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_601 = 601 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_602 = 602 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_603 = 603 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_604 = 604 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_605 = 605 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_606 = 606 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_607 = 607 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_608 = 608 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_609 = 609 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_610 = 610 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_611 = 611 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_612 = 612 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_613 = 613 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_614 = 614 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_615 = 615 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_616 = 616 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_617 = 617 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_618 = 618 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_619 = 619 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_620 = 620 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_621 = 621 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_622 = 622 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_623 = 623 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_624 = 624 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_625 = 625 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_626 = 626 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_627 = 627 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_628 = 628 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_629 = 629 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_630 = 630 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_631 = 631 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_632 = 632 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_633 = 633 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_634 = 634 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_635 = 635 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_636 = 636 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_637 = 637 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_638 = 638 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_639 = 639 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_640 = 640 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_641 = 641 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_642 = 642 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_643 = 643 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_644 = 644 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_645 = 645 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_646 = 646 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_647 = 647 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_648 = 648 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_649 = 649 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_650 = 650 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_651 = 651 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_652 = 652 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_653 = 653 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_654 = 654 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_655 = 655 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_656 = 656 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_657 = 657 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_658 = 658 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_659 = 659 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_660 = 660 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_661 = 661 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_662 = 662 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_663 = 663 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_664 = 664 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_665 = 665 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_666 = 666 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_667 = 667 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_668 = 668 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_669 = 669 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_670 = 670 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_671 = 671 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_672 = 672 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_673 = 673 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_674 = 674 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_675 = 675 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_676 = 676 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_677 = 677 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_678 = 678 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_679 = 679 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_680 = 680 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_681 = 681 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_682 = 682 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_683 = 683 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_684 = 684 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_685 = 685 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_686 = 686 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_687 = 687 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_688 = 688 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_689 = 689 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_690 = 690 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_691 = 691 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_692 = 692 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_693 = 693 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_694 = 694 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_695 = 695 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_696 = 696 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_697 = 697 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_698 = 698 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_699 = 699 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_700 = 700 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_701 = 701 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_702 = 702 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_703 = 703 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_704 = 704 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_705 = 705 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_706 = 706 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_707 = 707 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_708 = 708 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_709 = 709 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_710 = 710 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_711 = 711 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_712 = 712 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_713 = 713 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_714 = 714 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_715 = 715 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_716 = 716 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_717 = 717 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_718 = 718 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_719 = 719 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_720 = 720 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_721 = 721 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_722 = 722 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_723 = 723 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_724 = 724 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_725 = 725 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_726 = 726 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_727 = 727 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_728 = 728 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_729 = 729 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_730 = 730 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_731 = 731 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_732 = 732 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_733 = 733 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_734 = 734 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_735 = 735 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_736 = 736 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_737 = 737 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_738 = 738 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_739 = 739 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_740 = 740 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_741 = 741 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_742 = 742 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_743 = 743 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_744 = 744 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_745 = 745 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_746 = 746 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_747 = 747 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_748 = 748 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_749 = 749 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_750 = 750 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_751 = 751 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_752 = 752 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_753 = 753 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_754 = 754 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_755 = 755 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_756 = 756 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_757 = 757 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_758 = 758 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_759 = 759 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_760 = 760 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_761 = 761 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_762 = 762 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_763 = 763 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_764 = 764 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_765 = 765 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_766 = 766 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_767 = 767 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_768 = 768 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_769 = 769 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_770 = 770 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_771 = 771 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_772 = 772 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_773 = 773 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_774 = 774 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_775 = 775 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_776 = 776 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_777 = 777 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_778 = 778 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_779 = 779 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_780 = 780 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_781 = 781 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_782 = 782 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_783 = 783 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_784 = 784 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_785 = 785 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_786 = 786 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_787 = 787 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_788 = 788 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_789 = 789 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_790 = 790 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_791 = 791 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_792 = 792 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_793 = 793 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_794 = 794 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_795 = 795 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_796 = 796 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_797 = 797 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_798 = 798 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_799 = 799 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_800 = 800 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_801 = 801 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_802 = 802 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_803 = 803 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_804 = 804 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_805 = 805 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_806 = 806 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_807 = 807 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_808 = 808 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_809 = 809 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_810 = 810 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_811 = 811 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_812 = 812 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_813 = 813 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_814 = 814 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_815 = 815 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_816 = 816 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_817 = 817 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_818 = 818 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_819 = 819 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_820 = 820 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_821 = 821 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_822 = 822 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_823 = 823 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_824 = 824 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_825 = 825 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_826 = 826 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_827 = 827 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_828 = 828 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_829 = 829 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_830 = 830 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_831 = 831 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_832 = 832 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_833 = 833 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_834 = 834 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_835 = 835 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_836 = 836 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_837 = 837 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_838 = 838 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_839 = 839 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_840 = 840 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_841 = 841 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_842 = 842 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_843 = 843 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_844 = 844 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_845 = 845 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_846 = 846 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_847 = 847 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_848 = 848 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_849 = 849 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_850 = 850 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_851 = 851 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_852 = 852 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_853 = 853 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_854 = 854 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_855 = 855 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_856 = 856 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_857 = 857 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_858 = 858 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_859 = 859 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_860 = 860 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_861 = 861 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_862 = 862 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_863 = 863 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_864 = 864 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_865 = 865 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_866 = 866 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_867 = 867 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_868 = 868 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_869 = 869 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_870 = 870 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_871 = 871 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_872 = 872 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_873 = 873 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_874 = 874 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_875 = 875 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_876 = 876 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_877 = 877 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_878 = 878 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_879 = 879 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_880 = 880 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_881 = 881 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_882 = 882 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_883 = 883 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_884 = 884 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_885 = 885 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_886 = 886 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_887 = 887 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_888 = 888 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_889 = 889 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_890 = 890 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_891 = 891 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_892 = 892 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_893 = 893 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_894 = 894 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_895 = 895 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_896 = 896 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_897 = 897 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_898 = 898 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_899 = 899 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_900 = 900 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_901 = 901 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_902 = 902 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_903 = 903 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_904 = 904 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_905 = 905 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_906 = 906 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_907 = 907 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_908 = 908 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_909 = 909 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_910 = 910 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_911 = 911 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_912 = 912 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_913 = 913 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_914 = 914 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_915 = 915 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_916 = 916 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_917 = 917 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_918 = 918 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_919 = 919 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_920 = 920 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_921 = 921 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_922 = 922 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_923 = 923 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_924 = 924 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_925 = 925 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_926 = 926 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_927 = 927 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_928 = 928 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_929 = 929 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_930 = 930 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_931 = 931 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_932 = 932 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_933 = 933 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_934 = 934 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_935 = 935 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_936 = 936 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_937 = 937 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_938 = 938 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_939 = 939 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_940 = 940 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_941 = 941 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_942 = 942 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_943 = 943 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_944 = 944 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_945 = 945 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_946 = 946 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_947 = 947 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_948 = 948 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_949 = 949 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_950 = 950 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_951 = 951 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_952 = 952 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_953 = 953 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_954 = 954 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_955 = 955 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_956 = 956 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_957 = 957 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_958 = 958 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_959 = 959 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_960 = 960 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_961 = 961 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_962 = 962 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_963 = 963 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_964 = 964 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_965 = 965 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_966 = 966 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_967 = 967 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_968 = 968 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_969 = 969 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_970 = 970 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_971 = 971 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_972 = 972 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_973 = 973 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_974 = 974 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_975 = 975 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_976 = 976 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_977 = 977 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_978 = 978 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_979 = 979 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_980 = 980 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_981 = 981 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_982 = 982 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_983 = 983 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_984 = 984 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_985 = 985 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_986 = 986 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_987 = 987 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_988 = 988 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_989 = 989 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_990 = 990 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_991 = 991 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_992 = 992 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_993 = 993 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_994 = 994 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_995 = 995 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_996 = 996 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_997 = 997 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_998 = 998 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_999 = 999 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
- optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1000 = 1000 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"];
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
deleted file mode 100644
index ec36cca..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
+++ /dev/null
@@ -1,64 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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.proto to test importing.
-
-
-// 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;
-
-option optimize_for = SPEED;
-
-// Exercise the java_package option.
-option java_package = "com.google.protobuf.test";
-
-// 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.proto";
-
-message ImportMessage {
- optional int32 d = 1;
-}
-
-enum ImportEnum {
- IMPORT_FOO = 7;
- IMPORT_BAR = 8;
- IMPORT_BAZ = 9;
-}
-
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto
deleted file mode 100644
index 81b117f..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_lite.proto
+++ /dev/null
@@ -1,51 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME.
-
-package protobuf_unittest_import;
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.google.protobuf";
-
-import public "google/protobuf/unittest_import_public_lite.proto";
-
-message ImportMessageLite {
- optional int32 d = 1;
-}
-
-enum ImportEnumLite {
- IMPORT_LITE_FOO = 7;
- IMPORT_LITE_BAR = 8;
- IMPORT_LITE_BAZ = 9;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
deleted file mode 100644
index ea5d1b1..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: liujisi@google.com (Pherl Liu)
-
-
-package protobuf_unittest_import;
-
-option java_package = "com.google.protobuf.test";
-
-message PublicImportMessage {
- optional int32 e = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto
deleted file mode 100644
index d077563..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public_lite.proto
+++ /dev/null
@@ -1,42 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: liujisi@google.com (Pherl Liu)
-
-
-package protobuf_unittest_import;
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.google.protobuf";
-
-message PublicImportMessageLite {
- optional int32 e = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto
deleted file mode 100644
index a1764aa..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite.proto
+++ /dev/null
@@ -1,360 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// This is like unittest.proto but with optimize_for = LITE_RUNTIME.
-
-package protobuf_unittest;
-
-import "google/protobuf/unittest_import_lite.proto";
-
-option optimize_for = LITE_RUNTIME;
-
-option java_package = "com.google.protobuf";
-
-// Same as TestAllTypes but with the lite runtime.
-message TestAllTypesLite {
- message NestedMessage {
- optional int32 bb = 1;
- }
-
- enum NestedEnum {
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- }
-
- // Singular
- optional int32 optional_int32 = 1;
- optional int64 optional_int64 = 2;
- optional uint32 optional_uint32 = 3;
- optional uint64 optional_uint64 = 4;
- optional sint32 optional_sint32 = 5;
- optional sint64 optional_sint64 = 6;
- optional fixed32 optional_fixed32 = 7;
- optional fixed64 optional_fixed64 = 8;
- optional sfixed32 optional_sfixed32 = 9;
- optional sfixed64 optional_sfixed64 = 10;
- optional float optional_float = 11;
- optional double optional_double = 12;
- optional bool optional_bool = 13;
- optional string optional_string = 14;
- optional bytes optional_bytes = 15;
-
- optional group OptionalGroup = 16 {
- optional int32 a = 17;
- }
-
- optional NestedMessage optional_nested_message = 18;
- optional ForeignMessageLite optional_foreign_message = 19;
- optional protobuf_unittest_import.ImportMessageLite
- optional_import_message = 20;
-
- optional NestedEnum optional_nested_enum = 21;
- optional ForeignEnumLite optional_foreign_enum = 22;
- optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23;
-
- optional string optional_string_piece = 24 [ctype=STRING_PIECE];
- optional string optional_cord = 25 [ctype=CORD];
-
- // Defined in unittest_import_public.proto
- optional protobuf_unittest_import.PublicImportMessageLite
- optional_public_import_message = 26;
-
- optional NestedMessage optional_lazy_message = 27 [lazy=true];
-
- // 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 group RepeatedGroup = 46 {
- optional int32 a = 47;
- }
-
- repeated NestedMessage repeated_nested_message = 48;
- repeated ForeignMessageLite repeated_foreign_message = 49;
- repeated protobuf_unittest_import.ImportMessageLite
- repeated_import_message = 50;
-
- repeated NestedEnum repeated_nested_enum = 51;
- repeated ForeignEnumLite repeated_foreign_enum = 52;
- repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53;
-
- repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord = 55 [ctype=CORD];
-
- repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32 = 61 [default = 41 ];
- optional int64 default_int64 = 62 [default = 42 ];
- optional uint32 default_uint32 = 63 [default = 43 ];
- optional uint64 default_uint64 = 64 [default = 44 ];
- optional sint32 default_sint32 = 65 [default = -45 ];
- optional sint64 default_sint64 = 66 [default = 46 ];
- optional fixed32 default_fixed32 = 67 [default = 47 ];
- optional fixed64 default_fixed64 = 68 [default = 48 ];
- optional sfixed32 default_sfixed32 = 69 [default = 49 ];
- optional sfixed64 default_sfixed64 = 70 [default = -50 ];
- optional float default_float = 71 [default = 51.5 ];
- optional double default_double = 72 [default = 52e3 ];
- optional bool default_bool = 73 [default = true ];
- optional string default_string = 74 [default = "hello"];
- optional bytes default_bytes = 75 [default = "world"];
-
- optional NestedEnum default_nested_enum = 81 [default = BAR];
- optional ForeignEnumLite default_foreign_enum = 82
- [default = FOREIGN_LITE_BAR];
- optional protobuf_unittest_import.ImportEnumLite
- default_import_enum = 83 [default = IMPORT_LITE_BAR];
-
- optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
- optional string default_cord = 85 [ctype=CORD,default="123"];
-}
-
-message ForeignMessageLite {
- optional int32 c = 1;
-}
-
-enum ForeignEnumLite {
- FOREIGN_LITE_FOO = 4;
- FOREIGN_LITE_BAR = 5;
- FOREIGN_LITE_BAZ = 6;
-}
-
-message TestPackedTypesLite {
- 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 ForeignEnumLite packed_enum = 103 [packed = true];
-}
-
-message TestAllExtensionsLite {
- extensions 1 to max;
-}
-
-extend TestAllExtensionsLite {
- // Singular
- optional int32 optional_int32_extension_lite = 1;
- optional int64 optional_int64_extension_lite = 2;
- optional uint32 optional_uint32_extension_lite = 3;
- optional uint64 optional_uint64_extension_lite = 4;
- optional sint32 optional_sint32_extension_lite = 5;
- optional sint64 optional_sint64_extension_lite = 6;
- optional fixed32 optional_fixed32_extension_lite = 7;
- optional fixed64 optional_fixed64_extension_lite = 8;
- optional sfixed32 optional_sfixed32_extension_lite = 9;
- optional sfixed64 optional_sfixed64_extension_lite = 10;
- optional float optional_float_extension_lite = 11;
- optional double optional_double_extension_lite = 12;
- optional bool optional_bool_extension_lite = 13;
- optional string optional_string_extension_lite = 14;
- optional bytes optional_bytes_extension_lite = 15;
-
- optional group OptionalGroup_extension_lite = 16 {
- optional int32 a = 17;
- }
-
- optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite
- = 18;
- optional ForeignMessageLite optional_foreign_message_extension_lite = 19;
- optional protobuf_unittest_import.ImportMessageLite
- optional_import_message_extension_lite = 20;
-
- optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21;
- optional ForeignEnumLite optional_foreign_enum_extension_lite = 22;
- optional protobuf_unittest_import.ImportEnumLite
- optional_import_enum_extension_lite = 23;
-
- optional string optional_string_piece_extension_lite = 24
- [ctype=STRING_PIECE];
- optional string optional_cord_extension_lite = 25 [ctype=CORD];
-
- optional protobuf_unittest_import.PublicImportMessageLite
- optional_public_import_message_extension_lite = 26;
-
- optional TestAllTypesLite.NestedMessage
- optional_lazy_message_extension_lite = 27 [lazy=true];
-
- // Repeated
- repeated int32 repeated_int32_extension_lite = 31;
- repeated int64 repeated_int64_extension_lite = 32;
- repeated uint32 repeated_uint32_extension_lite = 33;
- repeated uint64 repeated_uint64_extension_lite = 34;
- repeated sint32 repeated_sint32_extension_lite = 35;
- repeated sint64 repeated_sint64_extension_lite = 36;
- repeated fixed32 repeated_fixed32_extension_lite = 37;
- repeated fixed64 repeated_fixed64_extension_lite = 38;
- repeated sfixed32 repeated_sfixed32_extension_lite = 39;
- repeated sfixed64 repeated_sfixed64_extension_lite = 40;
- repeated float repeated_float_extension_lite = 41;
- repeated double repeated_double_extension_lite = 42;
- repeated bool repeated_bool_extension_lite = 43;
- repeated string repeated_string_extension_lite = 44;
- repeated bytes repeated_bytes_extension_lite = 45;
-
- repeated group RepeatedGroup_extension_lite = 46 {
- optional int32 a = 47;
- }
-
- repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite
- = 48;
- repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49;
- repeated protobuf_unittest_import.ImportMessageLite
- repeated_import_message_extension_lite = 50;
-
- repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51;
- repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52;
- repeated protobuf_unittest_import.ImportEnumLite
- repeated_import_enum_extension_lite = 53;
-
- repeated string repeated_string_piece_extension_lite = 54
- [ctype=STRING_PIECE];
- repeated string repeated_cord_extension_lite = 55 [ctype=CORD];
-
- repeated TestAllTypesLite.NestedMessage
- repeated_lazy_message_extension_lite = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32_extension_lite = 61 [default = 41 ];
- optional int64 default_int64_extension_lite = 62 [default = 42 ];
- optional uint32 default_uint32_extension_lite = 63 [default = 43 ];
- optional uint64 default_uint64_extension_lite = 64 [default = 44 ];
- optional sint32 default_sint32_extension_lite = 65 [default = -45 ];
- optional sint64 default_sint64_extension_lite = 66 [default = 46 ];
- optional fixed32 default_fixed32_extension_lite = 67 [default = 47 ];
- optional fixed64 default_fixed64_extension_lite = 68 [default = 48 ];
- optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49 ];
- optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50 ];
- optional float default_float_extension_lite = 71 [default = 51.5 ];
- optional double default_double_extension_lite = 72 [default = 52e3 ];
- optional bool default_bool_extension_lite = 73 [default = true ];
- optional string default_string_extension_lite = 74 [default = "hello"];
- optional bytes default_bytes_extension_lite = 75 [default = "world"];
-
- optional TestAllTypesLite.NestedEnum
- default_nested_enum_extension_lite = 81 [default = BAR];
- optional ForeignEnumLite
- default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR];
- optional protobuf_unittest_import.ImportEnumLite
- default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR];
-
- optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE,
- default="abc"];
- optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"];
-}
-
-message TestPackedExtensionsLite {
- extensions 1 to max;
-}
-
-extend TestPackedExtensionsLite {
- repeated int32 packed_int32_extension_lite = 90 [packed = true];
- repeated int64 packed_int64_extension_lite = 91 [packed = true];
- repeated uint32 packed_uint32_extension_lite = 92 [packed = true];
- repeated uint64 packed_uint64_extension_lite = 93 [packed = true];
- repeated sint32 packed_sint32_extension_lite = 94 [packed = true];
- repeated sint64 packed_sint64_extension_lite = 95 [packed = true];
- repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true];
- repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true];
- repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true];
- repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true];
- repeated float packed_float_extension_lite = 100 [packed = true];
- repeated double packed_double_extension_lite = 101 [packed = true];
- repeated bool packed_bool_extension_lite = 102 [packed = true];
- repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true];
-}
-
-message TestNestedExtensionLite {
- extend TestAllExtensionsLite {
- optional int32 nested_extension = 12345;
- }
-}
-
-// Test that deprecated fields work. We only verify that they compile (at one
-// point this failed).
-message TestDeprecatedLite {
- optional int32 deprecated_field = 1 [deprecated = true];
-}
-
-// See the comments of the same type in unittest.proto.
-message TestParsingMergeLite {
- message RepeatedFieldsGenerator {
- repeated TestAllTypesLite field1 = 1;
- repeated TestAllTypesLite field2 = 2;
- repeated TestAllTypesLite field3 = 3;
- repeated group Group1 = 10 {
- optional TestAllTypesLite field1 = 11;
- }
- repeated group Group2 = 20 {
- optional TestAllTypesLite field1 = 21;
- }
- repeated TestAllTypesLite ext1 = 1000;
- repeated TestAllTypesLite ext2 = 1001;
- }
- required TestAllTypesLite required_all_types = 1;
- optional TestAllTypesLite optional_all_types = 2;
- repeated TestAllTypesLite repeated_all_types = 3;
- optional group OptionalGroup = 10 {
- optional TestAllTypesLite optional_group_all_types = 11;
- }
- repeated group RepeatedGroup = 20 {
- optional TestAllTypesLite repeated_group_all_types = 21;
- }
- extensions 1000 to max;
- extend TestParsingMergeLite {
- optional TestAllTypesLite optional_ext = 1000;
- repeated TestAllTypesLite repeated_ext = 1001;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
deleted file mode 100644
index d52cb8c..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_lite_imports_nonlite.proto
+++ /dev/null
@@ -1,43 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-//
-// Tests that a "lite" message can import a regular message.
-
-package protobuf_unittest;
-
-import "google/protobuf/unittest.proto";
-
-option optimize_for = LITE_RUNTIME;
-
-message TestLiteImportsNonlite {
- optional TestAllTypes message = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
deleted file mode 100644
index 3497f09..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
+++ /dev/null
@@ -1,72 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file contains messages for testing message_set_wire_format.
-
-package protobuf_unittest;
-
-option optimize_for = SPEED;
-
-// A message with message_set_wire_format.
-message TestMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
-
-message TestMessageSetContainer {
- optional TestMessageSet message_set = 1;
-}
-
-message TestMessageSetExtension1 {
- extend TestMessageSet {
- optional TestMessageSetExtension1 message_set_extension = 1545008;
- }
- optional int32 i = 15;
-}
-
-message TestMessageSetExtension2 {
- extend TestMessageSet {
- optional TestMessageSetExtension2 message_set_extension = 1547769;
- }
- optional string str = 25;
-}
-
-// MessageSet wire format is equivalent to this.
-message RawMessageSet {
- repeated group Item = 1 {
- required int32 type_id = 2;
- required bytes message = 3;
- }
-}
-
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
deleted file mode 100644
index cffb412..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
+++ /dev/null
@@ -1,52 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-
-package google.protobuf.no_generic_services_test;
-
-// *_generic_services are false by default.
-
-message TestMessage {
- optional int32 a = 1;
- extensions 1000 to max;
-}
-
-enum TestEnum {
- FOO = 1;
-}
-
-extend TestMessage {
- optional int32 test_extension = 1000;
-}
-
-service TestService {
- rpc Foo(TestMessage) returns(TestMessage);
-}
diff --git a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto b/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto
deleted file mode 100644
index 658c6a9..0000000
--- a/java/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_optimize_for.proto
+++ /dev/null
@@ -1,61 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// A proto file which uses optimize_for = CODE_SIZE.
-
-import "google/protobuf/unittest.proto";
-
-package protobuf_unittest;
-
-option optimize_for = CODE_SIZE;
-
-message TestOptimizedForSize {
- optional int32 i = 1;
- optional ForeignMessage msg = 19;
-
- extensions 1000 to max;
-
- extend TestOptimizedForSize {
- optional int32 test_extension = 1234;
- optional TestRequiredOptimizedForSize test_extension2 = 1235;
- }
-}
-
-message TestRequiredOptimizedForSize {
- required int32 x = 1;
-}
-
-message TestOptionalOptimizedForSize {
- optional TestRequiredOptimizedForSize o = 1;
-}
diff --git a/java/compatibility_tests/v2.5.0/test.sh b/java/compatibility_tests/v2.5.0/test.sh
deleted file mode 100755
index 65ea960..0000000
--- a/java/compatibility_tests/v2.5.0/test.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-# Change to the script's directory.
-cd $(dirname $0)
-
-MAVEN_LOCAL_REPOSITORY=/var/maven_local_repository
-MVN="mvn --batch-mode -e -X -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$MAVEN_LOCAL_REPOSITORY"
-
-# Version of the tests (i.e., the version of protobuf from where we extracted
-# these tests).
-TEST_VERSION=`grep "^ <version>.*</version>" pom.xml | sed "s| <version>\(.*\)</version>|\1|"`
-
-# 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 compatibility of the
-# latest version against other versions.
-OLD_VERSION=$1
-OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe
-
-# Extract the latest protobuf version number.
-VERSION_NUMBER=`grep "^ <version>.*</version>" ../../pom.xml | sed "s| <version>\(.*\)</version>|\1|"`
-
-echo "Running compatibility tests between current $VERSION_NUMBER and released $OLD_VERSION"
-
-# Check protoc
-[ -f ../../../src/protoc ] || {
- echo "[ERROR]: Please build protoc first."
- exit 1
-}
-
-# Build and install protobuf-java-$VERSION_NUMBER.jar
-[ -f ../../core/target/protobuf-java-$VERSION_NUMBER.jar ] || {
- pushd ../..
- $MVN install -Dmaven.test.skip=true
- popd
-}
-
-# Download old version source for the compatibility test
-[ -d protobuf ] || {
- git clone https://github.com/protocolbuffers/protobuf.git
- cd protobuf
- git reset --hard v$TEST_VERSION
- cd ..
-}
-
-# Download old version protoc compiler (for linux)
-wget $OLD_VERSION_PROTOC -O protoc
-chmod +x protoc
-
-# Test source compatibility. In these tests we recompile everything against
-# the new runtime (including old version generated code).
-
-# Test A.1:
-# protos: use new version
-# more_protos: use old version
-$MVN clean test \
- -Dprotobuf.test.source.path=$(pwd)/protobuf \
- -Dprotoc.path=$(pwd)/protoc \
- -Dprotos.protoc.path=$(pwd)/../../../src/protoc \
- -Dprotobuf.version=$VERSION_NUMBER
-
-# Test A.2:
-# protos: use old version
-# more_protos: use new version
-$MVN clean test \
- -Dprotobuf.test.source.path=$(pwd)/protobuf \
- -Dprotoc.path=$(pwd)/protoc \
- -Dmore_protos.protoc.path=$(pwd)/../../../src/protoc \
- -Dprotobuf.version=$VERSION_NUMBER
-
-# Test binary compatibility. In these tests we run the old version compiled
-# jar against the new runtime directly without recompile.
-
-# Collect all test dependencies in a single jar file (except for protobuf) to
-# make it easier to run binary compatibility test (where we will need to run
-# the jar files directly).
-cd deps
-$MVN assembly:single
-cd ..
-cp -f deps/target/compatibility-test-deps-${TEST_VERSION}-jar-with-dependencies.jar deps.jar
-
-# Build the old version of all 3 artifacts.
-$MVN clean install -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/protoc -Dprotobuf.version=$OLD_VERSION
-cp -f protos/target/compatibility-protos-${TEST_VERSION}.jar protos.jar
-cp -f more_protos/target/compatibility-more-protos-${TEST_VERSION}.jar more_protos.jar
-cp -f tests/target/compatibility-tests-${TEST_VERSION}.jar tests.jar
-
-# Collect the list of tests we need to run.
-TESTS=`find tests -name "*Test.java" | sed "s|/|.|g;s/.java$//g;s/tests.src.main.java.//g"`
-
-# Test B.1: run all the old artifacts against the new runtime. Note that we
-# must run the test in the protobuf source tree because some of the tests need
-# to read golden test data files.
-cd protobuf
-java -cp ../../../core/target/protobuf-java-$VERSION_NUMBER.jar:../protos.jar:../more_protos.jar:../tests.jar:../deps.jar org.junit.runner.JUnitCore $TESTS
-cd ..
-
-# Test B.2: update protos.jar only.
-cd protos
-$MVN clean package -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/../../../../src/protoc -Dprotobuf.version=$VERSION_NUMBER
-cd ..
-cd protobuf
-java -cp ../../../core/target/protobuf-java-$VERSION_NUMBER.jar:../protos/target/compatibility-protos-${TEST_VERSION}.jar:../more_protos.jar:../tests.jar:../deps.jar org.junit.runner.JUnitCore $TESTS
-cd ..
-
-# Test B.3: update more_protos.jar only.
-cd more_protos
-$MVN clean package -Dmaven.test.skip=true -Dprotoc.path=$(pwd)/../../../../src/protoc -Dprotobuf.version=$VERSION_NUMBER
-cd ..
-cd protobuf
-java -cp ../../../core/target/protobuf-java-$VERSION_NUMBER.jar:../protos.jar:../more_protos/target/compatibility-more-protos-${TEST_VERSION}.jar:../tests.jar:../deps.jar org.junit.runner.JUnitCore $TESTS
-cd ..
diff --git a/java/compatibility_tests/v2.5.0/tests/pom.xml b/java/compatibility_tests/v2.5.0/tests/pom.xml
deleted file mode 100644
index f1ce46e..0000000
--- a/java/compatibility_tests/v2.5.0/tests/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-test-suite</artifactId>
- <version>2.5.0</version>
- <relativePath>..</relativePath>
- </parent>
-
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-tests</artifactId>
- <version>2.5.0</version>
-
- <name>Compatibility Tests</name>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <version>2.2.1</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf</groupId>
- <artifactId>protobuf-java</artifactId>
- <version>${tests.protobuf.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-protos</artifactId>
- <version>2.5.0</version>
- </dependency>
- <dependency>
- <groupId>com.google.protobuf.compatibility</groupId>
- <artifactId>compatibility-more-protos</artifactId>
- <version>2.5.0</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <testSourceDirectory>${basedir}/src/main/java/</testSourceDirectory>
- <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- <workingDirectory>${protobuf.test.source.path}</workingDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java
deleted file mode 100644
index 6789550..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/AbstractMessageTest.java
+++ /dev/null
@@ -1,510 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize;
-import protobuf_unittest.UnittestProto;
-import protobuf_unittest.UnittestProto.ForeignMessage;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
-import protobuf_unittest.UnittestProto.TestRequired;
-import protobuf_unittest.UnittestProto.TestRequiredForeign;
-import protobuf_unittest.UnittestProto.TestUnpackedTypes;
-
-import junit.framework.TestCase;
-
-import java.util.Map;
-
-/**
- * Unit test for {@link AbstractMessage}.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class AbstractMessageTest extends TestCase {
- /**
- * Extends AbstractMessage and wraps some other message object. The methods
- * of the Message interface which aren't explicitly implemented by
- * AbstractMessage are forwarded to the wrapped object. This allows us to
- * test that AbstractMessage's implementations work even if the wrapped
- * object does not use them.
- */
- private static class AbstractMessageWrapper extends AbstractMessage {
- private final Message wrappedMessage;
-
- public AbstractMessageWrapper(Message wrappedMessage) {
- this.wrappedMessage = wrappedMessage;
- }
-
- public Descriptors.Descriptor getDescriptorForType() {
- return wrappedMessage.getDescriptorForType();
- }
- public AbstractMessageWrapper getDefaultInstanceForType() {
- return new AbstractMessageWrapper(
- wrappedMessage.getDefaultInstanceForType());
- }
- public Map<Descriptors.FieldDescriptor, Object> getAllFields() {
- return wrappedMessage.getAllFields();
- }
- public boolean hasField(Descriptors.FieldDescriptor field) {
- return wrappedMessage.hasField(field);
- }
- public Object getField(Descriptors.FieldDescriptor field) {
- return wrappedMessage.getField(field);
- }
- public int getRepeatedFieldCount(Descriptors.FieldDescriptor field) {
- return wrappedMessage.getRepeatedFieldCount(field);
- }
- public Object getRepeatedField(
- Descriptors.FieldDescriptor field, int index) {
- return wrappedMessage.getRepeatedField(field, index);
- }
- public UnknownFieldSet getUnknownFields() {
- return wrappedMessage.getUnknownFields();
- }
- public Builder newBuilderForType() {
- return new Builder(wrappedMessage.newBuilderForType());
- }
- public Builder toBuilder() {
- return new Builder(wrappedMessage.toBuilder());
- }
-
- static class Builder extends AbstractMessage.Builder<Builder> {
- private final Message.Builder wrappedBuilder;
-
- public Builder(Message.Builder wrappedBuilder) {
- this.wrappedBuilder = wrappedBuilder;
- }
-
- public AbstractMessageWrapper build() {
- return new AbstractMessageWrapper(wrappedBuilder.build());
- }
- public AbstractMessageWrapper buildPartial() {
- return new AbstractMessageWrapper(wrappedBuilder.buildPartial());
- }
- public Builder clone() {
- return new Builder(wrappedBuilder.clone());
- }
- public boolean isInitialized() {
- return clone().buildPartial().isInitialized();
- }
- public Descriptors.Descriptor getDescriptorForType() {
- return wrappedBuilder.getDescriptorForType();
- }
- public AbstractMessageWrapper getDefaultInstanceForType() {
- return new AbstractMessageWrapper(
- wrappedBuilder.getDefaultInstanceForType());
- }
- public Map<Descriptors.FieldDescriptor, Object> getAllFields() {
- return wrappedBuilder.getAllFields();
- }
- public Builder newBuilderForField(Descriptors.FieldDescriptor field) {
- return new Builder(wrappedBuilder.newBuilderForField(field));
- }
- public boolean hasField(Descriptors.FieldDescriptor field) {
- return wrappedBuilder.hasField(field);
- }
- public Object getField(Descriptors.FieldDescriptor field) {
- return wrappedBuilder.getField(field);
- }
- public Builder setField(Descriptors.FieldDescriptor field, Object value) {
- wrappedBuilder.setField(field, value);
- return this;
- }
- public Builder clearField(Descriptors.FieldDescriptor field) {
- wrappedBuilder.clearField(field);
- return this;
- }
- public int getRepeatedFieldCount(Descriptors.FieldDescriptor field) {
- return wrappedBuilder.getRepeatedFieldCount(field);
- }
- public Object getRepeatedField(
- Descriptors.FieldDescriptor field, int index) {
- return wrappedBuilder.getRepeatedField(field, index);
- }
- public Builder setRepeatedField(Descriptors.FieldDescriptor field,
- int index, Object value) {
- wrappedBuilder.setRepeatedField(field, index, value);
- return this;
- }
- public Builder addRepeatedField(
- Descriptors.FieldDescriptor field, Object value) {
- wrappedBuilder.addRepeatedField(field, value);
- return this;
- }
- public UnknownFieldSet getUnknownFields() {
- return wrappedBuilder.getUnknownFields();
- }
- public Builder setUnknownFields(UnknownFieldSet unknownFields) {
- wrappedBuilder.setUnknownFields(unknownFields);
- return this;
- }
- @Override
- public Message.Builder getFieldBuilder(FieldDescriptor field) {
- return wrappedBuilder.getFieldBuilder(field);
- }
- }
- public Parser<? extends Message> getParserForType() {
- return wrappedMessage.getParserForType();
- }
- }
-
- // =================================================================
-
- TestUtil.ReflectionTester reflectionTester =
- new TestUtil.ReflectionTester(TestAllTypes.getDescriptor(), null);
-
- TestUtil.ReflectionTester extensionsReflectionTester =
- new TestUtil.ReflectionTester(TestAllExtensions.getDescriptor(),
- TestUtil.getExtensionRegistry());
-
- public void testClear() throws Exception {
- AbstractMessageWrapper message =
- new AbstractMessageWrapper.Builder(
- TestAllTypes.newBuilder(TestUtil.getAllSet()))
- .clear().build();
- TestUtil.assertClear((TestAllTypes) message.wrappedMessage);
- }
-
- public void testCopy() throws Exception {
- AbstractMessageWrapper message =
- new AbstractMessageWrapper.Builder(TestAllTypes.newBuilder())
- .mergeFrom(TestUtil.getAllSet()).build();
- TestUtil.assertAllFieldsSet((TestAllTypes) message.wrappedMessage);
- }
-
- public void testSerializedSize() throws Exception {
- TestAllTypes message = TestUtil.getAllSet();
- Message abstractMessage = new AbstractMessageWrapper(TestUtil.getAllSet());
-
- assertEquals(message.getSerializedSize(),
- abstractMessage.getSerializedSize());
- }
-
- public void testSerialization() throws Exception {
- Message abstractMessage = new AbstractMessageWrapper(TestUtil.getAllSet());
-
- TestUtil.assertAllFieldsSet(
- TestAllTypes.parseFrom(abstractMessage.toByteString()));
-
- assertEquals(TestUtil.getAllSet().toByteString(),
- abstractMessage.toByteString());
- }
-
- public void testParsing() throws Exception {
- AbstractMessageWrapper.Builder builder =
- new AbstractMessageWrapper.Builder(TestAllTypes.newBuilder());
- AbstractMessageWrapper message =
- builder.mergeFrom(TestUtil.getAllSet().toByteString()).build();
- TestUtil.assertAllFieldsSet((TestAllTypes) message.wrappedMessage);
- }
-
- public void testParsingUninitialized() throws Exception {
- TestRequiredForeign.Builder builder = TestRequiredForeign.newBuilder();
- builder.getOptionalMessageBuilder().setDummy2(10);
- ByteString bytes = builder.buildPartial().toByteString();
- Message.Builder abstractMessageBuilder =
- new AbstractMessageWrapper.Builder(TestRequiredForeign.newBuilder());
- // mergeFrom() should not throw initialization error.
- abstractMessageBuilder.mergeFrom(bytes).buildPartial();
- try {
- abstractMessageBuilder.mergeFrom(bytes).build();
- fail();
- } catch (UninitializedMessageException ex) {
- // pass
- }
-
- // test DynamicMessage directly.
- Message.Builder dynamicMessageBuilder = DynamicMessage.newBuilder(
- TestRequiredForeign.getDescriptor());
- // mergeFrom() should not throw initialization error.
- dynamicMessageBuilder.mergeFrom(bytes).buildPartial();
- try {
- dynamicMessageBuilder.mergeFrom(bytes).build();
- fail();
- } catch (UninitializedMessageException ex) {
- // pass
- }
- }
-
- public void testPackedSerialization() throws Exception {
- Message abstractMessage =
- new AbstractMessageWrapper(TestUtil.getPackedSet());
-
- TestUtil.assertPackedFieldsSet(
- TestPackedTypes.parseFrom(abstractMessage.toByteString()));
-
- assertEquals(TestUtil.getPackedSet().toByteString(),
- abstractMessage.toByteString());
- }
-
- public void testPackedParsing() throws Exception {
- AbstractMessageWrapper.Builder builder =
- new AbstractMessageWrapper.Builder(TestPackedTypes.newBuilder());
- AbstractMessageWrapper message =
- builder.mergeFrom(TestUtil.getPackedSet().toByteString()).build();
- TestUtil.assertPackedFieldsSet((TestPackedTypes) message.wrappedMessage);
- }
-
- public void testUnpackedSerialization() throws Exception {
- Message abstractMessage =
- new AbstractMessageWrapper(TestUtil.getUnpackedSet());
-
- TestUtil.assertUnpackedFieldsSet(
- TestUnpackedTypes.parseFrom(abstractMessage.toByteString()));
-
- assertEquals(TestUtil.getUnpackedSet().toByteString(),
- abstractMessage.toByteString());
- }
-
- public void testParsePackedToUnpacked() throws Exception {
- AbstractMessageWrapper.Builder builder =
- new AbstractMessageWrapper.Builder(TestUnpackedTypes.newBuilder());
- AbstractMessageWrapper message =
- builder.mergeFrom(TestUtil.getPackedSet().toByteString()).build();
- TestUtil.assertUnpackedFieldsSet(
- (TestUnpackedTypes) message.wrappedMessage);
- }
-
- public void testParseUnpackedToPacked() throws Exception {
- AbstractMessageWrapper.Builder builder =
- new AbstractMessageWrapper.Builder(TestPackedTypes.newBuilder());
- AbstractMessageWrapper message =
- builder.mergeFrom(TestUtil.getUnpackedSet().toByteString()).build();
- TestUtil.assertPackedFieldsSet((TestPackedTypes) message.wrappedMessage);
- }
-
- public void testUnpackedParsing() throws Exception {
- AbstractMessageWrapper.Builder builder =
- new AbstractMessageWrapper.Builder(TestUnpackedTypes.newBuilder());
- AbstractMessageWrapper message =
- builder.mergeFrom(TestUtil.getUnpackedSet().toByteString()).build();
- TestUtil.assertUnpackedFieldsSet(
- (TestUnpackedTypes) message.wrappedMessage);
- }
-
- public void testOptimizedForSize() throws Exception {
- // We're mostly only checking that this class was compiled successfully.
- TestOptimizedForSize message =
- TestOptimizedForSize.newBuilder().setI(1).build();
- message = TestOptimizedForSize.parseFrom(message.toByteString());
- assertEquals(2, message.getSerializedSize());
- }
-
- // -----------------------------------------------------------------
- // Tests for isInitialized().
-
- private static final TestRequired TEST_REQUIRED_UNINITIALIZED =
- TestRequired.getDefaultInstance();
- private static final TestRequired TEST_REQUIRED_INITIALIZED =
- TestRequired.newBuilder().setA(1).setB(2).setC(3).build();
-
- public void testIsInitialized() throws Exception {
- TestRequired.Builder builder = TestRequired.newBuilder();
- AbstractMessageWrapper.Builder abstractBuilder =
- new AbstractMessageWrapper.Builder(builder);
-
- assertFalse(abstractBuilder.isInitialized());
- assertEquals("a, b, c", abstractBuilder.getInitializationErrorString());
- builder.setA(1);
- assertFalse(abstractBuilder.isInitialized());
- assertEquals("b, c", abstractBuilder.getInitializationErrorString());
- builder.setB(1);
- assertFalse(abstractBuilder.isInitialized());
- assertEquals("c", abstractBuilder.getInitializationErrorString());
- builder.setC(1);
- assertTrue(abstractBuilder.isInitialized());
- assertEquals("", abstractBuilder.getInitializationErrorString());
- }
-
- public void testForeignIsInitialized() throws Exception {
- TestRequiredForeign.Builder builder = TestRequiredForeign.newBuilder();
- AbstractMessageWrapper.Builder abstractBuilder =
- new AbstractMessageWrapper.Builder(builder);
-
- assertTrue(abstractBuilder.isInitialized());
- assertEquals("", abstractBuilder.getInitializationErrorString());
-
- builder.setOptionalMessage(TEST_REQUIRED_UNINITIALIZED);
- assertFalse(abstractBuilder.isInitialized());
- assertEquals(
- "optional_message.a, optional_message.b, optional_message.c",
- abstractBuilder.getInitializationErrorString());
-
- builder.setOptionalMessage(TEST_REQUIRED_INITIALIZED);
- assertTrue(abstractBuilder.isInitialized());
- assertEquals("", abstractBuilder.getInitializationErrorString());
-
- builder.addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED);
- assertFalse(abstractBuilder.isInitialized());
- assertEquals(
- "repeated_message[0].a, repeated_message[0].b, repeated_message[0].c",
- abstractBuilder.getInitializationErrorString());
-
- builder.setRepeatedMessage(0, TEST_REQUIRED_INITIALIZED);
- assertTrue(abstractBuilder.isInitialized());
- assertEquals("", abstractBuilder.getInitializationErrorString());
- }
-
- // -----------------------------------------------------------------
- // Tests for mergeFrom
-
- static final TestAllTypes MERGE_SOURCE =
- TestAllTypes.newBuilder()
- .setOptionalInt32(1)
- .setOptionalString("foo")
- .setOptionalForeignMessage(ForeignMessage.getDefaultInstance())
- .addRepeatedString("bar")
- .build();
-
- static final TestAllTypes MERGE_DEST =
- TestAllTypes.newBuilder()
- .setOptionalInt64(2)
- .setOptionalString("baz")
- .setOptionalForeignMessage(ForeignMessage.newBuilder().setC(3).build())
- .addRepeatedString("qux")
- .build();
-
- static final String MERGE_RESULT_TEXT =
- "optional_int32: 1\n" +
- "optional_int64: 2\n" +
- "optional_string: \"foo\"\n" +
- "optional_foreign_message {\n" +
- " c: 3\n" +
- "}\n" +
- "repeated_string: \"qux\"\n" +
- "repeated_string: \"bar\"\n";
-
- public void testMergeFrom() throws Exception {
- AbstractMessageWrapper result =
- new AbstractMessageWrapper.Builder(
- TestAllTypes.newBuilder(MERGE_DEST))
- .mergeFrom(MERGE_SOURCE).build();
-
- assertEquals(MERGE_RESULT_TEXT, result.toString());
- }
-
- // -----------------------------------------------------------------
- // Tests for equals and hashCode
-
- public void testEqualsAndHashCode() throws Exception {
- TestAllTypes a = TestUtil.getAllSet();
- TestAllTypes b = TestAllTypes.newBuilder().build();
- TestAllTypes c = TestAllTypes.newBuilder(b).addRepeatedString("x").build();
- TestAllTypes d = TestAllTypes.newBuilder(c).addRepeatedString("y").build();
- TestAllExtensions e = TestUtil.getAllExtensionsSet();
- TestAllExtensions f = TestAllExtensions.newBuilder(e)
- .addExtension(UnittestProto.repeatedInt32Extension, 999).build();
-
- checkEqualsIsConsistent(a);
- checkEqualsIsConsistent(b);
- checkEqualsIsConsistent(c);
- checkEqualsIsConsistent(d);
- checkEqualsIsConsistent(e);
- checkEqualsIsConsistent(f);
-
- checkNotEqual(a, b);
- checkNotEqual(a, c);
- checkNotEqual(a, d);
- checkNotEqual(a, e);
- checkNotEqual(a, f);
-
- checkNotEqual(b, c);
- checkNotEqual(b, d);
- checkNotEqual(b, e);
- checkNotEqual(b, f);
-
- checkNotEqual(c, d);
- checkNotEqual(c, e);
- checkNotEqual(c, f);
-
- checkNotEqual(d, e);
- checkNotEqual(d, f);
-
- checkNotEqual(e, f);
-
- // Deserializing into the TestEmptyMessage such that every field
- // is an {@link UnknownFieldSet.Field}.
- UnittestProto.TestEmptyMessage eUnknownFields =
- UnittestProto.TestEmptyMessage.parseFrom(e.toByteArray());
- UnittestProto.TestEmptyMessage fUnknownFields =
- UnittestProto.TestEmptyMessage.parseFrom(f.toByteArray());
- checkNotEqual(eUnknownFields, fUnknownFields);
- checkEqualsIsConsistent(eUnknownFields);
- checkEqualsIsConsistent(fUnknownFields);
-
- // Subsequent reconstitutions should be identical
- UnittestProto.TestEmptyMessage eUnknownFields2 =
- UnittestProto.TestEmptyMessage.parseFrom(e.toByteArray());
- checkEqualsIsConsistent(eUnknownFields, eUnknownFields2);
- }
-
-
- /**
- * Asserts that the given proto has symmetric equals and hashCode methods.
- */
- private void checkEqualsIsConsistent(Message message) {
- // Object should be equal to itself.
- assertEquals(message, message);
-
- // Object should be equal to a dynamic copy of itself.
- DynamicMessage dynamic = DynamicMessage.newBuilder(message).build();
- checkEqualsIsConsistent(message, dynamic);
- }
-
- /**
- * Asserts that the given protos are equal and have the same hash code.
- */
- private void checkEqualsIsConsistent(Message message1, Message message2) {
- assertEquals(message1, message2);
- assertEquals(message2, message1);
- assertEquals(message2.hashCode(), message1.hashCode());
- }
-
- /**
- * Asserts that the given protos are not equal and have different hash codes.
- *
- * @warning It's valid for non-equal objects to have the same hash code, so
- * this test is stricter than it needs to be. However, this should happen
- * relatively rarely.
- */
- private void checkNotEqual(Message m1, Message m2) {
- String equalsError = String.format("%s should not be equal to %s", m1, m2);
- assertFalse(equalsError, m1.equals(m2));
- assertFalse(equalsError, m2.equals(m1));
-
- assertFalse(
- String.format("%s should have a different hash code from %s", m1, m2),
- m1.hashCode() == m2.hashCode());
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
deleted file mode 100644
index c838274..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/BoundedByteStringTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * This class tests {@link BoundedByteString}, which extends {@link LiteralByteString},
- * by inheriting the tests from {@link LiteralByteStringTest}. The only method which
- * is strange enough that it needs to be overridden here is {@link #testToString()}.
- *
- * @author carlanton@google.com (Carl Haverl)
- */
-public class BoundedByteStringTest extends LiteralByteStringTest {
-
- @Override
- protected void setUp() throws Exception {
- classUnderTest = "BoundedByteString";
- byte[] sourceBytes = ByteStringTest.getTestBytes(2341, 11337766L);
- int from = 100;
- int to = sourceBytes.length - 100;
- stringUnderTest = ByteString.copyFrom(sourceBytes).substring(from, to);
- referenceBytes = new byte[to - from];
- System.arraycopy(sourceBytes, from, referenceBytes, 0, to - from);
- expectedHashCode = 727575887;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java
deleted file mode 100644
index 9e334e5..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ByteStringTest.java
+++ /dev/null
@@ -1,590 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import com.google.protobuf.ByteString.Output;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Random;
-
-/**
- * Test methods with implementations in {@link ByteString}, plus do some top-level "integration"
- * tests.
- *
- * @author carlanton@google.com (Carl Haverl)
- */
-public class ByteStringTest extends TestCase {
-
- private static final String UTF_16 = "UTF-16";
-
- static byte[] getTestBytes(int size, long seed) {
- Random random = new Random(seed);
- byte[] result = new byte[size];
- random.nextBytes(result);
- return result;
- }
-
- private byte[] getTestBytes(int size) {
- return getTestBytes(size, 445566L);
- }
-
- private byte[] getTestBytes() {
- return getTestBytes(1000);
- }
-
- // Compare the entire left array with a subset of the right array.
- private boolean isArrayRange(byte[] left, byte[] right, int rightOffset, int length) {
- boolean stillEqual = (left.length == length);
- for (int i = 0; (stillEqual && i < length); ++i) {
- stillEqual = (left[i] == right[rightOffset + i]);
- }
- return stillEqual;
- }
-
- // Returns true only if the given two arrays have identical contents.
- private boolean isArray(byte[] left, byte[] right) {
- return left.length == right.length && isArrayRange(left, right, 0, left.length);
- }
-
- public void testSubstring_BeginIndex() {
- byte[] bytes = getTestBytes();
- ByteString substring = ByteString.copyFrom(bytes).substring(500);
- assertTrue("substring must contain the tail of the string",
- isArrayRange(substring.toByteArray(), bytes, 500, bytes.length - 500));
- }
-
- public void testCopyFrom_BytesOffsetSize() {
- byte[] bytes = getTestBytes();
- ByteString byteString = ByteString.copyFrom(bytes, 500, 200);
- assertTrue("copyFrom sub-range must contain the expected bytes",
- isArrayRange(byteString.toByteArray(), bytes, 500, 200));
- }
-
- public void testCopyFrom_Bytes() {
- byte[] bytes = getTestBytes();
- ByteString byteString = ByteString.copyFrom(bytes);
- assertTrue("copyFrom must contain the expected bytes",
- isArray(byteString.toByteArray(), bytes));
- }
-
- public void testCopyFrom_ByteBufferSize() {
- byte[] bytes = getTestBytes();
- ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
- byteBuffer.put(bytes);
- byteBuffer.position(500);
- ByteString byteString = ByteString.copyFrom(byteBuffer, 200);
- assertTrue("copyFrom byteBuffer sub-range must contain the expected bytes",
- isArrayRange(byteString.toByteArray(), bytes, 500, 200));
- }
-
- public void testCopyFrom_ByteBuffer() {
- byte[] bytes = getTestBytes();
- ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
- byteBuffer.put(bytes);
- byteBuffer.position(500);
- ByteString byteString = ByteString.copyFrom(byteBuffer);
- assertTrue("copyFrom byteBuffer sub-range must contain the expected bytes",
- isArrayRange(byteString.toByteArray(), bytes, 500, bytes.length - 500));
- }
-
- public void testCopyFrom_StringEncoding() throws UnsupportedEncodingException {
- String testString = "I love unicode \u1234\u5678 characters";
- ByteString byteString = ByteString.copyFrom(testString, UTF_16);
- byte[] testBytes = testString.getBytes(UTF_16);
- assertTrue("copyFrom string must respect the charset",
- isArrayRange(byteString.toByteArray(), testBytes, 0, testBytes.length));
- }
-
- public void testCopyFrom_Utf8() throws UnsupportedEncodingException {
- String testString = "I love unicode \u1234\u5678 characters";
- ByteString byteString = ByteString.copyFromUtf8(testString);
- byte[] testBytes = testString.getBytes("UTF-8");
- assertTrue("copyFromUtf8 string must respect the charset",
- isArrayRange(byteString.toByteArray(), testBytes, 0, testBytes.length));
- }
-
- public void testCopyFrom_Iterable() {
- byte[] testBytes = getTestBytes(77777, 113344L);
- final List<ByteString> pieces = makeConcretePieces(testBytes);
- // Call copyFrom() on a Collection
- ByteString byteString = ByteString.copyFrom(pieces);
- assertTrue("copyFrom a List must contain the expected bytes",
- isArrayRange(byteString.toByteArray(), testBytes, 0, testBytes.length));
- // Call copyFrom on an iteration that's not a collection
- ByteString byteStringAlt = ByteString.copyFrom(new Iterable<ByteString>() {
- public Iterator<ByteString> iterator() {
- return pieces.iterator();
- }
- });
- assertEquals("copyFrom from an Iteration must contain the expected bytes",
- byteString, byteStringAlt);
- }
-
- public void testCopyTo_TargetOffset() {
- byte[] bytes = getTestBytes();
- ByteString byteString = ByteString.copyFrom(bytes);
- byte[] target = new byte[bytes.length + 1000];
- byteString.copyTo(target, 400);
- assertTrue("copyFrom byteBuffer sub-range must contain the expected bytes",
- isArrayRange(bytes, target, 400, bytes.length));
- }
-
- public void testReadFrom_emptyStream() throws IOException {
- ByteString byteString =
- ByteString.readFrom(new ByteArrayInputStream(new byte[0]));
- assertSame("reading an empty stream must result in the EMPTY constant "
- + "byte string", ByteString.EMPTY, byteString);
- }
-
- public void testReadFrom_smallStream() throws IOException {
- assertReadFrom(getTestBytes(10));
- }
-
- public void testReadFrom_mutating() throws IOException {
- byte[] capturedArray = null;
- EvilInputStream eis = new EvilInputStream();
- ByteString byteString = ByteString.readFrom(eis);
-
- capturedArray = eis.capturedArray;
- byte[] originalValue = byteString.toByteArray();
- for (int x = 0; x < capturedArray.length; ++x) {
- capturedArray[x] = (byte) 0;
- }
-
- byte[] newValue = byteString.toByteArray();
- assertTrue("copyFrom byteBuffer must not grant access to underlying array",
- Arrays.equals(originalValue, newValue));
- }
-
- // Tests sizes that are over multi-segment rope threshold.
- public void testReadFrom_largeStream() throws IOException {
- assertReadFrom(getTestBytes(0x100));
- assertReadFrom(getTestBytes(0x101));
- assertReadFrom(getTestBytes(0x110));
- assertReadFrom(getTestBytes(0x1000));
- assertReadFrom(getTestBytes(0x1001));
- assertReadFrom(getTestBytes(0x1010));
- assertReadFrom(getTestBytes(0x10000));
- assertReadFrom(getTestBytes(0x10001));
- assertReadFrom(getTestBytes(0x10010));
- }
-
- // Tests that IOExceptions propagate through ByteString.readFrom().
- public void testReadFrom_IOExceptions() {
- try {
- ByteString.readFrom(new FailStream());
- fail("readFrom must throw the underlying IOException");
-
- } catch (IOException e) {
- assertEquals("readFrom must throw the expected exception",
- "synthetic failure", e.getMessage());
- }
- }
-
- // Tests that ByteString.readFrom works with streams that don't
- // always fill their buffers.
- public void testReadFrom_reluctantStream() throws IOException {
- final byte[] data = getTestBytes(0x1000);
-
- ByteString byteString = ByteString.readFrom(new ReluctantStream(data));
- assertTrue("readFrom byte stream must contain the expected bytes",
- isArray(byteString.toByteArray(), data));
-
- // Same test as above, but with some specific chunk sizes.
- assertReadFromReluctantStream(data, 100);
- assertReadFromReluctantStream(data, 248);
- assertReadFromReluctantStream(data, 249);
- assertReadFromReluctantStream(data, 250);
- assertReadFromReluctantStream(data, 251);
- assertReadFromReluctantStream(data, 0x1000);
- assertReadFromReluctantStream(data, 0x1001);
- }
-
- // Fails unless ByteString.readFrom reads the bytes correctly from a
- // reluctant stream with the given chunkSize parameter.
- private void assertReadFromReluctantStream(byte[] bytes, int chunkSize)
- throws IOException {
- ByteString b = ByteString.readFrom(new ReluctantStream(bytes), chunkSize);
- assertTrue("readFrom byte stream must contain the expected bytes",
- isArray(b.toByteArray(), bytes));
- }
-
- // Tests that ByteString.readFrom works with streams that implement
- // available().
- public void testReadFrom_available() throws IOException {
- final byte[] data = getTestBytes(0x1001);
-
- ByteString byteString = ByteString.readFrom(new AvailableStream(data));
- assertTrue("readFrom byte stream must contain the expected bytes",
- isArray(byteString.toByteArray(), data));
- }
-
- // Fails unless ByteString.readFrom reads the bytes correctly.
- private void assertReadFrom(byte[] bytes) throws IOException {
- ByteString byteString =
- ByteString.readFrom(new ByteArrayInputStream(bytes));
- assertTrue("readFrom byte stream must contain the expected bytes",
- isArray(byteString.toByteArray(), bytes));
- }
-
- // A stream that fails when read.
- private static final class FailStream extends InputStream {
- @Override public int read() throws IOException {
- throw new IOException("synthetic failure");
- }
- }
-
- // A stream that simulates blocking by only producing 250 characters
- // per call to read(byte[]).
- private static class ReluctantStream extends InputStream {
- protected final byte[] data;
- protected int pos = 0;
-
- public ReluctantStream(byte[] data) {
- this.data = data;
- }
-
- @Override public int read() {
- if (pos == data.length) {
- return -1;
- } else {
- return data[pos++];
- }
- }
-
- @Override public int read(byte[] buf) {
- return read(buf, 0, buf.length);
- }
-
- @Override public int read(byte[] buf, int offset, int size) {
- if (pos == data.length) {
- return -1;
- }
- int count = Math.min(Math.min(size, data.length - pos), 250);
- System.arraycopy(data, pos, buf, offset, count);
- pos += count;
- return count;
- }
- }
-
- // Same as above, but also implements available().
- private static final class AvailableStream extends ReluctantStream {
- public AvailableStream(byte[] data) {
- super(data);
- }
-
- @Override public int available() {
- return Math.min(250, data.length - pos);
- }
- }
-
- // A stream which exposes the byte array passed into read(byte[], int, int).
- private static class EvilInputStream extends InputStream {
- public byte[] capturedArray = null;
-
- @Override
- public int read(byte[] buf, int off, int len) {
- if (capturedArray != null) {
- return -1;
- } else {
- capturedArray = buf;
- for (int x = 0; x < len; ++x) {
- buf[x] = (byte) x;
- }
- return len;
- }
- }
-
- @Override
- public int read() {
- // Purposefully do nothing.
- return -1;
- }
- }
-
- // A stream which exposes the byte array passed into write(byte[], int, int).
- private static class EvilOutputStream extends OutputStream {
- public byte[] capturedArray = null;
-
- @Override
- public void write(byte[] buf, int off, int len) {
- if (capturedArray == null) {
- capturedArray = buf;
- }
- }
-
- @Override
- public void write(int ignored) {
- // Purposefully do nothing.
- }
- }
-
- public void testToStringUtf8() throws UnsupportedEncodingException {
- String testString = "I love unicode \u1234\u5678 characters";
- byte[] testBytes = testString.getBytes("UTF-8");
- ByteString byteString = ByteString.copyFrom(testBytes);
- assertEquals("copyToStringUtf8 must respect the charset",
- testString, byteString.toStringUtf8());
- }
-
- public void testNewOutput_InitialCapacity() throws IOException {
- byte[] bytes = getTestBytes();
- ByteString.Output output = ByteString.newOutput(bytes.length + 100);
- output.write(bytes);
- ByteString byteString = output.toByteString();
- assertTrue(
- "String built from newOutput(int) must contain the expected bytes",
- isArrayRange(bytes, byteString.toByteArray(), 0, bytes.length));
- }
-
- // Test newOutput() using a variety of buffer sizes and a variety of (fixed)
- // write sizes
- public void testNewOutput_ArrayWrite() throws IOException {
- byte[] bytes = getTestBytes();
- int length = bytes.length;
- int[] bufferSizes = {128, 256, length / 2, length - 1, length, length + 1,
- 2 * length, 3 * length};
- int[] writeSizes = {1, 4, 5, 7, 23, bytes.length};
-
- for (int bufferSize : bufferSizes) {
- for (int writeSize : writeSizes) {
- // Test writing the entire output writeSize bytes at a time.
- ByteString.Output output = ByteString.newOutput(bufferSize);
- for (int i = 0; i < length; i += writeSize) {
- output.write(bytes, i, Math.min(writeSize, length - i));
- }
- ByteString byteString = output.toByteString();
- assertTrue("String built from newOutput() must contain the expected bytes",
- isArrayRange(bytes, byteString.toByteArray(), 0, bytes.length));
- }
- }
- }
-
- // Test newOutput() using a variety of buffer sizes, but writing all the
- // characters using write(byte);
- public void testNewOutput_WriteChar() throws IOException {
- byte[] bytes = getTestBytes();
- int length = bytes.length;
- int[] bufferSizes = {0, 1, 128, 256, length / 2,
- length - 1, length, length + 1,
- 2 * length, 3 * length};
- for (int bufferSize : bufferSizes) {
- ByteString.Output output = ByteString.newOutput(bufferSize);
- for (byte byteValue : bytes) {
- output.write(byteValue);
- }
- ByteString byteString = output.toByteString();
- assertTrue("String built from newOutput() must contain the expected bytes",
- isArrayRange(bytes, byteString.toByteArray(), 0, bytes.length));
- }
- }
-
- // Test newOutput() in which we write the bytes using a variety of methods
- // and sizes, and in which we repeatedly call toByteString() in the middle.
- public void testNewOutput_Mixed() throws IOException {
- Random rng = new Random(1);
- byte[] bytes = getTestBytes();
- int length = bytes.length;
- int[] bufferSizes = {0, 1, 128, 256, length / 2,
- length - 1, length, length + 1,
- 2 * length, 3 * length};
-
- for (int bufferSize : bufferSizes) {
- // Test writing the entire output using a mixture of write sizes and
- // methods;
- ByteString.Output output = ByteString.newOutput(bufferSize);
- int position = 0;
- while (position < bytes.length) {
- if (rng.nextBoolean()) {
- int count = 1 + rng.nextInt(bytes.length - position);
- output.write(bytes, position, count);
- position += count;
- } else {
- output.write(bytes[position]);
- position++;
- }
- assertEquals("size() returns the right value", position, output.size());
- assertTrue("newOutput() substring must have correct bytes",
- isArrayRange(output.toByteString().toByteArray(),
- bytes, 0, position));
- }
- ByteString byteString = output.toByteString();
- assertTrue("String built from newOutput() must contain the expected bytes",
- isArrayRange(bytes, byteString.toByteArray(), 0, bytes.length));
- }
- }
-
- public void testNewOutputEmpty() throws IOException {
- // Make sure newOutput() correctly builds empty byte strings
- ByteString byteString = ByteString.newOutput().toByteString();
- assertEquals(ByteString.EMPTY, byteString);
- }
-
- public void testNewOutput_Mutating() throws IOException {
- Output os = ByteString.newOutput(5);
- os.write(new byte[] {1, 2, 3, 4, 5});
- EvilOutputStream eos = new EvilOutputStream();
- os.writeTo(eos);
- byte[] capturedArray = eos.capturedArray;
- ByteString byteString = os.toByteString();
- byte[] oldValue = byteString.toByteArray();
- Arrays.fill(capturedArray, (byte) 0);
- byte[] newValue = byteString.toByteArray();
- assertTrue("Output must not provide access to the underlying byte array",
- Arrays.equals(oldValue, newValue));
- }
-
- public void testSubstringParity() {
- byte[] bigBytes = getTestBytes(2048 * 1024, 113344L);
- int start = 512 * 1024 - 3333;
- int end = 512 * 1024 + 7777;
- ByteString concreteSubstring = ByteString.copyFrom(bigBytes).substring(start, end);
- boolean ok = true;
- for (int i = start; ok && i < end; ++i) {
- ok = (bigBytes[i] == concreteSubstring.byteAt(i - start));
- }
- assertTrue("Concrete substring didn't capture the right bytes", ok);
-
- ByteString literalString = ByteString.copyFrom(bigBytes, start, end - start);
- assertTrue("Substring must be equal to literal string",
- concreteSubstring.equals(literalString));
- assertEquals("Substring must have same hashcode as literal string",
- literalString.hashCode(), concreteSubstring.hashCode());
- }
-
- public void testCompositeSubstring() {
- byte[] referenceBytes = getTestBytes(77748, 113344L);
-
- List<ByteString> pieces = makeConcretePieces(referenceBytes);
- ByteString listString = ByteString.copyFrom(pieces);
-
- int from = 1000;
- int to = 40000;
- ByteString compositeSubstring = listString.substring(from, to);
- byte[] substringBytes = compositeSubstring.toByteArray();
- boolean stillEqual = true;
- for (int i = 0; stillEqual && i < to - from; ++i) {
- stillEqual = referenceBytes[from + i] == substringBytes[i];
- }
- assertTrue("Substring must return correct bytes", stillEqual);
-
- stillEqual = true;
- for (int i = 0; stillEqual && i < to - from; ++i) {
- stillEqual = referenceBytes[from + i] == compositeSubstring.byteAt(i);
- }
- assertTrue("Substring must support byteAt() correctly", stillEqual);
-
- ByteString literalSubstring = ByteString.copyFrom(referenceBytes, from, to - from);
- assertTrue("Composite substring must equal a literal substring over the same bytes",
- compositeSubstring.equals(literalSubstring));
- assertTrue("Literal substring must equal a composite substring over the same bytes",
- literalSubstring.equals(compositeSubstring));
-
- assertEquals("We must get the same hashcodes for composite and literal substrings",
- literalSubstring.hashCode(), compositeSubstring.hashCode());
-
- assertFalse("We can't be equal to a proper substring",
- compositeSubstring.equals(literalSubstring.substring(0, literalSubstring.size() - 1)));
- }
-
- public void testCopyFromList() {
- byte[] referenceBytes = getTestBytes(77748, 113344L);
- ByteString literalString = ByteString.copyFrom(referenceBytes);
-
- List<ByteString> pieces = makeConcretePieces(referenceBytes);
- ByteString listString = ByteString.copyFrom(pieces);
-
- assertTrue("Composite string must be equal to literal string",
- listString.equals(literalString));
- assertEquals("Composite string must have same hashcode as literal string",
- literalString.hashCode(), listString.hashCode());
- }
-
- public void testConcat() {
- byte[] referenceBytes = getTestBytes(77748, 113344L);
- ByteString literalString = ByteString.copyFrom(referenceBytes);
-
- List<ByteString> pieces = makeConcretePieces(referenceBytes);
-
- Iterator<ByteString> iter = pieces.iterator();
- ByteString concatenatedString = iter.next();
- while (iter.hasNext()) {
- concatenatedString = concatenatedString.concat(iter.next());
- }
-
- assertTrue("Concatenated string must be equal to literal string",
- concatenatedString.equals(literalString));
- assertEquals("Concatenated string must have same hashcode as literal string",
- literalString.hashCode(), concatenatedString.hashCode());
- }
-
- public void testStartsWith() {
- byte[] bytes = getTestBytes(1000, 1234L);
- ByteString string = ByteString.copyFrom(bytes);
- ByteString prefix = ByteString.copyFrom(bytes, 0, 500);
- ByteString suffix = ByteString.copyFrom(bytes, 400, 600);
- assertTrue(string.startsWith(ByteString.EMPTY));
- assertTrue(string.startsWith(string));
- assertTrue(string.startsWith(prefix));
- assertFalse(string.startsWith(suffix));
- assertFalse(prefix.startsWith(suffix));
- assertFalse(suffix.startsWith(prefix));
- assertFalse(ByteString.EMPTY.startsWith(prefix));
- assertTrue(ByteString.EMPTY.startsWith(ByteString.EMPTY));
- }
-
- static List<ByteString> makeConcretePieces(byte[] referenceBytes) {
- List<ByteString> pieces = new ArrayList<ByteString>();
- // Starting length should be small enough that we'll do some concatenating by
- // copying if we just concatenate all these pieces together.
- for (int start = 0, length = 16; start < referenceBytes.length; start += length) {
- length = (length << 1) - 1;
- if (start + length > referenceBytes.length) {
- length = referenceBytes.length - start;
- }
- pieces.add(ByteString.copyFrom(referenceBytes, start, length));
- }
- return pieces;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java
deleted file mode 100644
index 7e67898..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedInputStreamTest.java
+++ /dev/null
@@ -1,469 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestRecursiveMessage;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.FilterInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-
-/**
- * Unit test for {@link CodedInputStream}.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class CodedInputStreamTest extends TestCase {
- /**
- * 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 byte[] bytes(int... bytesAsInts) {
- byte[] bytes = new byte[bytesAsInts.length];
- for (int i = 0; i < bytesAsInts.length; i++) {
- bytes[i] = (byte) bytesAsInts[i];
- }
- return bytes;
- }
-
- /**
- * An InputStream 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 static final class SmallBlockInputStream extends FilterInputStream {
- private final int blockSize;
-
- public SmallBlockInputStream(byte[] data, int blockSize) {
- this(new ByteArrayInputStream(data), blockSize);
- }
-
- public SmallBlockInputStream(InputStream in, int blockSize) {
- super(in);
- this.blockSize = blockSize;
- }
-
- public int read(byte[] b) throws IOException {
- return super.read(b, 0, Math.min(b.length, blockSize));
- }
-
- public int read(byte[] b, int off, int len) throws IOException {
- return super.read(b, off, Math.min(len, blockSize));
- }
- }
-
- /**
- * Parses the given bytes using readRawVarint32() and readRawVarint64() and
- * checks that the result matches the given value.
- */
- private void assertReadVarint(byte[] data, long value) throws Exception {
- CodedInputStream input = CodedInputStream.newInstance(data);
- assertEquals((int)value, input.readRawVarint32());
-
- input = CodedInputStream.newInstance(data);
- assertEquals(value, input.readRawVarint64());
- assertTrue(input.isAtEnd());
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize <= 16; blockSize *= 2) {
- input = CodedInputStream.newInstance(
- new SmallBlockInputStream(data, blockSize));
- assertEquals((int)value, input.readRawVarint32());
-
- input = CodedInputStream.newInstance(
- new SmallBlockInputStream(data, blockSize));
- assertEquals(value, input.readRawVarint64());
- assertTrue(input.isAtEnd());
- }
-
- // Try reading direct from an InputStream. We want to verify that it
- // doesn't read past the end of the input, so we copy to a new, bigger
- // array first.
- byte[] longerData = new byte[data.length + 1];
- System.arraycopy(data, 0, longerData, 0, data.length);
- InputStream rawInput = new ByteArrayInputStream(longerData);
- }
-
- /**
- * Parses the given bytes using readRawVarint32() and readRawVarint64() and
- * expects them to fail with an InvalidProtocolBufferException whose
- * description matches the given one.
- */
- private void assertReadVarintFailure(
- InvalidProtocolBufferException expected, byte[] data)
- throws Exception {
- CodedInputStream input = CodedInputStream.newInstance(data);
- try {
- input.readRawVarint32();
- fail("Should have thrown an exception.");
- } catch (InvalidProtocolBufferException e) {
- assertEquals(expected.getMessage(), e.getMessage());
- }
-
- input = CodedInputStream.newInstance(data);
- try {
- input.readRawVarint64();
- fail("Should have thrown an exception.");
- } catch (InvalidProtocolBufferException e) {
- assertEquals(expected.getMessage(), e.getMessage());
- }
- }
-
- /** Tests readRawVarint32() and readRawVarint64(). */
- public void testReadVarint() throws Exception {
- 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) |
- (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) |
- (0x05L << 49) | (0x26L << 56) | (0x01L << 63));
- }
-
- /**
- * Parses the given bytes using readRawLittleEndian32() and checks
- * that the result matches the given value.
- */
- private void assertReadLittleEndian32(byte[] data, int value)
- throws Exception {
- CodedInputStream input = CodedInputStream.newInstance(data);
- assertEquals(value, input.readRawLittleEndian32());
- assertTrue(input.isAtEnd());
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize <= 16; blockSize *= 2) {
- input = CodedInputStream.newInstance(
- new SmallBlockInputStream(data, blockSize));
- assertEquals(value, input.readRawLittleEndian32());
- assertTrue(input.isAtEnd());
- }
- }
-
- /**
- * Parses the given bytes using readRawLittleEndian64() and checks
- * that the result matches the given value.
- */
- private void assertReadLittleEndian64(byte[] data, long value)
- throws Exception {
- CodedInputStream input = CodedInputStream.newInstance(data);
- assertEquals(value, input.readRawLittleEndian64());
- assertTrue(input.isAtEnd());
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize <= 16; blockSize *= 2) {
- input = CodedInputStream.newInstance(
- new SmallBlockInputStream(data, blockSize));
- assertEquals(value, input.readRawLittleEndian64());
- assertTrue(input.isAtEnd());
- }
- }
-
- /** Tests readRawLittleEndian32() and readRawLittleEndian64(). */
- public void testReadLittleEndian() throws Exception {
- 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),
- 0x9abcdef012345678L);
- }
-
- /** Test decodeZigZag32() and decodeZigZag64(). */
- public void testDecodeZigZag() throws Exception {
- assertEquals( 0, CodedInputStream.decodeZigZag32(0));
- assertEquals(-1, CodedInputStream.decodeZigZag32(1));
- assertEquals( 1, CodedInputStream.decodeZigZag32(2));
- assertEquals(-2, CodedInputStream.decodeZigZag32(3));
- assertEquals(0x3FFFFFFF, CodedInputStream.decodeZigZag32(0x7FFFFFFE));
- assertEquals(0xC0000000, CodedInputStream.decodeZigZag32(0x7FFFFFFF));
- assertEquals(0x7FFFFFFF, CodedInputStream.decodeZigZag32(0xFFFFFFFE));
- assertEquals(0x80000000, CodedInputStream.decodeZigZag32(0xFFFFFFFF));
-
- assertEquals( 0, CodedInputStream.decodeZigZag64(0));
- assertEquals(-1, CodedInputStream.decodeZigZag64(1));
- assertEquals( 1, CodedInputStream.decodeZigZag64(2));
- assertEquals(-2, CodedInputStream.decodeZigZag64(3));
- assertEquals(0x000000003FFFFFFFL,
- CodedInputStream.decodeZigZag64(0x000000007FFFFFFEL));
- assertEquals(0xFFFFFFFFC0000000L,
- CodedInputStream.decodeZigZag64(0x000000007FFFFFFFL));
- assertEquals(0x000000007FFFFFFFL,
- CodedInputStream.decodeZigZag64(0x00000000FFFFFFFEL));
- assertEquals(0xFFFFFFFF80000000L,
- CodedInputStream.decodeZigZag64(0x00000000FFFFFFFFL));
- assertEquals(0x7FFFFFFFFFFFFFFFL,
- CodedInputStream.decodeZigZag64(0xFFFFFFFFFFFFFFFEL));
- assertEquals(0x8000000000000000L,
- CodedInputStream.decodeZigZag64(0xFFFFFFFFFFFFFFFFL));
- }
-
- /** Tests reading and parsing a whole message with every field type. */
- public void testReadWholeMessage() throws Exception {
- TestAllTypes message = TestUtil.getAllSet();
-
- byte[] rawBytes = message.toByteArray();
- assertEquals(rawBytes.length, message.getSerializedSize());
-
- TestAllTypes message2 = TestAllTypes.parseFrom(rawBytes);
- TestUtil.assertAllFieldsSet(message2);
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize < 256; blockSize *= 2) {
- message2 = TestAllTypes.parseFrom(
- new SmallBlockInputStream(rawBytes, blockSize));
- TestUtil.assertAllFieldsSet(message2);
- }
- }
-
- /** Tests skipField(). */
- public void testSkipWholeMessage() throws Exception {
- TestAllTypes message = TestUtil.getAllSet();
- byte[] rawBytes = message.toByteArray();
-
- // Create two parallel inputs. Parse one as unknown fields while using
- // skipField() to skip each field on the other. Expect the same tags.
- CodedInputStream input1 = CodedInputStream.newInstance(rawBytes);
- CodedInputStream input2 = CodedInputStream.newInstance(rawBytes);
- UnknownFieldSet.Builder unknownFields = UnknownFieldSet.newBuilder();
-
- while (true) {
- int tag = input1.readTag();
- assertEquals(tag, input2.readTag());
- if (tag == 0) {
- break;
- }
- unknownFields.mergeFieldFrom(tag, input1);
- input2.skipField(tag);
- }
- }
-
- /**
- * Test that a bug in skipRawBytes() has been fixed: if the skip skips
- * exactly up to a limit, this should not break things.
- */
- public void testSkipRawBytesBug() throws Exception {
- byte[] rawBytes = new byte[] { 1, 2 };
- CodedInputStream input = CodedInputStream.newInstance(rawBytes);
-
- int limit = input.pushLimit(1);
- input.skipRawBytes(1);
- input.popLimit(limit);
- assertEquals(2, input.readRawByte());
- }
-
- /**
- * Test that a bug in skipRawBytes() has been fixed: if the skip skips
- * past the end of a buffer with a limit that has been set past the end of
- * that buffer, this should not break things.
- */
- public void testSkipRawBytesPastEndOfBufferWithLimit() throws Exception {
- byte[] rawBytes = new byte[] { 1, 2, 3, 4, 5 };
- CodedInputStream input = CodedInputStream.newInstance(
- new SmallBlockInputStream(rawBytes, 3));
-
- int limit = input.pushLimit(4);
- // In order to expose the bug we need to read at least one byte to prime the
- // buffer inside the CodedInputStream.
- assertEquals(1, input.readRawByte());
- // Skip to the end of the limit.
- input.skipRawBytes(3);
- assertTrue(input.isAtEnd());
- input.popLimit(limit);
- assertEquals(5, input.readRawByte());
- }
-
- public void testReadHugeBlob() throws Exception {
- // 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.
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- builder.setOptionalBytes(ByteString.copyFrom(blob));
- TestAllTypes message = builder.build();
-
- // 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.parseFrom(message.toByteString().newInput());
-
- assertEquals(message.getOptionalBytes(), message2.getOptionalBytes());
-
- // Make sure all the other fields were parsed correctly.
- TestAllTypes message3 = TestAllTypes.newBuilder(message2)
- .setOptionalBytes(TestUtil.getAllSet().getOptionalBytes())
- .build();
- TestUtil.assertAllFieldsSet(message3);
- }
-
- public int makeTag(int number, int tag) {
- return (number << 3) + tag;
- }
-
- public void testReadMaliciouslyLargeBlob() throws Exception {
- ByteString.Output rawOutput = ByteString.newOutput();
- CodedOutputStream output = CodedOutputStream.newInstance(rawOutput);
-
- int tag = makeTag(1, WireFormat.WIRETYPE_LENGTH_DELIMITED);
- output.writeRawVarint32(tag);
- output.writeRawVarint32(0x7FFFFFFF);
- output.writeRawBytes(new byte[32]); // Pad with a few random bytes.
- output.flush();
-
- CodedInputStream input = rawOutput.toByteString().newCodedInput();
- assertEquals(tag, input.readTag());
-
- try {
- input.readBytes();
- fail("Should have thrown an exception!");
- } catch (InvalidProtocolBufferException e) {
- // success.
- }
- }
-
- private TestRecursiveMessage makeRecursiveMessage(int depth) {
- if (depth == 0) {
- return TestRecursiveMessage.newBuilder().setI(5).build();
- } else {
- return TestRecursiveMessage.newBuilder()
- .setA(makeRecursiveMessage(depth - 1)).build();
- }
- }
-
- private void assertMessageDepth(TestRecursiveMessage message, int depth) {
- if (depth == 0) {
- assertFalse(message.hasA());
- assertEquals(5, message.getI());
- } else {
- assertTrue(message.hasA());
- assertMessageDepth(message.getA(), depth - 1);
- }
- }
-
- public void testResetSizeCounter() throws Exception {
- CodedInputStream input = CodedInputStream.newInstance(
- new SmallBlockInputStream(new byte[256], 8));
- input.setSizeLimit(16);
- input.readRawBytes(16);
- assertEquals(16, input.getTotalBytesRead());
-
- try {
- input.readRawByte();
- fail("Should have thrown an exception!");
- } catch (InvalidProtocolBufferException e) {
- // success.
- }
-
- input.resetSizeCounter();
- assertEquals(0, input.getTotalBytesRead());
- input.readRawByte(); // No exception thrown.
- input.resetSizeCounter();
- assertEquals(0, input.getTotalBytesRead());
- }
-
- /**
- * 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.
- */
- public void testReadInvalidUtf8() throws Exception {
- ByteString.Output rawOutput = ByteString.newOutput();
- CodedOutputStream output = CodedOutputStream.newInstance(rawOutput);
-
- int tag = makeTag(1, WireFormat.WIRETYPE_LENGTH_DELIMITED);
- output.writeRawVarint32(tag);
- output.writeRawVarint32(1);
- output.writeRawBytes(new byte[] { (byte)0x80 });
- output.flush();
-
- CodedInputStream input = rawOutput.toByteString().newCodedInput();
- assertEquals(tag, input.readTag());
- String text = input.readString();
- assertEquals(0xfffd, text.charAt(0));
- }
-
- public void testReadFromSlice() throws Exception {
- byte[] bytes = bytes(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
- CodedInputStream in = CodedInputStream.newInstance(bytes, 3, 5);
- assertEquals(0, in.getTotalBytesRead());
- for (int i = 3; i < 8; i++) {
- assertEquals(i, in.readRawByte());
- assertEquals(i-2, in.getTotalBytesRead());
- }
- // eof
- assertEquals(0, in.readTag());
- assertEquals(5, in.getTotalBytesRead());
- }
-
- public void testInvalidTag() throws Exception {
- // Any tag number which corresponds to field number zero is invalid and
- // should throw InvalidProtocolBufferException.
- for (int i = 0; i < 8; i++) {
- try {
- CodedInputStream.newInstance(bytes(i)).readTag();
- fail("Should have thrown an exception.");
- } catch (InvalidProtocolBufferException e) {
- }
- }
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java
deleted file mode 100644
index 354d89d..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/CodedOutputStreamTest.java
+++ /dev/null
@@ -1,318 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto.SparseEnumMessage;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
-import protobuf_unittest.UnittestProto.TestSparseEnum;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Unit test for {@link CodedOutputStream}.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class CodedOutputStreamTest extends TestCase {
- /**
- * 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 byte[] bytes(int... bytesAsInts) {
- byte[] bytes = new byte[bytesAsInts.length];
- for (int i = 0; i < bytesAsInts.length; i++) {
- bytes[i] = (byte) bytesAsInts[i];
- }
- return bytes;
- }
-
- /** Arrays.asList() does not work with arrays of primitives. :( */
- private List<Byte> toList(byte[] bytes) {
- List<Byte> result = new ArrayList<Byte>();
- for (byte b : bytes) {
- result.add(b);
- }
- return result;
- }
-
- private void assertEqualBytes(byte[] a, byte[] b) {
- assertEquals(toList(a), toList(b));
- }
-
- /**
- * Writes the given value using writeRawVarint32() and writeRawVarint64() and
- * checks that the result matches the given bytes.
- */
- private void assertWriteVarint(byte[] data, long value) throws Exception {
- // Only do 32-bit write if the value fits in 32 bits.
- if ((value >>> 32) == 0) {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output = CodedOutputStream.newInstance(rawOutput);
- output.writeRawVarint32((int) value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
-
- // Also try computing size.
- assertEquals(data.length,
- CodedOutputStream.computeRawVarint32Size((int) value));
- }
-
- {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output = CodedOutputStream.newInstance(rawOutput);
- output.writeRawVarint64(value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
-
- // Also try computing size.
- assertEquals(data.length,
- CodedOutputStream.computeRawVarint64Size(value));
- }
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize <= 16; blockSize *= 2) {
- // Only do 32-bit write if the value fits in 32 bits.
- if ((value >>> 32) == 0) {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output =
- CodedOutputStream.newInstance(rawOutput, blockSize);
- output.writeRawVarint32((int) value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
- }
-
- {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output =
- CodedOutputStream.newInstance(rawOutput, blockSize);
- output.writeRawVarint64(value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
- }
- }
- }
-
- /** Tests writeRawVarint32() and writeRawVarint64(). */
- public void testWriteVarint() throws Exception {
- assertWriteVarint(bytes(0x00), 0);
- assertWriteVarint(bytes(0x01), 1);
- assertWriteVarint(bytes(0x7f), 127);
- // 14882
- assertWriteVarint(bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7));
- // 2961488830
- assertWriteVarint(bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b),
- (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
- (0x0bL << 28));
-
- // 64-bit
- // 7256456126
- assertWriteVarint(bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b),
- (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
- (0x1bL << 28));
- // 41256202580718336
- assertWriteVarint(
- 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
- assertWriteVarint(
- bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01),
- (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 void assertWriteLittleEndian32(byte[] data, int value)
- throws Exception {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output = CodedOutputStream.newInstance(rawOutput);
- output.writeRawLittleEndian32(value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize <= 16; blockSize *= 2) {
- rawOutput = new ByteArrayOutputStream();
- output = CodedOutputStream.newInstance(rawOutput, blockSize);
- output.writeRawLittleEndian32(value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
- }
- }
-
- /**
- * Parses the given bytes using writeRawLittleEndian64() and checks
- * that the result matches the given value.
- */
- private void assertWriteLittleEndian64(byte[] data, long value)
- throws Exception {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output = CodedOutputStream.newInstance(rawOutput);
- output.writeRawLittleEndian64(value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize <= 16; blockSize *= 2) {
- rawOutput = new ByteArrayOutputStream();
- output = CodedOutputStream.newInstance(rawOutput, blockSize);
- output.writeRawLittleEndian64(value);
- output.flush();
- assertEqualBytes(data, rawOutput.toByteArray());
- }
- }
-
- /** Tests writeRawLittleEndian32() and writeRawLittleEndian64(). */
- public void testWriteLittleEndian() throws Exception {
- assertWriteLittleEndian32(bytes(0x78, 0x56, 0x34, 0x12), 0x12345678);
- assertWriteLittleEndian32(bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0);
-
- assertWriteLittleEndian64(
- bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12),
- 0x123456789abcdef0L);
- assertWriteLittleEndian64(
- bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a),
- 0x9abcdef012345678L);
- }
-
- /** Test encodeZigZag32() and encodeZigZag64(). */
- public void testEncodeZigZag() throws Exception {
- assertEquals(0, CodedOutputStream.encodeZigZag32( 0));
- assertEquals(1, CodedOutputStream.encodeZigZag32(-1));
- assertEquals(2, CodedOutputStream.encodeZigZag32( 1));
- assertEquals(3, CodedOutputStream.encodeZigZag32(-2));
- assertEquals(0x7FFFFFFE, CodedOutputStream.encodeZigZag32(0x3FFFFFFF));
- assertEquals(0x7FFFFFFF, CodedOutputStream.encodeZigZag32(0xC0000000));
- assertEquals(0xFFFFFFFE, CodedOutputStream.encodeZigZag32(0x7FFFFFFF));
- assertEquals(0xFFFFFFFF, CodedOutputStream.encodeZigZag32(0x80000000));
-
- assertEquals(0, CodedOutputStream.encodeZigZag64( 0));
- assertEquals(1, CodedOutputStream.encodeZigZag64(-1));
- assertEquals(2, CodedOutputStream.encodeZigZag64( 1));
- assertEquals(3, CodedOutputStream.encodeZigZag64(-2));
- assertEquals(0x000000007FFFFFFEL,
- CodedOutputStream.encodeZigZag64(0x000000003FFFFFFFL));
- assertEquals(0x000000007FFFFFFFL,
- CodedOutputStream.encodeZigZag64(0xFFFFFFFFC0000000L));
- assertEquals(0x00000000FFFFFFFEL,
- CodedOutputStream.encodeZigZag64(0x000000007FFFFFFFL));
- assertEquals(0x00000000FFFFFFFFL,
- CodedOutputStream.encodeZigZag64(0xFFFFFFFF80000000L));
- assertEquals(0xFFFFFFFFFFFFFFFEL,
- CodedOutputStream.encodeZigZag64(0x7FFFFFFFFFFFFFFFL));
- assertEquals(0xFFFFFFFFFFFFFFFFL,
- CodedOutputStream.encodeZigZag64(0x8000000000000000L));
-
- // Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1)
- // were chosen semi-randomly via keyboard bashing.
- assertEquals(0,
- CodedOutputStream.encodeZigZag32(CodedInputStream.decodeZigZag32(0)));
- assertEquals(1,
- CodedOutputStream.encodeZigZag32(CodedInputStream.decodeZigZag32(1)));
- assertEquals(-1,
- CodedOutputStream.encodeZigZag32(CodedInputStream.decodeZigZag32(-1)));
- assertEquals(14927,
- CodedOutputStream.encodeZigZag32(CodedInputStream.decodeZigZag32(14927)));
- assertEquals(-3612,
- CodedOutputStream.encodeZigZag32(CodedInputStream.decodeZigZag32(-3612)));
-
- assertEquals(0,
- CodedOutputStream.encodeZigZag64(CodedInputStream.decodeZigZag64(0)));
- assertEquals(1,
- CodedOutputStream.encodeZigZag64(CodedInputStream.decodeZigZag64(1)));
- assertEquals(-1,
- CodedOutputStream.encodeZigZag64(CodedInputStream.decodeZigZag64(-1)));
- assertEquals(14927,
- CodedOutputStream.encodeZigZag64(CodedInputStream.decodeZigZag64(14927)));
- assertEquals(-3612,
- CodedOutputStream.encodeZigZag64(CodedInputStream.decodeZigZag64(-3612)));
-
- assertEquals(856912304801416L,
- CodedOutputStream.encodeZigZag64(
- CodedInputStream.decodeZigZag64(
- 856912304801416L)));
- assertEquals(-75123905439571256L,
- CodedOutputStream.encodeZigZag64(
- CodedInputStream.decodeZigZag64(
- -75123905439571256L)));
- }
-
- /** Tests writing a whole message with every field type. */
- public void testWriteWholeMessage() throws Exception {
- TestAllTypes message = TestUtil.getAllSet();
-
- byte[] rawBytes = message.toByteArray();
- assertEqualBytes(TestUtil.getGoldenMessage().toByteArray(), rawBytes);
-
- // Try different block sizes.
- for (int blockSize = 1; blockSize < 256; blockSize *= 2) {
- ByteArrayOutputStream rawOutput = new ByteArrayOutputStream();
- CodedOutputStream output =
- CodedOutputStream.newInstance(rawOutput, blockSize);
- message.writeTo(output);
- output.flush();
- assertEqualBytes(rawBytes, rawOutput.toByteArray());
- }
- }
-
- /** Tests writing a whole message with every packed field type. Ensures the
- * wire format of packed fields is compatible with C++. */
- public void testWriteWholePackedFieldsMessage() throws Exception {
- TestPackedTypes message = TestUtil.getPackedSet();
-
- byte[] rawBytes = message.toByteArray();
- assertEqualBytes(TestUtil.getGoldenPackedFieldsMessage().toByteArray(),
- rawBytes);
- }
-
- /** Test writing a message containing a negative enum value. This used to
- * fail because the size was not properly computed as a sign-extended varint.
- */
- public void testWriteMessageWithNegativeEnumValue() throws Exception {
- SparseEnumMessage message = SparseEnumMessage.newBuilder()
- .setSparseEnum(TestSparseEnum.SPARSE_E) .build();
- assertTrue(message.getSparseEnum().getNumber() < 0);
- byte[] rawBytes = message.toByteArray();
- SparseEnumMessage message2 = SparseEnumMessage.parseFrom(rawBytes);
- assertEquals(TestSparseEnum.SPARSE_E, message2.getSparseEnum());
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java
deleted file mode 100644
index a7b7706..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DeprecatedFieldTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto.TestDeprecatedFields;
-
-import junit.framework.TestCase;
-
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Method;
-/**
- * Test field deprecation
- *
- * @author birdo@google.com (Roberto Scaramuzzi)
- */
-public class DeprecatedFieldTest extends TestCase {
- private String[] deprecatedGetterNames = {
- "hasDeprecatedInt32",
- "getDeprecatedInt32"};
-
- private String[] deprecatedBuilderGetterNames = {
- "hasDeprecatedInt32",
- "getDeprecatedInt32",
- "clearDeprecatedInt32"};
-
- private String[] deprecatedBuilderSetterNames = {
- "setDeprecatedInt32"};
-
- public void testDeprecatedField() throws Exception {
- Class<?> deprecatedFields = TestDeprecatedFields.class;
- Class<?> deprecatedFieldsBuilder = TestDeprecatedFields.Builder.class;
- for (String name : deprecatedGetterNames) {
- Method method = deprecatedFields.getMethod(name);
- assertTrue("Method " + name + " should be deprecated",
- isDeprecated(method));
- }
- for (String name : deprecatedBuilderGetterNames) {
- Method method = deprecatedFieldsBuilder.getMethod(name);
- assertTrue("Method " + name + " should be deprecated",
- isDeprecated(method));
- }
- for (String name : deprecatedBuilderSetterNames) {
- Method method = deprecatedFieldsBuilder.getMethod(name, int.class);
- assertTrue("Method " + name + " should be deprecated",
- isDeprecated(method));
- }
- }
-
- private boolean isDeprecated(AnnotatedElement annotated) {
- return annotated.isAnnotationPresent(Deprecated.class);
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java
deleted file mode 100644
index 37e1ca7..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DescriptorsTest.java
+++ /dev/null
@@ -1,649 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import com.google.protobuf.DescriptorProtos.DescriptorProto;
-import com.google.protobuf.DescriptorProtos.EnumDescriptorProto;
-import com.google.protobuf.DescriptorProtos.EnumValueDescriptorProto;
-import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
-import com.google.protobuf.DescriptorProtos.FileDescriptorProto;
-import com.google.protobuf.Descriptors.DescriptorValidationException;
-import com.google.protobuf.Descriptors.FileDescriptor;
-import com.google.protobuf.Descriptors.Descriptor;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import com.google.protobuf.Descriptors.EnumDescriptor;
-import com.google.protobuf.Descriptors.EnumValueDescriptor;
-import com.google.protobuf.Descriptors.ServiceDescriptor;
-import com.google.protobuf.Descriptors.MethodDescriptor;
-
-import com.google.protobuf.test.UnittestImport;
-import com.google.protobuf.test.UnittestImport.ImportEnum;
-import com.google.protobuf.test.UnittestImport.ImportMessage;
-import protobuf_unittest.UnittestProto;
-import protobuf_unittest.UnittestProto.ForeignEnum;
-import protobuf_unittest.UnittestProto.ForeignMessage;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestExtremeDefaultValues;
-import protobuf_unittest.UnittestProto.TestRequired;
-import protobuf_unittest.UnittestProto.TestService;
-import protobuf_unittest.UnittestCustomOptions;
-
-
-import junit.framework.TestCase;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Unit test for {@link Descriptors}.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class DescriptorsTest extends TestCase {
-
- // Regression test for bug where referencing a FieldDescriptor.Type value
- // before a FieldDescriptorProto.Type value would yield a
- // ExceptionInInitializerError.
- @SuppressWarnings("unused")
- private static final Object STATIC_INIT_TEST = FieldDescriptor.Type.BOOL;
-
- public void testFieldTypeEnumMapping() throws Exception {
- assertEquals(FieldDescriptor.Type.values().length,
- FieldDescriptorProto.Type.values().length);
- for (FieldDescriptor.Type type : FieldDescriptor.Type.values()) {
- FieldDescriptorProto.Type protoType = type.toProto();
- assertEquals("TYPE_" + type.name(), protoType.name());
- assertEquals(type, FieldDescriptor.Type.valueOf(protoType));
- }
- }
-
- public void testFileDescriptor() throws Exception {
- FileDescriptor file = UnittestProto.getDescriptor();
-
- assertEquals("google/protobuf/unittest.proto", file.getName());
- assertEquals("protobuf_unittest", file.getPackage());
-
- assertEquals("UnittestProto", file.getOptions().getJavaOuterClassname());
- assertEquals("google/protobuf/unittest.proto",
- file.toProto().getName());
-
- assertEquals(Arrays.asList(UnittestImport.getDescriptor()),
- file.getDependencies());
-
- Descriptor messageType = TestAllTypes.getDescriptor();
- assertEquals(messageType, file.getMessageTypes().get(0));
- assertEquals(messageType, file.findMessageTypeByName("TestAllTypes"));
- assertNull(file.findMessageTypeByName("NoSuchType"));
- assertNull(file.findMessageTypeByName("protobuf_unittest.TestAllTypes"));
- for (int i = 0; i < file.getMessageTypes().size(); i++) {
- assertEquals(i, file.getMessageTypes().get(i).getIndex());
- }
-
- EnumDescriptor enumType = ForeignEnum.getDescriptor();
- assertEquals(enumType, file.getEnumTypes().get(0));
- assertEquals(enumType, file.findEnumTypeByName("ForeignEnum"));
- assertNull(file.findEnumTypeByName("NoSuchType"));
- assertNull(file.findEnumTypeByName("protobuf_unittest.ForeignEnum"));
- assertEquals(Arrays.asList(ImportEnum.getDescriptor()),
- UnittestImport.getDescriptor().getEnumTypes());
- for (int i = 0; i < file.getEnumTypes().size(); i++) {
- assertEquals(i, file.getEnumTypes().get(i).getIndex());
- }
-
- ServiceDescriptor service = TestService.getDescriptor();
- assertEquals(service, file.getServices().get(0));
- assertEquals(service, file.findServiceByName("TestService"));
- assertNull(file.findServiceByName("NoSuchType"));
- assertNull(file.findServiceByName("protobuf_unittest.TestService"));
- assertEquals(Collections.emptyList(),
- UnittestImport.getDescriptor().getServices());
- for (int i = 0; i < file.getServices().size(); i++) {
- assertEquals(i, file.getServices().get(i).getIndex());
- }
-
- FieldDescriptor extension =
- UnittestProto.optionalInt32Extension.getDescriptor();
- assertEquals(extension, file.getExtensions().get(0));
- assertEquals(extension,
- file.findExtensionByName("optional_int32_extension"));
- assertNull(file.findExtensionByName("no_such_ext"));
- assertNull(file.findExtensionByName(
- "protobuf_unittest.optional_int32_extension"));
- assertEquals(Collections.emptyList(),
- UnittestImport.getDescriptor().getExtensions());
- for (int i = 0; i < file.getExtensions().size(); i++) {
- assertEquals(i, file.getExtensions().get(i).getIndex());
- }
- }
-
- public void testDescriptor() throws Exception {
- Descriptor messageType = TestAllTypes.getDescriptor();
- Descriptor nestedType = TestAllTypes.NestedMessage.getDescriptor();
-
- assertEquals("TestAllTypes", messageType.getName());
- assertEquals("protobuf_unittest.TestAllTypes", messageType.getFullName());
- assertEquals(UnittestProto.getDescriptor(), messageType.getFile());
- assertNull(messageType.getContainingType());
- assertEquals(DescriptorProtos.MessageOptions.getDefaultInstance(),
- messageType.getOptions());
- assertEquals("TestAllTypes", messageType.toProto().getName());
-
- assertEquals("NestedMessage", nestedType.getName());
- assertEquals("protobuf_unittest.TestAllTypes.NestedMessage",
- nestedType.getFullName());
- assertEquals(UnittestProto.getDescriptor(), nestedType.getFile());
- assertEquals(messageType, nestedType.getContainingType());
-
- FieldDescriptor field = messageType.getFields().get(0);
- assertEquals("optional_int32", field.getName());
- assertEquals(field, messageType.findFieldByName("optional_int32"));
- assertNull(messageType.findFieldByName("no_such_field"));
- assertEquals(field, messageType.findFieldByNumber(1));
- assertNull(messageType.findFieldByNumber(571283));
- for (int i = 0; i < messageType.getFields().size(); i++) {
- assertEquals(i, messageType.getFields().get(i).getIndex());
- }
-
- assertEquals(nestedType, messageType.getNestedTypes().get(0));
- assertEquals(nestedType, messageType.findNestedTypeByName("NestedMessage"));
- assertNull(messageType.findNestedTypeByName("NoSuchType"));
- for (int i = 0; i < messageType.getNestedTypes().size(); i++) {
- assertEquals(i, messageType.getNestedTypes().get(i).getIndex());
- }
-
- EnumDescriptor enumType = TestAllTypes.NestedEnum.getDescriptor();
- assertEquals(enumType, messageType.getEnumTypes().get(0));
- assertEquals(enumType, messageType.findEnumTypeByName("NestedEnum"));
- assertNull(messageType.findEnumTypeByName("NoSuchType"));
- for (int i = 0; i < messageType.getEnumTypes().size(); i++) {
- assertEquals(i, messageType.getEnumTypes().get(i).getIndex());
- }
- }
-
- public void testFieldDescriptor() throws Exception {
- Descriptor messageType = TestAllTypes.getDescriptor();
- FieldDescriptor primitiveField =
- messageType.findFieldByName("optional_int32");
- FieldDescriptor enumField =
- messageType.findFieldByName("optional_nested_enum");
- FieldDescriptor messageField =
- messageType.findFieldByName("optional_foreign_message");
- FieldDescriptor cordField =
- messageType.findFieldByName("optional_cord");
- FieldDescriptor extension =
- UnittestProto.optionalInt32Extension.getDescriptor();
- FieldDescriptor nestedExtension = TestRequired.single.getDescriptor();
-
- assertEquals("optional_int32", primitiveField.getName());
- assertEquals("protobuf_unittest.TestAllTypes.optional_int32",
- primitiveField.getFullName());
- assertEquals(1, primitiveField.getNumber());
- assertEquals(messageType, primitiveField.getContainingType());
- assertEquals(UnittestProto.getDescriptor(), primitiveField.getFile());
- assertEquals(FieldDescriptor.Type.INT32, primitiveField.getType());
- assertEquals(FieldDescriptor.JavaType.INT, primitiveField.getJavaType());
- assertEquals(DescriptorProtos.FieldOptions.getDefaultInstance(),
- primitiveField.getOptions());
- assertFalse(primitiveField.isExtension());
- assertEquals("optional_int32", primitiveField.toProto().getName());
-
- assertEquals("optional_nested_enum", enumField.getName());
- assertEquals(FieldDescriptor.Type.ENUM, enumField.getType());
- assertEquals(FieldDescriptor.JavaType.ENUM, enumField.getJavaType());
- assertEquals(TestAllTypes.NestedEnum.getDescriptor(),
- enumField.getEnumType());
-
- assertEquals("optional_foreign_message", messageField.getName());
- assertEquals(FieldDescriptor.Type.MESSAGE, messageField.getType());
- assertEquals(FieldDescriptor.JavaType.MESSAGE, messageField.getJavaType());
- assertEquals(ForeignMessage.getDescriptor(), messageField.getMessageType());
-
- assertEquals("optional_cord", cordField.getName());
- assertEquals(FieldDescriptor.Type.STRING, cordField.getType());
- assertEquals(FieldDescriptor.JavaType.STRING, cordField.getJavaType());
- assertEquals(DescriptorProtos.FieldOptions.CType.CORD,
- cordField.getOptions().getCtype());
-
- assertEquals("optional_int32_extension", extension.getName());
- assertEquals("protobuf_unittest.optional_int32_extension",
- extension.getFullName());
- assertEquals(1, extension.getNumber());
- assertEquals(TestAllExtensions.getDescriptor(),
- extension.getContainingType());
- assertEquals(UnittestProto.getDescriptor(), extension.getFile());
- assertEquals(FieldDescriptor.Type.INT32, extension.getType());
- assertEquals(FieldDescriptor.JavaType.INT, extension.getJavaType());
- assertEquals(DescriptorProtos.FieldOptions.getDefaultInstance(),
- extension.getOptions());
- assertTrue(extension.isExtension());
- assertEquals(null, extension.getExtensionScope());
- assertEquals("optional_int32_extension", extension.toProto().getName());
-
- assertEquals("single", nestedExtension.getName());
- assertEquals("protobuf_unittest.TestRequired.single",
- nestedExtension.getFullName());
- assertEquals(TestRequired.getDescriptor(),
- nestedExtension.getExtensionScope());
- }
-
- public void testFieldDescriptorLabel() throws Exception {
- FieldDescriptor requiredField =
- TestRequired.getDescriptor().findFieldByName("a");
- FieldDescriptor optionalField =
- TestAllTypes.getDescriptor().findFieldByName("optional_int32");
- FieldDescriptor repeatedField =
- TestAllTypes.getDescriptor().findFieldByName("repeated_int32");
-
- assertTrue(requiredField.isRequired());
- assertFalse(requiredField.isRepeated());
- assertFalse(optionalField.isRequired());
- assertFalse(optionalField.isRepeated());
- assertFalse(repeatedField.isRequired());
- assertTrue(repeatedField.isRepeated());
- }
-
- public void testFieldDescriptorDefault() throws Exception {
- Descriptor d = TestAllTypes.getDescriptor();
- assertFalse(d.findFieldByName("optional_int32").hasDefaultValue());
- assertEquals(0, d.findFieldByName("optional_int32").getDefaultValue());
- assertTrue(d.findFieldByName("default_int32").hasDefaultValue());
- assertEquals(41, d.findFieldByName("default_int32").getDefaultValue());
-
- d = TestExtremeDefaultValues.getDescriptor();
- assertEquals(
- ByteString.copyFrom(
- "\0\001\007\b\f\n\r\t\013\\\'\"\u00fe".getBytes("ISO-8859-1")),
- d.findFieldByName("escaped_bytes").getDefaultValue());
- assertEquals(-1, d.findFieldByName("large_uint32").getDefaultValue());
- assertEquals(-1L, d.findFieldByName("large_uint64").getDefaultValue());
- }
-
- public void testEnumDescriptor() throws Exception {
- EnumDescriptor enumType = ForeignEnum.getDescriptor();
- EnumDescriptor nestedType = TestAllTypes.NestedEnum.getDescriptor();
-
- assertEquals("ForeignEnum", enumType.getName());
- assertEquals("protobuf_unittest.ForeignEnum", enumType.getFullName());
- assertEquals(UnittestProto.getDescriptor(), enumType.getFile());
- assertNull(enumType.getContainingType());
- assertEquals(DescriptorProtos.EnumOptions.getDefaultInstance(),
- enumType.getOptions());
-
- assertEquals("NestedEnum", nestedType.getName());
- assertEquals("protobuf_unittest.TestAllTypes.NestedEnum",
- nestedType.getFullName());
- assertEquals(UnittestProto.getDescriptor(), nestedType.getFile());
- assertEquals(TestAllTypes.getDescriptor(), nestedType.getContainingType());
-
- EnumValueDescriptor value = ForeignEnum.FOREIGN_FOO.getValueDescriptor();
- assertEquals(value, enumType.getValues().get(0));
- assertEquals("FOREIGN_FOO", value.getName());
- assertEquals(4, value.getNumber());
- assertEquals(value, enumType.findValueByName("FOREIGN_FOO"));
- assertEquals(value, enumType.findValueByNumber(4));
- assertNull(enumType.findValueByName("NO_SUCH_VALUE"));
- for (int i = 0; i < enumType.getValues().size(); i++) {
- assertEquals(i, enumType.getValues().get(i).getIndex());
- }
- }
-
- public void testServiceDescriptor() throws Exception {
- ServiceDescriptor service = TestService.getDescriptor();
-
- assertEquals("TestService", service.getName());
- assertEquals("protobuf_unittest.TestService", service.getFullName());
- assertEquals(UnittestProto.getDescriptor(), service.getFile());
-
- assertEquals(2, service.getMethods().size());
-
- MethodDescriptor fooMethod = service.getMethods().get(0);
- assertEquals("Foo", fooMethod.getName());
- assertEquals(UnittestProto.FooRequest.getDescriptor(),
- fooMethod.getInputType());
- assertEquals(UnittestProto.FooResponse.getDescriptor(),
- fooMethod.getOutputType());
- assertEquals(fooMethod, service.findMethodByName("Foo"));
-
- MethodDescriptor barMethod = service.getMethods().get(1);
- assertEquals("Bar", barMethod.getName());
- assertEquals(UnittestProto.BarRequest.getDescriptor(),
- barMethod.getInputType());
- assertEquals(UnittestProto.BarResponse.getDescriptor(),
- barMethod.getOutputType());
- assertEquals(barMethod, service.findMethodByName("Bar"));
-
- assertNull(service.findMethodByName("NoSuchMethod"));
-
- for (int i = 0; i < service.getMethods().size(); i++) {
- assertEquals(i, service.getMethods().get(i).getIndex());
- }
- }
-
-
- public void testCustomOptions() throws Exception {
- Descriptor descriptor =
- UnittestCustomOptions.TestMessageWithCustomOptions.getDescriptor();
-
- assertTrue(
- descriptor.getOptions().hasExtension(UnittestCustomOptions.messageOpt1));
- assertEquals(Integer.valueOf(-56),
- descriptor.getOptions().getExtension(UnittestCustomOptions.messageOpt1));
-
- FieldDescriptor field = descriptor.findFieldByName("field1");
- assertNotNull(field);
-
- assertTrue(
- field.getOptions().hasExtension(UnittestCustomOptions.fieldOpt1));
- assertEquals(Long.valueOf(8765432109L),
- field.getOptions().getExtension(UnittestCustomOptions.fieldOpt1));
-
- EnumDescriptor enumType =
- UnittestCustomOptions.TestMessageWithCustomOptions.AnEnum.getDescriptor();
-
- assertTrue(
- enumType.getOptions().hasExtension(UnittestCustomOptions.enumOpt1));
- assertEquals(Integer.valueOf(-789),
- enumType.getOptions().getExtension(UnittestCustomOptions.enumOpt1));
-
- ServiceDescriptor service =
- UnittestCustomOptions.TestServiceWithCustomOptions.getDescriptor();
-
- assertTrue(
- service.getOptions().hasExtension(UnittestCustomOptions.serviceOpt1));
- assertEquals(Long.valueOf(-9876543210L),
- service.getOptions().getExtension(UnittestCustomOptions.serviceOpt1));
-
- MethodDescriptor method = service.findMethodByName("Foo");
- assertNotNull(method);
-
- assertTrue(
- method.getOptions().hasExtension(UnittestCustomOptions.methodOpt1));
- assertEquals(UnittestCustomOptions.MethodOpt1.METHODOPT1_VAL2,
- method.getOptions().getExtension(UnittestCustomOptions.methodOpt1));
- }
-
- /**
- * Test that the FieldDescriptor.Type enum is the same as the
- * WireFormat.FieldType enum.
- */
- public void testFieldTypeTablesMatch() throws Exception {
- FieldDescriptor.Type[] values1 = FieldDescriptor.Type.values();
- WireFormat.FieldType[] values2 = WireFormat.FieldType.values();
-
- assertEquals(values1.length, values2.length);
-
- for (int i = 0; i < values1.length; i++) {
- assertEquals(values1[i].toString(), values2[i].toString());
- }
- }
-
- /**
- * Test that the FieldDescriptor.JavaType enum is the same as the
- * WireFormat.JavaType enum.
- */
- public void testJavaTypeTablesMatch() throws Exception {
- FieldDescriptor.JavaType[] values1 = FieldDescriptor.JavaType.values();
- WireFormat.JavaType[] values2 = WireFormat.JavaType.values();
-
- assertEquals(values1.length, values2.length);
-
- for (int i = 0; i < values1.length; i++) {
- assertEquals(values1[i].toString(), values2[i].toString());
- }
- }
-
- public void testEnormousDescriptor() throws Exception {
- // The descriptor for this file is larger than 64k, yet it did not cause
- // a compiler error due to an over-long string literal.
- assertTrue(
- UnittestEnormousDescriptor.getDescriptor()
- .toProto().getSerializedSize() > 65536);
- }
-
- /**
- * Tests that the DescriptorValidationException works as intended.
- */
- public void testDescriptorValidatorException() throws Exception {
- FileDescriptorProto fileDescriptorProto = FileDescriptorProto.newBuilder()
- .setName("foo.proto")
- .addMessageType(DescriptorProto.newBuilder()
- .setName("Foo")
- .addField(FieldDescriptorProto.newBuilder()
- .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
- .setType(FieldDescriptorProto.Type.TYPE_INT32)
- .setName("foo")
- .setNumber(1)
- .setDefaultValue("invalid")
- .build())
- .build())
- .build();
- try {
- Descriptors.FileDescriptor.buildFrom(fileDescriptorProto,
- new FileDescriptor[0]);
- fail("DescriptorValidationException expected");
- } catch (DescriptorValidationException e) {
- // Expected; check that the error message contains some useful hints
- assertTrue(e.getMessage().indexOf("foo") != -1);
- assertTrue(e.getMessage().indexOf("Foo") != -1);
- assertTrue(e.getMessage().indexOf("invalid") != -1);
- assertTrue(e.getCause() instanceof NumberFormatException);
- assertTrue(e.getCause().getMessage().indexOf("invalid") != -1);
- }
- }
-
- /**
- * Tests the translate/crosslink for an example where a message field's name
- * and type name are the same.
- */
- public void testDescriptorComplexCrosslink() throws Exception {
- FileDescriptorProto fileDescriptorProto = FileDescriptorProto.newBuilder()
- .setName("foo.proto")
- .addMessageType(DescriptorProto.newBuilder()
- .setName("Foo")
- .addField(FieldDescriptorProto.newBuilder()
- .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
- .setType(FieldDescriptorProto.Type.TYPE_INT32)
- .setName("foo")
- .setNumber(1)
- .build())
- .build())
- .addMessageType(DescriptorProto.newBuilder()
- .setName("Bar")
- .addField(FieldDescriptorProto.newBuilder()
- .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
- .setTypeName("Foo")
- .setName("Foo")
- .setNumber(1)
- .build())
- .build())
- .build();
- // translate and crosslink
- FileDescriptor file =
- Descriptors.FileDescriptor.buildFrom(fileDescriptorProto,
- new FileDescriptor[0]);
- // verify resulting descriptors
- assertNotNull(file);
- List<Descriptor> msglist = file.getMessageTypes();
- assertNotNull(msglist);
- assertTrue(msglist.size() == 2);
- boolean barFound = false;
- for (Descriptor desc : msglist) {
- if (desc.getName().equals("Bar")) {
- barFound = true;
- assertNotNull(desc.getFields());
- List<FieldDescriptor> fieldlist = desc.getFields();
- assertNotNull(fieldlist);
- assertTrue(fieldlist.size() == 1);
- assertTrue(fieldlist.get(0).getType() == FieldDescriptor.Type.MESSAGE);
- assertTrue(fieldlist.get(0).getMessageType().getName().equals("Foo"));
- }
- }
- assertTrue(barFound);
- }
-
- public void testInvalidPublicDependency() throws Exception {
- FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
- .setName("foo.proto") .build();
- FileDescriptorProto barProto = FileDescriptorProto.newBuilder()
- .setName("boo.proto")
- .addDependency("foo.proto")
- .addPublicDependency(1) // Error, should be 0.
- .build();
- FileDescriptor fooFile = Descriptors.FileDescriptor.buildFrom(fooProto,
- new FileDescriptor[0]);
- try {
- Descriptors.FileDescriptor.buildFrom(barProto,
- new FileDescriptor[] {fooFile});
- fail("DescriptorValidationException expected");
- } catch (DescriptorValidationException e) {
- assertTrue(
- e.getMessage().indexOf("Invalid public dependency index.") != -1);
- }
- }
-
- public void testHiddenDependency() throws Exception {
- FileDescriptorProto barProto = FileDescriptorProto.newBuilder()
- .setName("bar.proto")
- .addMessageType(DescriptorProto.newBuilder().setName("Bar"))
- .build();
- FileDescriptorProto forwardProto = FileDescriptorProto.newBuilder()
- .setName("forward.proto")
- .addDependency("bar.proto")
- .build();
- FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
- .setName("foo.proto")
- .addDependency("forward.proto")
- .addMessageType(DescriptorProto.newBuilder()
- .setName("Foo")
- .addField(FieldDescriptorProto.newBuilder()
- .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
- .setTypeName("Bar")
- .setName("bar")
- .setNumber(1)))
- .build();
- FileDescriptor barFile = Descriptors.FileDescriptor.buildFrom(
- barProto, new FileDescriptor[0]);
- FileDescriptor forwardFile = Descriptors.FileDescriptor.buildFrom(
- forwardProto, new FileDescriptor[] {barFile});
-
- try {
- Descriptors.FileDescriptor.buildFrom(
- fooProto, new FileDescriptor[] {forwardFile});
- fail("DescriptorValidationException expected");
- } catch (DescriptorValidationException e) {
- assertTrue(e.getMessage().indexOf("Bar") != -1);
- assertTrue(e.getMessage().indexOf("is not defined") != -1);
- }
- }
-
- public void testPublicDependency() throws Exception {
- FileDescriptorProto barProto = FileDescriptorProto.newBuilder()
- .setName("bar.proto")
- .addMessageType(DescriptorProto.newBuilder().setName("Bar"))
- .build();
- FileDescriptorProto forwardProto = FileDescriptorProto.newBuilder()
- .setName("forward.proto")
- .addDependency("bar.proto")
- .addPublicDependency(0)
- .build();
- FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
- .setName("foo.proto")
- .addDependency("forward.proto")
- .addMessageType(DescriptorProto.newBuilder()
- .setName("Foo")
- .addField(FieldDescriptorProto.newBuilder()
- .setLabel(FieldDescriptorProto.Label.LABEL_OPTIONAL)
- .setTypeName("Bar")
- .setName("bar")
- .setNumber(1)))
- .build();
- FileDescriptor barFile = Descriptors.FileDescriptor.buildFrom(
- barProto, new FileDescriptor[0]);
- FileDescriptor forwardFile = Descriptors.FileDescriptor.buildFrom(
- forwardProto, new FileDescriptor[]{barFile});
- Descriptors.FileDescriptor.buildFrom(
- fooProto, new FileDescriptor[] {forwardFile});
- }
-
- /**
- * Tests the translate/crosslink for an example with a more complex namespace
- * referencing.
- */
- public void testComplexNamespacePublicDependency() throws Exception {
- FileDescriptorProto fooProto = FileDescriptorProto.newBuilder()
- .setName("bar.proto")
- .setPackage("a.b.c.d.bar.shared")
- .addEnumType(EnumDescriptorProto.newBuilder()
- .setName("MyEnum")
- .addValue(EnumValueDescriptorProto.newBuilder()
- .setName("BLAH")
- .setNumber(1)))
- .build();
- FileDescriptorProto barProto = FileDescriptorProto.newBuilder()
- .setName("foo.proto")
- .addDependency("bar.proto")
- .setPackage("a.b.c.d.foo.shared")
- .addMessageType(DescriptorProto.newBuilder()
- .setName("MyMessage")
- .addField(FieldDescriptorProto.newBuilder()
- .setLabel(FieldDescriptorProto.Label.LABEL_REPEATED)
- .setTypeName("bar.shared.MyEnum")
- .setName("MyField")
- .setNumber(1)))
- .build();
- // translate and crosslink
- FileDescriptor fooFile = Descriptors.FileDescriptor.buildFrom(
- fooProto, new FileDescriptor[0]);
- FileDescriptor barFile = Descriptors.FileDescriptor.buildFrom(
- barProto, new FileDescriptor[]{fooFile});
- // verify resulting descriptors
- assertNotNull(barFile);
- List<Descriptor> msglist = barFile.getMessageTypes();
- assertNotNull(msglist);
- assertTrue(msglist.size() == 1);
- Descriptor desc = msglist.get(0);
- if (desc.getName().equals("MyMessage")) {
- assertNotNull(desc.getFields());
- List<FieldDescriptor> fieldlist = desc.getFields();
- assertNotNull(fieldlist);
- assertTrue(fieldlist.size() == 1);
- FieldDescriptor field = fieldlist.get(0);
- assertTrue(field.getType() == FieldDescriptor.Type.ENUM);
- assertTrue(field.getEnumType().getName().equals("MyEnum"));
- assertTrue(field.getEnumType().getFile().getName().equals("bar.proto"));
- assertTrue(field.getEnumType().getFile().getPackage().equals(
- "a.b.c.d.bar.shared"));
- }
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java
deleted file mode 100644
index 0023067..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/DynamicMessageTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestEmptyMessage;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
-
-import junit.framework.TestCase;
-import java.util.Arrays;
-
-/**
- * Unit test for {@link DynamicMessage}. See also {@link MessageTest}, which
- * tests some {@link DynamicMessage} functionality.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class DynamicMessageTest extends TestCase {
- TestUtil.ReflectionTester reflectionTester =
- new TestUtil.ReflectionTester(TestAllTypes.getDescriptor(), null);
-
- TestUtil.ReflectionTester extensionsReflectionTester =
- new TestUtil.ReflectionTester(TestAllExtensions.getDescriptor(),
- TestUtil.getExtensionRegistry());
- TestUtil.ReflectionTester packedReflectionTester =
- new TestUtil.ReflectionTester(TestPackedTypes.getDescriptor(), null);
-
- public void testDynamicMessageAccessors() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.setAllFieldsViaReflection(builder);
- Message message = builder.build();
- reflectionTester.assertAllFieldsSetViaReflection(message);
- }
-
- public void testSettersAfterBuild() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- Message firstMessage = builder.build();
- // double build()
- builder.build();
- // clear() after build()
- builder.clear();
- // setters after build()
- reflectionTester.setAllFieldsViaReflection(builder);
- Message message = builder.build();
- reflectionTester.assertAllFieldsSetViaReflection(message);
- // repeated setters after build()
- reflectionTester.modifyRepeatedFieldsViaReflection(builder);
- message = builder.build();
- reflectionTester.assertRepeatedFieldsModifiedViaReflection(message);
- // firstMessage shouldn't have been modified.
- reflectionTester.assertClearViaReflection(firstMessage);
- }
-
- public void testUnknownFields() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestEmptyMessage.getDescriptor());
- builder.setUnknownFields(UnknownFieldSet.newBuilder()
- .addField(1, UnknownFieldSet.Field.newBuilder().addVarint(1).build())
- .addField(2, UnknownFieldSet.Field.newBuilder().addFixed32(1).build())
- .build());
- Message message = builder.build();
- assertEquals(2, message.getUnknownFields().asMap().size());
- // clone() with unknown fields
- Message.Builder newBuilder = builder.clone();
- assertEquals(2, newBuilder.getUnknownFields().asMap().size());
- // clear() with unknown fields
- newBuilder.clear();
- assertTrue(newBuilder.getUnknownFields().asMap().isEmpty());
- // serialize/parse with unknown fields
- newBuilder.mergeFrom(message.toByteString());
- assertEquals(2, newBuilder.getUnknownFields().asMap().size());
- }
-
- public void testDynamicMessageSettersRejectNull() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.assertReflectionSettersRejectNull(builder);
- }
-
- public void testDynamicMessageExtensionAccessors() throws Exception {
- // We don't need to extensively test DynamicMessage's handling of
- // extensions because, frankly, it doesn't do anything special with them.
- // It treats them just like any other fields.
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllExtensions.getDescriptor());
- extensionsReflectionTester.setAllFieldsViaReflection(builder);
- Message message = builder.build();
- extensionsReflectionTester.assertAllFieldsSetViaReflection(message);
- }
-
- public void testDynamicMessageExtensionSettersRejectNull() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllExtensions.getDescriptor());
- extensionsReflectionTester.assertReflectionSettersRejectNull(builder);
- }
-
- public void testDynamicMessageRepeatedSetters() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.setAllFieldsViaReflection(builder);
- reflectionTester.modifyRepeatedFieldsViaReflection(builder);
- Message message = builder.build();
- reflectionTester.assertRepeatedFieldsModifiedViaReflection(message);
- }
-
- public void testDynamicMessageRepeatedSettersRejectNull() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.assertReflectionRepeatedSettersRejectNull(builder);
- }
-
- public void testDynamicMessageDefaults() throws Exception {
- reflectionTester.assertClearViaReflection(
- DynamicMessage.getDefaultInstance(TestAllTypes.getDescriptor()));
- reflectionTester.assertClearViaReflection(
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor()).build());
- }
-
- public void testDynamicMessageSerializedSize() throws Exception {
- TestAllTypes message = TestUtil.getAllSet();
-
- Message.Builder dynamicBuilder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.setAllFieldsViaReflection(dynamicBuilder);
- Message dynamicMessage = dynamicBuilder.build();
-
- assertEquals(message.getSerializedSize(),
- dynamicMessage.getSerializedSize());
- }
-
- public void testDynamicMessageSerialization() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.setAllFieldsViaReflection(builder);
- Message message = builder.build();
-
- ByteString rawBytes = message.toByteString();
- TestAllTypes message2 = TestAllTypes.parseFrom(rawBytes);
-
- TestUtil.assertAllFieldsSet(message2);
-
- // In fact, the serialized forms should be exactly the same, byte-for-byte.
- assertEquals(TestUtil.getAllSet().toByteString(), rawBytes);
- }
-
- public void testDynamicMessageParsing() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- TestAllTypes message = builder.build();
-
- ByteString rawBytes = message.toByteString();
-
- Message message2 =
- DynamicMessage.parseFrom(TestAllTypes.getDescriptor(), rawBytes);
- reflectionTester.assertAllFieldsSetViaReflection(message2);
-
- // Test Parser interface.
- Message message3 = message2.getParserForType().parseFrom(rawBytes);
- reflectionTester.assertAllFieldsSetViaReflection(message3);
- }
-
- public void testDynamicMessageExtensionParsing() throws Exception {
- ByteString rawBytes = TestUtil.getAllExtensionsSet().toByteString();
- Message message = DynamicMessage.parseFrom(
- TestAllExtensions.getDescriptor(), rawBytes,
- TestUtil.getExtensionRegistry());
- extensionsReflectionTester.assertAllFieldsSetViaReflection(message);
-
- // Test Parser interface.
- Message message2 = message.getParserForType().parseFrom(
- rawBytes, TestUtil.getExtensionRegistry());
- extensionsReflectionTester.assertAllFieldsSetViaReflection(message2);
- }
-
- public void testDynamicMessagePackedSerialization() throws Exception {
- Message.Builder builder =
- DynamicMessage.newBuilder(TestPackedTypes.getDescriptor());
- packedReflectionTester.setPackedFieldsViaReflection(builder);
- Message message = builder.build();
-
- ByteString rawBytes = message.toByteString();
- TestPackedTypes message2 = TestPackedTypes.parseFrom(rawBytes);
-
- TestUtil.assertPackedFieldsSet(message2);
-
- // In fact, the serialized forms should be exactly the same, byte-for-byte.
- assertEquals(TestUtil.getPackedSet().toByteString(), rawBytes);
- }
-
- public void testDynamicMessagePackedParsing() throws Exception {
- TestPackedTypes.Builder builder = TestPackedTypes.newBuilder();
- TestUtil.setPackedFields(builder);
- TestPackedTypes message = builder.build();
-
- ByteString rawBytes = message.toByteString();
-
- Message message2 =
- DynamicMessage.parseFrom(TestPackedTypes.getDescriptor(), rawBytes);
- packedReflectionTester.assertPackedFieldsSetViaReflection(message2);
-
- // Test Parser interface.
- Message message3 = message2.getParserForType().parseFrom(rawBytes);
- packedReflectionTester.assertPackedFieldsSetViaReflection(message3);
- }
-
- public void testDynamicMessageCopy() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- TestAllTypes message = builder.build();
-
- DynamicMessage copy = DynamicMessage.newBuilder(message).build();
- reflectionTester.assertAllFieldsSetViaReflection(copy);
- }
-
- public void testToBuilder() throws Exception {
- DynamicMessage.Builder builder =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor());
- reflectionTester.setAllFieldsViaReflection(builder);
- int unknownFieldNum = 9;
- long unknownFieldVal = 90;
- builder.setUnknownFields(UnknownFieldSet.newBuilder()
- .addField(unknownFieldNum,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(unknownFieldVal).build())
- .build());
- DynamicMessage message = builder.build();
-
- DynamicMessage derived = message.toBuilder().build();
- reflectionTester.assertAllFieldsSetViaReflection(derived);
- assertEquals(Arrays.asList(unknownFieldVal),
- derived.getUnknownFields().getField(unknownFieldNum).getVarintList());
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java
deleted file mode 100644
index 6a39500..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ForceFieldBuildersPreRun.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-/**
- * A prerun for a test suite that allows running the full protocol buffer
- * tests in a mode that disables the optimization for not using
- * {@link RepeatedFieldBuilder} and {@link SingleFieldBuilder} until they are
- * requested. This allows us to run all the tests through both code paths
- * and ensures that both code paths produce identical results.
- *
- * @author jonp@google.com (Jon Perlow)
- */
-public class ForceFieldBuildersPreRun implements Runnable {
-
- //@Override (Java 1.6 override semantics, but we must support 1.5)
- public void run() {
- // GeneratedMessage.enableAlwaysUseFieldBuildersForTesting();
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java
deleted file mode 100644
index 1e7d41e..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/GeneratedMessageTest.java
+++ /dev/null
@@ -1,961 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import com.google.protobuf.Descriptors.Descriptor;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import com.google.protobuf.test.UnittestImport;
-import protobuf_unittest.EnumWithNoOuter;
-import protobuf_unittest.MessageWithNoOuter;
-import protobuf_unittest.MultipleFilesTestProto;
-import protobuf_unittest.NestedExtension.MyNestedExtension;
-import protobuf_unittest.NonNestedExtension;
-import protobuf_unittest.NonNestedExtension.MessageToBeExtended;
-import protobuf_unittest.NonNestedExtension.MyNonNestedExtension;
-import protobuf_unittest.ServiceWithNoOuter;
-import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize;
-import protobuf_unittest.UnittestOptimizeFor.TestOptionalOptimizedForSize;
-import protobuf_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize;
-import protobuf_unittest.UnittestProto;
-import protobuf_unittest.UnittestProto.ForeignEnum;
-import protobuf_unittest.UnittestProto.ForeignMessage;
-import protobuf_unittest.UnittestProto.ForeignMessageOrBuilder;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage;
-import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder;
-import protobuf_unittest.UnittestProto.TestExtremeDefaultValues;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
-import protobuf_unittest.UnittestProto.TestUnpackedTypes;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Unit test for generated messages and generated code. See also
- * {@link MessageTest}, which tests some generated message functionality.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class GeneratedMessageTest extends TestCase {
- TestUtil.ReflectionTester reflectionTester =
- new TestUtil.ReflectionTester(TestAllTypes.getDescriptor(), null);
-
- public void testDefaultInstance() throws Exception {
- assertSame(TestAllTypes.getDefaultInstance(),
- TestAllTypes.getDefaultInstance().getDefaultInstanceForType());
- assertSame(TestAllTypes.getDefaultInstance(),
- TestAllTypes.newBuilder().getDefaultInstanceForType());
- }
-
- public void testMessageOrBuilder() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- TestAllTypes message = builder.build();
- TestUtil.assertAllFieldsSet(message);
- }
-
- public void testUsingBuilderMultipleTimes() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- // primitive field scalar and repeated
- builder.setOptionalSfixed64(100);
- builder.addRepeatedInt32(100);
- // enum field scalar and repeated
- builder.setOptionalImportEnum(UnittestImport.ImportEnum.IMPORT_BAR);
- builder.addRepeatedImportEnum(UnittestImport.ImportEnum.IMPORT_BAR);
- // proto field scalar and repeated
- builder.setOptionalForeignMessage(ForeignMessage.newBuilder().setC(1));
- builder.addRepeatedForeignMessage(ForeignMessage.newBuilder().setC(1));
-
- TestAllTypes value1 = builder.build();
-
- assertEquals(100, value1.getOptionalSfixed64());
- assertEquals(100, value1.getRepeatedInt32(0));
- assertEquals(UnittestImport.ImportEnum.IMPORT_BAR,
- value1.getOptionalImportEnum());
- assertEquals(UnittestImport.ImportEnum.IMPORT_BAR,
- value1.getRepeatedImportEnum(0));
- assertEquals(1, value1.getOptionalForeignMessage().getC());
- assertEquals(1, value1.getRepeatedForeignMessage(0).getC());
-
- // Make sure that builder didn't update previously created values
- builder.setOptionalSfixed64(200);
- builder.setRepeatedInt32(0, 200);
- builder.setOptionalImportEnum(UnittestImport.ImportEnum.IMPORT_FOO);
- builder.setRepeatedImportEnum(0, UnittestImport.ImportEnum.IMPORT_FOO);
- builder.setOptionalForeignMessage(ForeignMessage.newBuilder().setC(2));
- builder.setRepeatedForeignMessage(0, ForeignMessage.newBuilder().setC(2));
-
- TestAllTypes value2 = builder.build();
-
- // Make sure value1 didn't change.
- assertEquals(100, value1.getOptionalSfixed64());
- assertEquals(100, value1.getRepeatedInt32(0));
- assertEquals(UnittestImport.ImportEnum.IMPORT_BAR,
- value1.getOptionalImportEnum());
- assertEquals(UnittestImport.ImportEnum.IMPORT_BAR,
- value1.getRepeatedImportEnum(0));
- assertEquals(1, value1.getOptionalForeignMessage().getC());
- assertEquals(1, value1.getRepeatedForeignMessage(0).getC());
-
- // Make sure value2 is correct
- assertEquals(200, value2.getOptionalSfixed64());
- assertEquals(200, value2.getRepeatedInt32(0));
- assertEquals(UnittestImport.ImportEnum.IMPORT_FOO,
- value2.getOptionalImportEnum());
- assertEquals(UnittestImport.ImportEnum.IMPORT_FOO,
- value2.getRepeatedImportEnum(0));
- assertEquals(2, value2.getOptionalForeignMessage().getC());
- assertEquals(2, value2.getRepeatedForeignMessage(0).getC());
- }
-
- public void testRepeatedArraysAreImmutable() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- builder.addRepeatedInt32(100);
- builder.addRepeatedImportEnum(UnittestImport.ImportEnum.IMPORT_BAR);
- builder.addRepeatedForeignMessage(ForeignMessage.getDefaultInstance());
- assertIsUnmodifiable(builder.getRepeatedInt32List());
- assertIsUnmodifiable(builder.getRepeatedImportEnumList());
- assertIsUnmodifiable(builder.getRepeatedForeignMessageList());
- assertIsUnmodifiable(builder.getRepeatedFloatList());
-
-
- TestAllTypes value = builder.build();
- assertIsUnmodifiable(value.getRepeatedInt32List());
- assertIsUnmodifiable(value.getRepeatedImportEnumList());
- assertIsUnmodifiable(value.getRepeatedForeignMessageList());
- assertIsUnmodifiable(value.getRepeatedFloatList());
- }
-
- public void testParsedMessagesAreImmutable() throws Exception {
- TestAllTypes value = TestAllTypes.PARSER.parseFrom(
- TestUtil.getAllSet().toByteString());
- assertIsUnmodifiable(value.getRepeatedInt32List());
- assertIsUnmodifiable(value.getRepeatedInt64List());
- assertIsUnmodifiable(value.getRepeatedUint32List());
- assertIsUnmodifiable(value.getRepeatedUint64List());
- assertIsUnmodifiable(value.getRepeatedSint32List());
- assertIsUnmodifiable(value.getRepeatedSint64List());
- assertIsUnmodifiable(value.getRepeatedFixed32List());
- assertIsUnmodifiable(value.getRepeatedFixed64List());
- assertIsUnmodifiable(value.getRepeatedSfixed32List());
- assertIsUnmodifiable(value.getRepeatedSfixed64List());
- assertIsUnmodifiable(value.getRepeatedFloatList());
- assertIsUnmodifiable(value.getRepeatedDoubleList());
- assertIsUnmodifiable(value.getRepeatedBoolList());
- assertIsUnmodifiable(value.getRepeatedStringList());
- assertIsUnmodifiable(value.getRepeatedBytesList());
- assertIsUnmodifiable(value.getRepeatedGroupList());
- assertIsUnmodifiable(value.getRepeatedNestedMessageList());
- assertIsUnmodifiable(value.getRepeatedForeignMessageList());
- assertIsUnmodifiable(value.getRepeatedImportMessageList());
- assertIsUnmodifiable(value.getRepeatedNestedEnumList());
- assertIsUnmodifiable(value.getRepeatedForeignEnumList());
- assertIsUnmodifiable(value.getRepeatedImportEnumList());
- }
-
- private void assertIsUnmodifiable(List<?> list) {
- if (list == Collections.emptyList()) {
- // OKAY -- Need to check this b/c EmptyList allows you to call clear.
- } else {
- try {
- list.clear();
- fail("List wasn't immutable");
- } catch (UnsupportedOperationException e) {
- // good
- }
- }
- }
-
- public void testSettersRejectNull() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- try {
- builder.setOptionalString(null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setOptionalBytes(null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setOptionalNestedMessage((TestAllTypes.NestedMessage) null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setOptionalNestedMessage(
- (TestAllTypes.NestedMessage.Builder) null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setOptionalNestedEnum(null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedString(null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedBytes(null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedNestedMessage((TestAllTypes.NestedMessage) null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedNestedMessage(
- (TestAllTypes.NestedMessage.Builder) null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedNestedEnum(null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- }
-
- public void testRepeatedSetters() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- TestUtil.modifyRepeatedFields(builder);
- TestAllTypes message = builder.build();
- TestUtil.assertRepeatedFieldsModified(message);
- }
-
- public void testRepeatedSettersRejectNull() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
-
- builder.addRepeatedString("one");
- builder.addRepeatedString("two");
- try {
- builder.setRepeatedString(1, null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- builder.addRepeatedBytes(TestUtil.toBytes("one"));
- builder.addRepeatedBytes(TestUtil.toBytes("two"));
- try {
- builder.setRepeatedBytes(1, null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- builder.addRepeatedNestedMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(218).build());
- builder.addRepeatedNestedMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(456).build());
- try {
- builder.setRepeatedNestedMessage(1, (TestAllTypes.NestedMessage) null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setRepeatedNestedMessage(
- 1, (TestAllTypes.NestedMessage.Builder) null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- builder.addRepeatedNestedEnum(TestAllTypes.NestedEnum.FOO);
- builder.addRepeatedNestedEnum(TestAllTypes.NestedEnum.BAR);
- try {
- builder.setRepeatedNestedEnum(1, null);
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- }
-
- public void testRepeatedAppend() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
-
- builder.addAllRepeatedInt32(Arrays.asList(1, 2, 3, 4));
- builder.addAllRepeatedForeignEnum(Arrays.asList(ForeignEnum.FOREIGN_BAZ));
-
- ForeignMessage foreignMessage =
- ForeignMessage.newBuilder().setC(12).build();
- builder.addAllRepeatedForeignMessage(Arrays.asList(foreignMessage));
-
- TestAllTypes message = builder.build();
- assertEquals(message.getRepeatedInt32List(), Arrays.asList(1, 2, 3, 4));
- assertEquals(message.getRepeatedForeignEnumList(),
- Arrays.asList(ForeignEnum.FOREIGN_BAZ));
- assertEquals(1, message.getRepeatedForeignMessageCount());
- assertEquals(12, message.getRepeatedForeignMessage(0).getC());
- }
-
- public void testRepeatedAppendRejectsNull() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
-
- ForeignMessage foreignMessage =
- ForeignMessage.newBuilder().setC(12).build();
- try {
- builder.addAllRepeatedForeignMessage(
- Arrays.asList(foreignMessage, (ForeignMessage) null));
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- try {
- builder.addAllRepeatedForeignEnum(
- Arrays.asList(ForeignEnum.FOREIGN_BAZ, null));
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- try {
- builder.addAllRepeatedString(Arrays.asList("one", null));
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- try {
- builder.addAllRepeatedBytes(Arrays.asList(TestUtil.toBytes("one"), null));
- fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- }
-
- public void testSettingForeignMessageUsingBuilder() throws Exception {
- TestAllTypes message = TestAllTypes.newBuilder()
- // Pass builder for foreign message instance.
- .setOptionalForeignMessage(ForeignMessage.newBuilder().setC(123))
- .build();
- TestAllTypes expectedMessage = TestAllTypes.newBuilder()
- // Create expected version passing foreign message instance explicitly.
- .setOptionalForeignMessage(
- ForeignMessage.newBuilder().setC(123).build())
- .build();
- // TODO(ngd): Upgrade to using real #equals method once implemented
- assertEquals(expectedMessage.toString(), message.toString());
- }
-
- public void testSettingRepeatedForeignMessageUsingBuilder() throws Exception {
- TestAllTypes message = TestAllTypes.newBuilder()
- // Pass builder for foreign message instance.
- .addRepeatedForeignMessage(ForeignMessage.newBuilder().setC(456))
- .build();
- TestAllTypes expectedMessage = TestAllTypes.newBuilder()
- // Create expected version passing foreign message instance explicitly.
- .addRepeatedForeignMessage(
- ForeignMessage.newBuilder().setC(456).build())
- .build();
- assertEquals(expectedMessage.toString(), message.toString());
- }
-
- public void testDefaults() throws Exception {
- TestUtil.assertClear(TestAllTypes.getDefaultInstance());
- TestUtil.assertClear(TestAllTypes.newBuilder().build());
-
- TestExtremeDefaultValues message =
- TestExtremeDefaultValues.getDefaultInstance();
- assertEquals("\u1234", message.getUtf8String());
- assertEquals(Double.POSITIVE_INFINITY, message.getInfDouble());
- assertEquals(Double.NEGATIVE_INFINITY, message.getNegInfDouble());
- assertTrue(Double.isNaN(message.getNanDouble()));
- assertEquals(Float.POSITIVE_INFINITY, message.getInfFloat());
- assertEquals(Float.NEGATIVE_INFINITY, message.getNegInfFloat());
- assertTrue(Float.isNaN(message.getNanFloat()));
- assertEquals("? ? ?? ?? ??? ??/ ??-", message.getCppTrigraph());
- }
-
- public void testClear() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.assertClear(builder);
- TestUtil.setAllFields(builder);
- builder.clear();
- TestUtil.assertClear(builder);
- }
-
- public void testReflectionGetters() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- reflectionTester.assertAllFieldsSetViaReflection(builder);
-
- TestAllTypes message = builder.build();
- reflectionTester.assertAllFieldsSetViaReflection(message);
- }
-
- public void testReflectionSetters() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- reflectionTester.setAllFieldsViaReflection(builder);
- TestUtil.assertAllFieldsSet(builder);
-
- TestAllTypes message = builder.build();
- TestUtil.assertAllFieldsSet(message);
- }
-
- public void testReflectionSettersRejectNull() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- reflectionTester.assertReflectionSettersRejectNull(builder);
- }
-
- public void testReflectionRepeatedSetters() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- reflectionTester.setAllFieldsViaReflection(builder);
- reflectionTester.modifyRepeatedFieldsViaReflection(builder);
- TestUtil.assertRepeatedFieldsModified(builder);
-
- TestAllTypes message = builder.build();
- TestUtil.assertRepeatedFieldsModified(message);
- }
-
- public void testReflectionRepeatedSettersRejectNull() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- reflectionTester.assertReflectionRepeatedSettersRejectNull(builder);
- }
-
- public void testReflectionDefaults() throws Exception {
- reflectionTester.assertClearViaReflection(
- TestAllTypes.getDefaultInstance());
- reflectionTester.assertClearViaReflection(
- TestAllTypes.newBuilder().build());
- }
-
- public void testEnumInterface() throws Exception {
- assertTrue(TestAllTypes.getDefaultInstance().getDefaultNestedEnum()
- instanceof ProtocolMessageEnum);
- }
-
- public void testEnumMap() throws Exception {
- Internal.EnumLiteMap<ForeignEnum> map = ForeignEnum.internalGetValueMap();
-
- for (ForeignEnum value : ForeignEnum.values()) {
- assertEquals(value, map.findValueByNumber(value.getNumber()));
- }
-
- assertTrue(map.findValueByNumber(12345) == null);
- }
-
- public void testParsePackedToUnpacked() throws Exception {
- TestUnpackedTypes.Builder builder = TestUnpackedTypes.newBuilder();
- TestUnpackedTypes message =
- builder.mergeFrom(TestUtil.getPackedSet().toByteString()).build();
- TestUtil.assertUnpackedFieldsSet(message);
- }
-
- public void testParseUnpackedToPacked() throws Exception {
- TestPackedTypes.Builder builder = TestPackedTypes.newBuilder();
- TestPackedTypes message =
- builder.mergeFrom(TestUtil.getUnpackedSet().toByteString()).build();
- TestUtil.assertPackedFieldsSet(message);
- }
-
- // =================================================================
- // Extensions.
-
- TestUtil.ReflectionTester extensionsReflectionTester =
- new TestUtil.ReflectionTester(TestAllExtensions.getDescriptor(),
- TestUtil.getExtensionRegistry());
-
- public void testExtensionMessageOrBuilder() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- TestUtil.setAllExtensions(builder);
- TestAllExtensions message = builder.build();
- TestUtil.assertAllExtensionsSet(message);
- }
-
- public void testExtensionRepeatedSetters() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- TestUtil.setAllExtensions(builder);
- TestUtil.modifyRepeatedExtensions(builder);
- TestAllExtensions message = builder.build();
- TestUtil.assertRepeatedExtensionsModified(message);
- }
-
- public void testExtensionDefaults() throws Exception {
- TestUtil.assertExtensionsClear(TestAllExtensions.getDefaultInstance());
- TestUtil.assertExtensionsClear(TestAllExtensions.newBuilder().build());
- }
-
- public void testExtensionReflectionGetters() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- TestUtil.setAllExtensions(builder);
- extensionsReflectionTester.assertAllFieldsSetViaReflection(builder);
-
- TestAllExtensions message = builder.build();
- extensionsReflectionTester.assertAllFieldsSetViaReflection(message);
- }
-
- public void testExtensionReflectionSetters() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- extensionsReflectionTester.setAllFieldsViaReflection(builder);
- TestUtil.assertAllExtensionsSet(builder);
-
- TestAllExtensions message = builder.build();
- TestUtil.assertAllExtensionsSet(message);
- }
-
- public void testExtensionReflectionSettersRejectNull() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- extensionsReflectionTester.assertReflectionSettersRejectNull(builder);
- }
-
- public void testExtensionReflectionRepeatedSetters() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- extensionsReflectionTester.setAllFieldsViaReflection(builder);
- extensionsReflectionTester.modifyRepeatedFieldsViaReflection(builder);
- TestUtil.assertRepeatedExtensionsModified(builder);
-
- TestAllExtensions message = builder.build();
- TestUtil.assertRepeatedExtensionsModified(message);
- }
-
- public void testExtensionReflectionRepeatedSettersRejectNull()
- throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- extensionsReflectionTester.assertReflectionRepeatedSettersRejectNull(
- builder);
- }
-
- public void testExtensionReflectionDefaults() throws Exception {
- extensionsReflectionTester.assertClearViaReflection(
- TestAllExtensions.getDefaultInstance());
- extensionsReflectionTester.assertClearViaReflection(
- TestAllExtensions.newBuilder().build());
- }
-
- public void testClearExtension() throws Exception {
- // clearExtension() is not actually used in TestUtil, so try it manually.
- assertFalse(
- TestAllExtensions.newBuilder()
- .setExtension(UnittestProto.optionalInt32Extension, 1)
- .clearExtension(UnittestProto.optionalInt32Extension)
- .hasExtension(UnittestProto.optionalInt32Extension));
- assertEquals(0,
- TestAllExtensions.newBuilder()
- .addExtension(UnittestProto.repeatedInt32Extension, 1)
- .clearExtension(UnittestProto.repeatedInt32Extension)
- .getExtensionCount(UnittestProto.repeatedInt32Extension));
- }
-
- public void testExtensionCopy() throws Exception {
- TestAllExtensions original = TestUtil.getAllExtensionsSet();
- TestAllExtensions copy = TestAllExtensions.newBuilder(original).build();
- TestUtil.assertAllExtensionsSet(copy);
- }
-
- public void testExtensionMergeFrom() throws Exception {
- TestAllExtensions original =
- TestAllExtensions.newBuilder()
- .setExtension(UnittestProto.optionalInt32Extension, 1).build();
- TestAllExtensions merged =
- TestAllExtensions.newBuilder().mergeFrom(original).build();
- assertTrue(merged.hasExtension(UnittestProto.optionalInt32Extension));
- assertEquals(
- 1, (int) merged.getExtension(UnittestProto.optionalInt32Extension));
- }
-
- // =================================================================
- // multiple_files_test
-
- public void testMultipleFilesOption() throws Exception {
- // We mostly just want to check that things compile.
- MessageWithNoOuter message =
- MessageWithNoOuter.newBuilder()
- .setNested(MessageWithNoOuter.NestedMessage.newBuilder().setI(1))
- .addForeign(TestAllTypes.newBuilder().setOptionalInt32(1))
- .setNestedEnum(MessageWithNoOuter.NestedEnum.BAZ)
- .setForeignEnum(EnumWithNoOuter.BAR)
- .build();
- assertEquals(message, MessageWithNoOuter.parseFrom(message.toByteString()));
-
- assertEquals(MultipleFilesTestProto.getDescriptor(),
- MessageWithNoOuter.getDescriptor().getFile());
-
- Descriptors.FieldDescriptor field =
- MessageWithNoOuter.getDescriptor().findFieldByName("foreign_enum");
- assertEquals(EnumWithNoOuter.BAR.getValueDescriptor(),
- message.getField(field));
-
- assertEquals(MultipleFilesTestProto.getDescriptor(),
- ServiceWithNoOuter.getDescriptor().getFile());
-
- assertFalse(
- TestAllExtensions.getDefaultInstance().hasExtension(
- MultipleFilesTestProto.extensionWithOuter));
- }
-
- public void testOptionalFieldWithRequiredSubfieldsOptimizedForSize()
- throws Exception {
- TestOptionalOptimizedForSize message =
- TestOptionalOptimizedForSize.getDefaultInstance();
- assertTrue(message.isInitialized());
-
- message = TestOptionalOptimizedForSize.newBuilder().setO(
- TestRequiredOptimizedForSize.newBuilder().buildPartial()
- ).buildPartial();
- assertFalse(message.isInitialized());
-
- message = TestOptionalOptimizedForSize.newBuilder().setO(
- TestRequiredOptimizedForSize.newBuilder().setX(5).buildPartial()
- ).buildPartial();
- assertTrue(message.isInitialized());
- }
-
- public void testUninitializedExtensionInOptimizedForSize()
- throws Exception {
- TestOptimizedForSize.Builder builder = TestOptimizedForSize.newBuilder();
- builder.setExtension(TestOptimizedForSize.testExtension2,
- TestRequiredOptimizedForSize.newBuilder().buildPartial());
- assertFalse(builder.isInitialized());
- assertFalse(builder.buildPartial().isInitialized());
-
- builder = TestOptimizedForSize.newBuilder();
- builder.setExtension(TestOptimizedForSize.testExtension2,
- TestRequiredOptimizedForSize.newBuilder().setX(10).buildPartial());
- assertTrue(builder.isInitialized());
- assertTrue(builder.buildPartial().isInitialized());
- }
-
- public void testToBuilder() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- TestAllTypes message = builder.build();
- TestUtil.assertAllFieldsSet(message);
- TestUtil.assertAllFieldsSet(message.toBuilder().build());
- }
-
- public void testFieldConstantValues() throws Exception {
- assertEquals(TestAllTypes.NestedMessage.BB_FIELD_NUMBER, 1);
- assertEquals(TestAllTypes.OPTIONAL_INT32_FIELD_NUMBER, 1);
- assertEquals(TestAllTypes.OPTIONALGROUP_FIELD_NUMBER, 16);
- assertEquals(TestAllTypes.OPTIONAL_NESTED_MESSAGE_FIELD_NUMBER, 18);
- assertEquals(TestAllTypes.OPTIONAL_NESTED_ENUM_FIELD_NUMBER, 21);
- assertEquals(TestAllTypes.REPEATED_INT32_FIELD_NUMBER, 31);
- assertEquals(TestAllTypes.REPEATEDGROUP_FIELD_NUMBER, 46);
- assertEquals(TestAllTypes.REPEATED_NESTED_MESSAGE_FIELD_NUMBER, 48);
- assertEquals(TestAllTypes.REPEATED_NESTED_ENUM_FIELD_NUMBER, 51);
- }
-
- public void testExtensionConstantValues() throws Exception {
- assertEquals(UnittestProto.TestRequired.SINGLE_FIELD_NUMBER, 1000);
- assertEquals(UnittestProto.TestRequired.MULTI_FIELD_NUMBER, 1001);
- assertEquals(UnittestProto.OPTIONAL_INT32_EXTENSION_FIELD_NUMBER, 1);
- assertEquals(UnittestProto.OPTIONALGROUP_EXTENSION_FIELD_NUMBER, 16);
- assertEquals(
- UnittestProto.OPTIONAL_NESTED_MESSAGE_EXTENSION_FIELD_NUMBER, 18);
- assertEquals(UnittestProto.OPTIONAL_NESTED_ENUM_EXTENSION_FIELD_NUMBER, 21);
- assertEquals(UnittestProto.REPEATED_INT32_EXTENSION_FIELD_NUMBER, 31);
- assertEquals(UnittestProto.REPEATEDGROUP_EXTENSION_FIELD_NUMBER, 46);
- assertEquals(
- UnittestProto.REPEATED_NESTED_MESSAGE_EXTENSION_FIELD_NUMBER, 48);
- assertEquals(UnittestProto.REPEATED_NESTED_ENUM_EXTENSION_FIELD_NUMBER, 51);
- }
-
- public void testRecursiveMessageDefaultInstance() throws Exception {
- UnittestProto.TestRecursiveMessage message =
- UnittestProto.TestRecursiveMessage.getDefaultInstance();
- assertTrue(message != null);
- assertTrue(message.getA() != null);
- assertTrue(message.getA() == message);
- }
-
- public void testSerialize() throws Exception {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestUtil.setAllFields(builder);
- TestAllTypes expected = builder.build();
- ObjectOutputStream out = new ObjectOutputStream(baos);
- try {
- out.writeObject(expected);
- } finally {
- out.close();
- }
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- ObjectInputStream in = new ObjectInputStream(bais);
- TestAllTypes actual = (TestAllTypes) in.readObject();
- assertEquals(expected, actual);
- }
-
- public void testSerializePartial() throws Exception {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestAllTypes expected = builder.buildPartial();
- ObjectOutputStream out = new ObjectOutputStream(baos);
- try {
- out.writeObject(expected);
- } finally {
- out.close();
- }
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- ObjectInputStream in = new ObjectInputStream(bais);
- TestAllTypes actual = (TestAllTypes) in.readObject();
- assertEquals(expected, actual);
- }
-
- public void testEnumValues() {
- assertEquals(
- TestAllTypes.NestedEnum.BAR.getNumber(),
- TestAllTypes.NestedEnum.BAR_VALUE);
- assertEquals(
- TestAllTypes.NestedEnum.BAZ.getNumber(),
- TestAllTypes.NestedEnum.BAZ_VALUE);
- assertEquals(
- TestAllTypes.NestedEnum.FOO.getNumber(),
- TestAllTypes.NestedEnum.FOO_VALUE);
- }
-
- public void testNonNestedExtensionInitialization() {
- assertTrue(NonNestedExtension.nonNestedExtension
- .getMessageDefaultInstance() instanceof MyNonNestedExtension);
- assertEquals("nonNestedExtension",
- NonNestedExtension.nonNestedExtension.getDescriptor().getName());
- }
-
- public void testNestedExtensionInitialization() {
- assertTrue(MyNestedExtension.recursiveExtension.getMessageDefaultInstance()
- instanceof MessageToBeExtended);
- assertEquals("recursiveExtension",
- MyNestedExtension.recursiveExtension.getDescriptor().getName());
- }
-
-
- public void testBaseMessageOrBuilder() {
- // Mostly just makes sure the base interface exists and has some methods.
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestAllTypes message = builder.buildPartial();
- TestAllTypesOrBuilder builderAsInterface = (TestAllTypesOrBuilder) builder;
- TestAllTypesOrBuilder messageAsInterface = (TestAllTypesOrBuilder) message;
-
- assertEquals(
- messageAsInterface.getDefaultBool(),
- messageAsInterface.getDefaultBool());
- assertEquals(
- messageAsInterface.getOptionalDouble(),
- messageAsInterface.getOptionalDouble());
- }
-
- public void testMessageOrBuilderGetters() {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
-
- // single fields
- assertSame(ForeignMessage.getDefaultInstance(),
- builder.getOptionalForeignMessageOrBuilder());
- ForeignMessage.Builder subBuilder =
- builder.getOptionalForeignMessageBuilder();
- assertSame(subBuilder, builder.getOptionalForeignMessageOrBuilder());
-
- // repeated fields
- ForeignMessage m0 = ForeignMessage.newBuilder().buildPartial();
- ForeignMessage m1 = ForeignMessage.newBuilder().buildPartial();
- ForeignMessage m2 = ForeignMessage.newBuilder().buildPartial();
- builder.addRepeatedForeignMessage(m0);
- builder.addRepeatedForeignMessage(m1);
- builder.addRepeatedForeignMessage(m2);
- assertSame(m0, builder.getRepeatedForeignMessageOrBuilder(0));
- assertSame(m1, builder.getRepeatedForeignMessageOrBuilder(1));
- assertSame(m2, builder.getRepeatedForeignMessageOrBuilder(2));
- ForeignMessage.Builder b0 = builder.getRepeatedForeignMessageBuilder(0);
- ForeignMessage.Builder b1 = builder.getRepeatedForeignMessageBuilder(1);
- assertSame(b0, builder.getRepeatedForeignMessageOrBuilder(0));
- assertSame(b1, builder.getRepeatedForeignMessageOrBuilder(1));
- assertSame(m2, builder.getRepeatedForeignMessageOrBuilder(2));
-
- List<? extends ForeignMessageOrBuilder> messageOrBuilderList =
- builder.getRepeatedForeignMessageOrBuilderList();
- assertSame(b0, messageOrBuilderList.get(0));
- assertSame(b1, messageOrBuilderList.get(1));
- assertSame(m2, messageOrBuilderList.get(2));
- }
-
- public void testGetFieldBuilder() {
- Descriptor descriptor = TestAllTypes.getDescriptor();
-
- FieldDescriptor fieldDescriptor =
- descriptor.findFieldByName("optional_nested_message");
- FieldDescriptor foreignFieldDescriptor =
- descriptor.findFieldByName("optional_foreign_message");
- FieldDescriptor importFieldDescriptor =
- descriptor.findFieldByName("optional_import_message");
-
- // Mutate the message with new field builder
- // Mutate nested message
- TestAllTypes.Builder builder1 = TestAllTypes.newBuilder();
- Message.Builder fieldBuilder1 = builder1.newBuilderForField(fieldDescriptor)
- .mergeFrom((Message) builder1.getField(fieldDescriptor));
- FieldDescriptor subFieldDescriptor1 =
- fieldBuilder1.getDescriptorForType().findFieldByName("bb");
- fieldBuilder1.setField(subFieldDescriptor1, 1);
- builder1.setField(fieldDescriptor, fieldBuilder1.build());
-
- // Mutate foreign message
- Message.Builder foreignFieldBuilder1 = builder1.newBuilderForField(
- foreignFieldDescriptor)
- .mergeFrom((Message) builder1.getField(foreignFieldDescriptor));
- FieldDescriptor subForeignFieldDescriptor1 =
- foreignFieldBuilder1.getDescriptorForType().findFieldByName("c");
- foreignFieldBuilder1.setField(subForeignFieldDescriptor1, 2);
- builder1.setField(foreignFieldDescriptor, foreignFieldBuilder1.build());
-
- // Mutate import message
- Message.Builder importFieldBuilder1 = builder1.newBuilderForField(
- importFieldDescriptor)
- .mergeFrom((Message) builder1.getField(importFieldDescriptor));
- FieldDescriptor subImportFieldDescriptor1 =
- importFieldBuilder1.getDescriptorForType().findFieldByName("d");
- importFieldBuilder1.setField(subImportFieldDescriptor1, 3);
- builder1.setField(importFieldDescriptor, importFieldBuilder1.build());
-
- Message newMessage1 = builder1.build();
-
- // Mutate the message with existing field builder
- // Mutate nested message
- TestAllTypes.Builder builder2 = TestAllTypes.newBuilder();
- Message.Builder fieldBuilder2 = builder2.getFieldBuilder(fieldDescriptor);
- FieldDescriptor subFieldDescriptor2 =
- fieldBuilder2.getDescriptorForType().findFieldByName("bb");
- fieldBuilder2.setField(subFieldDescriptor2, 1);
- builder2.setField(fieldDescriptor, fieldBuilder2.build());
-
- // Mutate foreign message
- Message.Builder foreignFieldBuilder2 = builder2.newBuilderForField(
- foreignFieldDescriptor)
- .mergeFrom((Message) builder2.getField(foreignFieldDescriptor));
- FieldDescriptor subForeignFieldDescriptor2 =
- foreignFieldBuilder2.getDescriptorForType().findFieldByName("c");
- foreignFieldBuilder2.setField(subForeignFieldDescriptor2, 2);
- builder2.setField(foreignFieldDescriptor, foreignFieldBuilder2.build());
-
- // Mutate import message
- Message.Builder importFieldBuilder2 = builder2.newBuilderForField(
- importFieldDescriptor)
- .mergeFrom((Message) builder2.getField(importFieldDescriptor));
- FieldDescriptor subImportFieldDescriptor2 =
- importFieldBuilder2.getDescriptorForType().findFieldByName("d");
- importFieldBuilder2.setField(subImportFieldDescriptor2, 3);
- builder2.setField(importFieldDescriptor, importFieldBuilder2.build());
-
- Message newMessage2 = builder2.build();
-
- // These two messages should be equal.
- assertEquals(newMessage1, newMessage2);
- }
-
- public void testGetFieldBuilderWithInitializedValue() {
- Descriptor descriptor = TestAllTypes.getDescriptor();
- FieldDescriptor fieldDescriptor =
- descriptor.findFieldByName("optional_nested_message");
-
- // Before setting field, builder is initialized by default value.
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- NestedMessage.Builder fieldBuilder =
- (NestedMessage.Builder) builder.getFieldBuilder(fieldDescriptor);
- assertEquals(0, fieldBuilder.getBb());
-
- // Setting field value with new field builder instance.
- builder = TestAllTypes.newBuilder();
- NestedMessage.Builder newFieldBuilder =
- builder.getOptionalNestedMessageBuilder();
- newFieldBuilder.setBb(2);
- // Then get the field builder instance by getFieldBuilder().
- fieldBuilder =
- (NestedMessage.Builder) builder.getFieldBuilder(fieldDescriptor);
- // It should contain new value.
- assertEquals(2, fieldBuilder.getBb());
- // These two builder should be equal.
- assertSame(fieldBuilder, newFieldBuilder);
- }
-
- public void testGetFieldBuilderNotSupportedException() {
- Descriptor descriptor = TestAllTypes.getDescriptor();
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- try {
- builder.getFieldBuilder(descriptor.findFieldByName("optional_int32"));
- fail("Exception was not thrown");
- } catch (UnsupportedOperationException e) {
- // We expect this exception.
- }
- try {
- builder.getFieldBuilder(
- descriptor.findFieldByName("optional_nested_enum"));
- fail("Exception was not thrown");
- } catch (UnsupportedOperationException e) {
- // We expect this exception.
- }
- try {
- builder.getFieldBuilder(descriptor.findFieldByName("repeated_int32"));
- fail("Exception was not thrown");
- } catch (UnsupportedOperationException e) {
- // We expect this exception.
- }
- try {
- builder.getFieldBuilder(
- descriptor.findFieldByName("repeated_nested_enum"));
- fail("Exception was not thrown");
- } catch (UnsupportedOperationException e) {
- // We expect this exception.
- }
- try {
- builder.getFieldBuilder(
- descriptor.findFieldByName("repeated_nested_message"));
- fail("Exception was not thrown");
- } catch (UnsupportedOperationException e) {
- // We expect this exception.
- }
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java
deleted file mode 100644
index 9bc94ee..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringArrayListTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import junit.framework.TestCase;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Tests for {@link LazyStringArrayList}.
- *
- * @author jonp@google.com (Jon Perlow)
- */
-public class LazyStringArrayListTest extends TestCase {
-
- private static String STRING_A = "A";
- private static String STRING_B = "B";
- private static String STRING_C = "C";
-
- private static ByteString BYTE_STRING_A = ByteString.copyFromUtf8("A");
- private static ByteString BYTE_STRING_B = ByteString.copyFromUtf8("B");
- private static ByteString BYTE_STRING_C = ByteString.copyFromUtf8("C");
-
- public void testJustStrings() {
- LazyStringArrayList list = new LazyStringArrayList();
- list.add(STRING_A);
- list.add(STRING_B);
- list.add(STRING_C);
-
- assertEquals(3, list.size());
- assertSame(STRING_A, list.get(0));
- assertSame(STRING_B, list.get(1));
- assertSame(STRING_C, list.get(2));
-
- list.set(1, STRING_C);
- assertSame(STRING_C, list.get(1));
-
- list.remove(1);
- assertSame(STRING_A, list.get(0));
- assertSame(STRING_C, list.get(1));
- }
-
- public void testJustByteString() {
- LazyStringArrayList list = new LazyStringArrayList();
- list.add(BYTE_STRING_A);
- list.add(BYTE_STRING_B);
- list.add(BYTE_STRING_C);
-
- assertEquals(3, list.size());
- assertSame(BYTE_STRING_A, list.getByteString(0));
- assertSame(BYTE_STRING_B, list.getByteString(1));
- assertSame(BYTE_STRING_C, list.getByteString(2));
-
- list.remove(1);
- assertSame(BYTE_STRING_A, list.getByteString(0));
- assertSame(BYTE_STRING_C, list.getByteString(1));
- }
-
- public void testConversionBackAndForth() {
- LazyStringArrayList list = new LazyStringArrayList();
- list.add(STRING_A);
- list.add(BYTE_STRING_B);
- list.add(BYTE_STRING_C);
-
- // String a should be the same because it was originally a string
- assertSame(STRING_A, list.get(0));
-
- // String b and c should be different because the string has to be computed
- // from the ByteString
- String bPrime = list.get(1);
- assertNotSame(STRING_B, bPrime);
- assertEquals(STRING_B, bPrime);
- String cPrime = list.get(2);
- assertNotSame(STRING_C, cPrime);
- assertEquals(STRING_C, cPrime);
-
- // String c and c should stay the same once cached.
- assertSame(bPrime, list.get(1));
- assertSame(cPrime, list.get(2));
-
- // ByteString needs to be computed from string for both a and b
- ByteString aPrimeByteString = list.getByteString(0);
- assertEquals(BYTE_STRING_A, aPrimeByteString);
- ByteString bPrimeByteString = list.getByteString(1);
- assertNotSame(BYTE_STRING_B, bPrimeByteString);
- assertEquals(BYTE_STRING_B, list.getByteString(1));
-
- // Once cached, ByteString should stay cached.
- assertSame(aPrimeByteString, list.getByteString(0));
- assertSame(bPrimeByteString, list.getByteString(1));
- }
-
- public void testCopyConstructorCopiesByReference() {
- LazyStringArrayList list1 = new LazyStringArrayList();
- list1.add(STRING_A);
- list1.add(BYTE_STRING_B);
- list1.add(BYTE_STRING_C);
-
- LazyStringArrayList list2 = new LazyStringArrayList(list1);
- assertEquals(3, list2.size());
- assertSame(STRING_A, list2.get(0));
- assertSame(BYTE_STRING_B, list2.getByteString(1));
- assertSame(BYTE_STRING_C, list2.getByteString(2));
- }
-
- public void testListCopyConstructor() {
- List<String> list1 = new ArrayList<String>();
- list1.add(STRING_A);
- list1.add(STRING_B);
- list1.add(STRING_C);
-
- LazyStringArrayList list2 = new LazyStringArrayList(list1);
- assertEquals(3, list2.size());
- assertSame(STRING_A, list2.get(0));
- assertSame(STRING_B, list2.get(1));
- assertSame(STRING_C, list2.get(2));
- }
-
- public void testAddAllCopiesByReferenceIfPossible() {
- LazyStringArrayList list1 = new LazyStringArrayList();
- list1.add(STRING_A);
- list1.add(BYTE_STRING_B);
- list1.add(BYTE_STRING_C);
-
- LazyStringArrayList list2 = new LazyStringArrayList();
- list2.addAll(list1);
-
- assertEquals(3, list2.size());
- assertSame(STRING_A, list2.get(0));
- assertSame(BYTE_STRING_B, list2.getByteString(1));
- assertSame(BYTE_STRING_C, list2.getByteString(2));
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java
deleted file mode 100644
index e21e038..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LazyStringEndToEndTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-
-import protobuf_unittest.UnittestProto;
-
-import junit.framework.TestCase;
-
-import java.io.IOException;
-
-/**
- * Tests to make sure the lazy conversion of UTF8-encoded byte arrays to
- * strings works correctly.
- *
- * @author jonp@google.com (Jon Perlow)
- */
-public class LazyStringEndToEndTest extends TestCase {
-
- private static ByteString TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8 =
- ByteString.copyFrom(new byte[] {
- 114, 4, -1, 0, -1, 0, -30, 2, 4, -1,
- 0, -1, 0, -30, 2, 4, -1, 0, -1, 0, });
-
- private ByteString encodedTestAllTypes;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.encodedTestAllTypes = UnittestProto.TestAllTypes.newBuilder()
- .setOptionalString("foo")
- .addRepeatedString("bar")
- .addRepeatedString("baz")
- .build()
- .toByteString();
- }
-
- /**
- * Tests that an invalid UTF8 string will roundtrip through a parse
- * and serialization.
- */
- public void testParseAndSerialize() throws InvalidProtocolBufferException {
- UnittestProto.TestAllTypes tV2 = UnittestProto.TestAllTypes.parseFrom(
- TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8);
- ByteString bytes = tV2.toByteString();
- assertEquals(TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8, bytes);
-
- tV2.getOptionalString();
- bytes = tV2.toByteString();
- assertEquals(TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8, bytes);
- }
-
- public void testParseAndWrite() throws IOException {
- UnittestProto.TestAllTypes tV2 = UnittestProto.TestAllTypes.parseFrom(
- TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8);
- byte[] sink = new byte[TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8.size()];
- CodedOutputStream outputStream = CodedOutputStream.newInstance(sink);
- tV2.writeTo(outputStream);
- outputStream.flush();
- assertEquals(
- TEST_ALL_TYPES_SERIALIZED_WITH_ILLEGAL_UTF8,
- ByteString.copyFrom(sink));
- }
-
- public void testNoStringCachingIfOnlyBytesAccessed() throws Exception {
- UnittestProto.TestAllTypes proto =
- UnittestProto.TestAllTypes.parseFrom(encodedTestAllTypes);
- ByteString optional = proto.getOptionalStringBytes();
- assertSame(optional, proto.getOptionalStringBytes());
- assertSame(optional, proto.toBuilder().getOptionalStringBytes());
-
- ByteString repeated0 = proto.getRepeatedStringBytes(0);
- ByteString repeated1 = proto.getRepeatedStringBytes(1);
- assertSame(repeated0, proto.getRepeatedStringBytes(0));
- assertSame(repeated1, proto.getRepeatedStringBytes(1));
- assertSame(repeated0, proto.toBuilder().getRepeatedStringBytes(0));
- assertSame(repeated1, proto.toBuilder().getRepeatedStringBytes(1));
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java
deleted file mode 100644
index d2ce563..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/LiteralByteStringTest.java
+++ /dev/null
@@ -1,344 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-/**
- * Test {@link LiteralByteString} by setting up a reference string in {@link #setUp()}.
- * This class is designed to be extended for testing extensions of {@link LiteralByteString}
- * such as {@link BoundedByteString}, see {@link BoundedByteStringTest}.
- *
- * @author carlanton@google.com (Carl Haverl)
- */
-public class LiteralByteStringTest extends TestCase {
- protected static final String UTF_8 = "UTF-8";
-
- protected String classUnderTest;
- protected byte[] referenceBytes;
- protected ByteString stringUnderTest;
- protected int expectedHashCode;
-
- @Override
- protected void setUp() throws Exception {
- classUnderTest = "LiteralByteString";
- referenceBytes = ByteStringTest.getTestBytes(1234, 11337766L);
- stringUnderTest = ByteString.copyFrom(referenceBytes);
- expectedHashCode = 331161852;
- }
-
- protected String getActualClassName(Object object) {
- String actualClassName = object.getClass().getName();
- actualClassName = actualClassName.substring(actualClassName.lastIndexOf('.') + 1);
- return actualClassName;
- }
-
- public void testByteAt() {
- boolean stillEqual = true;
- for (int i = 0; stillEqual && i < referenceBytes.length; ++i) {
- stillEqual = (referenceBytes[i] == stringUnderTest.byteAt(i));
- }
- assertTrue(classUnderTest + " must capture the right bytes", stillEqual);
- }
-
- public void testByteIterator() {
- boolean stillEqual = true;
- ByteString.ByteIterator iter = stringUnderTest.iterator();
- for (int i = 0; stillEqual && i < referenceBytes.length; ++i) {
- stillEqual = (iter.hasNext() && referenceBytes[i] == iter.nextByte());
- }
- assertTrue(classUnderTest + " must capture the right bytes", stillEqual);
- assertFalse(classUnderTest + " must have exhausted the iterator", iter.hasNext());
-
- try {
- iter.nextByte();
- fail("Should have thrown an exception.");
- } catch (NoSuchElementException e) {
- // This is success
- }
- }
-
- public void testByteIterable() {
- boolean stillEqual = true;
- int j = 0;
- for (byte quantum : stringUnderTest) {
- stillEqual = (referenceBytes[j] == quantum);
- ++j;
- }
- assertTrue(classUnderTest + " must capture the right bytes as Bytes", stillEqual);
- assertEquals(classUnderTest + " iterable character count", referenceBytes.length, j);
- }
-
- public void testSize() {
- assertEquals(classUnderTest + " must have the expected size", referenceBytes.length,
- stringUnderTest.size());
- }
-
- public void testCopyTo_ByteArrayOffsetLength() {
- int destinationOffset = 50;
- int length = 100;
- byte[] destination = new byte[destinationOffset + length];
- int sourceOffset = 213;
- stringUnderTest.copyTo(destination, sourceOffset, destinationOffset, length);
- boolean stillEqual = true;
- for (int i = 0; stillEqual && i < length; ++i) {
- stillEqual = referenceBytes[i + sourceOffset] == destination[i + destinationOffset];
- }
- assertTrue(classUnderTest + ".copyTo(4 arg) must give the expected bytes", stillEqual);
- }
-
- public void testCopyTo_ByteArrayOffsetLengthErrors() {
- int destinationOffset = 50;
- int length = 100;
- byte[] destination = new byte[destinationOffset + length];
-
- try {
- // Copy one too many bytes
- stringUnderTest.copyTo(destination, stringUnderTest.size() + 1 - length,
- destinationOffset, length);
- fail("Should have thrown an exception when copying too many bytes of a "
- + classUnderTest);
- } catch (IndexOutOfBoundsException expected) {
- // This is success
- }
-
- try {
- // Copy with illegal negative sourceOffset
- stringUnderTest.copyTo(destination, -1, destinationOffset, length);
- fail("Should have thrown an exception when given a negative sourceOffset in "
- + classUnderTest);
- } catch (IndexOutOfBoundsException expected) {
- // This is success
- }
-
- try {
- // Copy with illegal negative destinationOffset
- stringUnderTest.copyTo(destination, 0, -1, length);
- fail("Should have thrown an exception when given a negative destinationOffset in "
- + classUnderTest);
- } catch (IndexOutOfBoundsException expected) {
- // This is success
- }
-
- try {
- // Copy with illegal negative size
- stringUnderTest.copyTo(destination, 0, 0, -1);
- fail("Should have thrown an exception when given a negative size in "
- + classUnderTest);
- } catch (IndexOutOfBoundsException expected) {
- // This is success
- }
-
- try {
- // Copy with illegal too-large sourceOffset
- stringUnderTest.copyTo(destination, 2 * stringUnderTest.size(), 0, length);
- fail("Should have thrown an exception when the destinationOffset is too large in "
- + classUnderTest);
- } catch (IndexOutOfBoundsException expected) {
- // This is success
- }
-
- try {
- // Copy with illegal too-large destinationOffset
- stringUnderTest.copyTo(destination, 0, 2 * destination.length, length);
- fail("Should have thrown an exception when the destinationOffset is too large in "
- + classUnderTest);
- } catch (IndexOutOfBoundsException expected) {
- // This is success
- }
- }
-
- public void testCopyTo_ByteBuffer() {
- ByteBuffer myBuffer = ByteBuffer.allocate(referenceBytes.length);
- stringUnderTest.copyTo(myBuffer);
- assertTrue(classUnderTest + ".copyTo(ByteBuffer) must give back the same bytes",
- Arrays.equals(referenceBytes, myBuffer.array()));
- }
-
- public void testAsReadOnlyByteBuffer() {
- ByteBuffer byteBuffer = stringUnderTest.asReadOnlyByteBuffer();
- byte[] roundTripBytes = new byte[referenceBytes.length];
- assertTrue(byteBuffer.remaining() == referenceBytes.length);
- assertTrue(byteBuffer.isReadOnly());
- byteBuffer.get(roundTripBytes);
- assertTrue(classUnderTest + ".asReadOnlyByteBuffer() must give back the same bytes",
- Arrays.equals(referenceBytes, roundTripBytes));
- }
-
- public void testAsReadOnlyByteBufferList() {
- List<ByteBuffer> byteBuffers = stringUnderTest.asReadOnlyByteBufferList();
- int bytesSeen = 0;
- byte[] roundTripBytes = new byte[referenceBytes.length];
- for (ByteBuffer byteBuffer : byteBuffers) {
- int thisLength = byteBuffer.remaining();
- assertTrue(byteBuffer.isReadOnly());
- assertTrue(bytesSeen + thisLength <= referenceBytes.length);
- byteBuffer.get(roundTripBytes, bytesSeen, thisLength);
- bytesSeen += thisLength;
- }
- assertTrue(bytesSeen == referenceBytes.length);
- assertTrue(classUnderTest + ".asReadOnlyByteBufferTest() must give back the same bytes",
- Arrays.equals(referenceBytes, roundTripBytes));
- }
-
- public void testToByteArray() {
- byte[] roundTripBytes = stringUnderTest.toByteArray();
- assertTrue(classUnderTest + ".toByteArray() must give back the same bytes",
- Arrays.equals(referenceBytes, roundTripBytes));
- }
-
- public void testWriteTo() throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- stringUnderTest.writeTo(bos);
- byte[] roundTripBytes = bos.toByteArray();
- assertTrue(classUnderTest + ".writeTo() must give back the same bytes",
- Arrays.equals(referenceBytes, roundTripBytes));
- }
-
- public void testWriteTo_mutating() throws IOException {
- OutputStream os = new OutputStream() {
- @Override
- public void write(byte[] b, int off, int len) {
- for (int x = 0; x < len; ++x) {
- b[off + x] = (byte) 0;
- }
- }
-
- @Override
- public void write(int b) {
- // Purposefully left blank.
- }
- };
-
- stringUnderTest.writeTo(os);
- byte[] newBytes = stringUnderTest.toByteArray();
- assertTrue(classUnderTest + ".writeTo() must not grant access to underlying array",
- Arrays.equals(referenceBytes, newBytes));
- }
-
- public void testNewOutput() throws IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ByteString.Output output = ByteString.newOutput();
- stringUnderTest.writeTo(output);
- assertEquals("Output Size returns correct result",
- output.size(), stringUnderTest.size());
- output.writeTo(bos);
- assertTrue("Output.writeTo() must give back the same bytes",
- Arrays.equals(referenceBytes, bos.toByteArray()));
-
- // write the output stream to itself! This should cause it to double
- output.writeTo(output);
- assertEquals("Writing an output stream to itself is successful",
- stringUnderTest.concat(stringUnderTest), output.toByteString());
-
- output.reset();
- assertEquals("Output.reset() resets the output", 0, output.size());
- assertEquals("Output.reset() resets the output",
- ByteString.EMPTY, output.toByteString());
-
- }
-
- public void testHashCode() {
- int hash = stringUnderTest.hashCode();
- assertEquals(classUnderTest + " must have expected hashCode", expectedHashCode, hash);
- }
-
- public void testNewInput() throws IOException {
- InputStream input = stringUnderTest.newInput();
- assertEquals("InputStream.available() returns correct value",
- stringUnderTest.size(), input.available());
- boolean stillEqual = true;
- for (byte referenceByte : referenceBytes) {
- int expectedInt = (referenceByte & 0xFF);
- stillEqual = (expectedInt == input.read());
- }
- assertEquals("InputStream.available() returns correct value",
- 0, input.available());
- assertTrue(classUnderTest + " must give the same bytes from the InputStream", stillEqual);
- assertEquals(classUnderTest + " InputStream must now be exhausted", -1, input.read());
- }
-
- public void testNewInput_skip() throws IOException {
- InputStream input = stringUnderTest.newInput();
- int stringSize = stringUnderTest.size();
- int nearEndIndex = stringSize * 2 / 3;
- long skipped1 = input.skip(nearEndIndex);
- assertEquals("InputStream.skip()", skipped1, nearEndIndex);
- assertEquals("InputStream.available()",
- stringSize - skipped1, input.available());
- assertTrue("InputStream.mark() is available", input.markSupported());
- input.mark(0);
- assertEquals("InputStream.skip(), read()",
- stringUnderTest.byteAt(nearEndIndex) & 0xFF, input.read());
- assertEquals("InputStream.available()",
- stringSize - skipped1 - 1, input.available());
- long skipped2 = input.skip(stringSize);
- assertEquals("InputStream.skip() incomplete",
- skipped2, stringSize - skipped1 - 1);
- assertEquals("InputStream.skip(), no more input", 0, input.available());
- assertEquals("InputStream.skip(), no more input", -1, input.read());
- input.reset();
- assertEquals("InputStream.reset() succeeded",
- stringSize - skipped1, input.available());
- assertEquals("InputStream.reset(), read()",
- stringUnderTest.byteAt(nearEndIndex) & 0xFF, input.read());
- }
-
- public void testNewCodedInput() throws IOException {
- CodedInputStream cis = stringUnderTest.newCodedInput();
- byte[] roundTripBytes = cis.readRawBytes(referenceBytes.length);
- assertTrue(classUnderTest + " must give the same bytes back from the CodedInputStream",
- Arrays.equals(referenceBytes, roundTripBytes));
- assertTrue(classUnderTest + " CodedInputStream must now be exhausted", cis.isAtEnd());
- }
-
- /**
- * Make sure we keep things simple when concatenating with empty. See also
- * {@link ByteStringTest#testConcat_empty()}.
- */
- public void testConcat_empty() {
- assertSame(classUnderTest + " concatenated with empty must give " + classUnderTest,
- stringUnderTest.concat(ByteString.EMPTY), stringUnderTest);
- assertSame("empty concatenated with " + classUnderTest + " must give " + classUnderTest,
- ByteString.EMPTY.concat(stringUnderTest), stringUnderTest);
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java
deleted file mode 100644
index 629cabc..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/MessageTest.java
+++ /dev/null
@@ -1,354 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestRequired;
-import protobuf_unittest.UnittestProto.TestRequiredForeign;
-import protobuf_unittest.UnittestProto.ForeignMessage;
-
-import junit.framework.TestCase;
-
-import java.util.List;
-
-/**
- * Misc. unit tests for message operations that apply to both generated
- * and dynamic messages.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class MessageTest extends TestCase {
- // =================================================================
- // Message-merging tests.
-
- static final TestAllTypes MERGE_SOURCE =
- TestAllTypes.newBuilder()
- .setOptionalInt32(1)
- .setOptionalString("foo")
- .setOptionalForeignMessage(ForeignMessage.getDefaultInstance())
- .addRepeatedString("bar")
- .build();
-
- static final TestAllTypes MERGE_DEST =
- TestAllTypes.newBuilder()
- .setOptionalInt64(2)
- .setOptionalString("baz")
- .setOptionalForeignMessage(ForeignMessage.newBuilder().setC(3).build())
- .addRepeatedString("qux")
- .build();
-
- static final String MERGE_RESULT_TEXT =
- "optional_int32: 1\n" +
- "optional_int64: 2\n" +
- "optional_string: \"foo\"\n" +
- "optional_foreign_message {\n" +
- " c: 3\n" +
- "}\n" +
- "repeated_string: \"qux\"\n" +
- "repeated_string: \"bar\"\n";
-
- public void testMergeFrom() throws Exception {
- TestAllTypes result =
- TestAllTypes.newBuilder(MERGE_DEST)
- .mergeFrom(MERGE_SOURCE).build();
-
- assertEquals(MERGE_RESULT_TEXT, result.toString());
- }
-
- /**
- * Test merging a DynamicMessage into a GeneratedMessage. As long as they
- * have the same descriptor, this should work, but it is an entirely different
- * code path.
- */
- public void testMergeFromDynamic() throws Exception {
- TestAllTypes result =
- TestAllTypes.newBuilder(MERGE_DEST)
- .mergeFrom(DynamicMessage.newBuilder(MERGE_SOURCE).build())
- .build();
-
- assertEquals(MERGE_RESULT_TEXT, result.toString());
- }
-
- /** Test merging two DynamicMessages. */
- public void testDynamicMergeFrom() throws Exception {
- DynamicMessage result =
- DynamicMessage.newBuilder(MERGE_DEST)
- .mergeFrom(DynamicMessage.newBuilder(MERGE_SOURCE).build())
- .build();
-
- assertEquals(MERGE_RESULT_TEXT, result.toString());
- }
-
- // =================================================================
- // Required-field-related tests.
-
- private static final TestRequired TEST_REQUIRED_UNINITIALIZED =
- TestRequired.getDefaultInstance();
- private static final TestRequired TEST_REQUIRED_INITIALIZED =
- TestRequired.newBuilder().setA(1).setB(2).setC(3).build();
-
- public void testRequired() throws Exception {
- TestRequired.Builder builder = TestRequired.newBuilder();
-
- assertFalse(builder.isInitialized());
- builder.setA(1);
- assertFalse(builder.isInitialized());
- builder.setB(1);
- assertFalse(builder.isInitialized());
- builder.setC(1);
- assertTrue(builder.isInitialized());
- }
-
- public void testRequiredForeign() throws Exception {
- TestRequiredForeign.Builder builder = TestRequiredForeign.newBuilder();
-
- assertTrue(builder.isInitialized());
-
- builder.setOptionalMessage(TEST_REQUIRED_UNINITIALIZED);
- assertFalse(builder.isInitialized());
-
- builder.setOptionalMessage(TEST_REQUIRED_INITIALIZED);
- assertTrue(builder.isInitialized());
-
- builder.addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED);
- assertFalse(builder.isInitialized());
-
- builder.setRepeatedMessage(0, TEST_REQUIRED_INITIALIZED);
- assertTrue(builder.isInitialized());
- }
-
- public void testRequiredExtension() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
-
- assertTrue(builder.isInitialized());
-
- builder.setExtension(TestRequired.single, TEST_REQUIRED_UNINITIALIZED);
- assertFalse(builder.isInitialized());
-
- builder.setExtension(TestRequired.single, TEST_REQUIRED_INITIALIZED);
- assertTrue(builder.isInitialized());
-
- builder.addExtension(TestRequired.multi, TEST_REQUIRED_UNINITIALIZED);
- assertFalse(builder.isInitialized());
-
- builder.setExtension(TestRequired.multi, 0, TEST_REQUIRED_INITIALIZED);
- assertTrue(builder.isInitialized());
- }
-
- public void testRequiredDynamic() throws Exception {
- Descriptors.Descriptor descriptor = TestRequired.getDescriptor();
- DynamicMessage.Builder builder = DynamicMessage.newBuilder(descriptor);
-
- assertFalse(builder.isInitialized());
- builder.setField(descriptor.findFieldByName("a"), 1);
- assertFalse(builder.isInitialized());
- builder.setField(descriptor.findFieldByName("b"), 1);
- assertFalse(builder.isInitialized());
- builder.setField(descriptor.findFieldByName("c"), 1);
- assertTrue(builder.isInitialized());
- }
-
- public void testRequiredDynamicForeign() throws Exception {
- Descriptors.Descriptor descriptor = TestRequiredForeign.getDescriptor();
- DynamicMessage.Builder builder = DynamicMessage.newBuilder(descriptor);
-
- assertTrue(builder.isInitialized());
-
- builder.setField(descriptor.findFieldByName("optional_message"),
- TEST_REQUIRED_UNINITIALIZED);
- assertFalse(builder.isInitialized());
-
- builder.setField(descriptor.findFieldByName("optional_message"),
- TEST_REQUIRED_INITIALIZED);
- assertTrue(builder.isInitialized());
-
- builder.addRepeatedField(descriptor.findFieldByName("repeated_message"),
- TEST_REQUIRED_UNINITIALIZED);
- assertFalse(builder.isInitialized());
-
- builder.setRepeatedField(descriptor.findFieldByName("repeated_message"), 0,
- TEST_REQUIRED_INITIALIZED);
- assertTrue(builder.isInitialized());
- }
-
- public void testUninitializedException() throws Exception {
- try {
- TestRequired.newBuilder().build();
- fail("Should have thrown an exception.");
- } catch (UninitializedMessageException e) {
- assertEquals("Message missing required fields: a, b, c", e.getMessage());
- }
- }
-
- public void testBuildPartial() throws Exception {
- // We're mostly testing that no exception is thrown.
- TestRequired message = TestRequired.newBuilder().buildPartial();
- assertFalse(message.isInitialized());
- }
-
- public void testNestedUninitializedException() throws Exception {
- try {
- TestRequiredForeign.newBuilder()
- .setOptionalMessage(TEST_REQUIRED_UNINITIALIZED)
- .addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED)
- .addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED)
- .build();
- fail("Should have thrown an exception.");
- } catch (UninitializedMessageException e) {
- assertEquals(
- "Message missing required fields: " +
- "optional_message.a, " +
- "optional_message.b, " +
- "optional_message.c, " +
- "repeated_message[0].a, " +
- "repeated_message[0].b, " +
- "repeated_message[0].c, " +
- "repeated_message[1].a, " +
- "repeated_message[1].b, " +
- "repeated_message[1].c",
- e.getMessage());
- }
- }
-
- public void testBuildNestedPartial() throws Exception {
- // We're mostly testing that no exception is thrown.
- TestRequiredForeign message =
- TestRequiredForeign.newBuilder()
- .setOptionalMessage(TEST_REQUIRED_UNINITIALIZED)
- .addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED)
- .addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED)
- .buildPartial();
- assertFalse(message.isInitialized());
- }
-
- public void testParseUnititialized() throws Exception {
- try {
- TestRequired.parseFrom(ByteString.EMPTY);
- fail("Should have thrown an exception.");
- } catch (InvalidProtocolBufferException e) {
- assertEquals("Message missing required fields: a, b, c", e.getMessage());
- }
- }
-
- public void testParseNestedUnititialized() throws Exception {
- ByteString data =
- TestRequiredForeign.newBuilder()
- .setOptionalMessage(TEST_REQUIRED_UNINITIALIZED)
- .addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED)
- .addRepeatedMessage(TEST_REQUIRED_UNINITIALIZED)
- .buildPartial().toByteString();
-
- try {
- TestRequiredForeign.parseFrom(data);
- fail("Should have thrown an exception.");
- } catch (InvalidProtocolBufferException e) {
- assertEquals(
- "Message missing required fields: " +
- "optional_message.a, " +
- "optional_message.b, " +
- "optional_message.c, " +
- "repeated_message[0].a, " +
- "repeated_message[0].b, " +
- "repeated_message[0].c, " +
- "repeated_message[1].a, " +
- "repeated_message[1].b, " +
- "repeated_message[1].c",
- e.getMessage());
- }
- }
-
- public void testDynamicUninitializedException() throws Exception {
- try {
- DynamicMessage.newBuilder(TestRequired.getDescriptor()).build();
- fail("Should have thrown an exception.");
- } catch (UninitializedMessageException e) {
- assertEquals("Message missing required fields: a, b, c", e.getMessage());
- }
- }
-
- public void testDynamicBuildPartial() throws Exception {
- // We're mostly testing that no exception is thrown.
- DynamicMessage message =
- DynamicMessage.newBuilder(TestRequired.getDescriptor())
- .buildPartial();
- assertFalse(message.isInitialized());
- }
-
- public void testDynamicParseUnititialized() throws Exception {
- try {
- Descriptors.Descriptor descriptor = TestRequired.getDescriptor();
- DynamicMessage.parseFrom(descriptor, ByteString.EMPTY);
- fail("Should have thrown an exception.");
- } catch (InvalidProtocolBufferException e) {
- assertEquals("Message missing required fields: a, b, c", e.getMessage());
- }
- }
-
- /** Test reading unset repeated message from DynamicMessage. */
- public void testDynamicRepeatedMessageNull() throws Exception {
- Descriptors.Descriptor descriptor = TestRequired.getDescriptor();
- DynamicMessage result =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor())
- .mergeFrom(DynamicMessage.newBuilder(MERGE_SOURCE).build())
- .build();
-
- assertTrue(result.getField(result.getDescriptorForType()
- .findFieldByName("repeated_foreign_message")) instanceof List<?>);
- assertEquals(result.getRepeatedFieldCount(result.getDescriptorForType()
- .findFieldByName("repeated_foreign_message")), 0);
- }
-
- /** Test reading repeated message from DynamicMessage. */
- public void testDynamicRepeatedMessageNotNull() throws Exception {
-
- TestAllTypes REPEATED_NESTED =
- TestAllTypes.newBuilder()
- .setOptionalInt32(1)
- .setOptionalString("foo")
- .setOptionalForeignMessage(ForeignMessage.getDefaultInstance())
- .addRepeatedString("bar")
- .addRepeatedForeignMessage(ForeignMessage.getDefaultInstance())
- .addRepeatedForeignMessage(ForeignMessage.getDefaultInstance())
- .build();
- Descriptors.Descriptor descriptor = TestRequired.getDescriptor();
- DynamicMessage result =
- DynamicMessage.newBuilder(TestAllTypes.getDescriptor())
- .mergeFrom(DynamicMessage.newBuilder(REPEATED_NESTED).build())
- .build();
-
- assertTrue(result.getField(result.getDescriptorForType()
- .findFieldByName("repeated_foreign_message")) instanceof List<?>);
- assertEquals(result.getRepeatedFieldCount(result.getDescriptorForType()
- .findFieldByName("repeated_foreign_message")), 2);
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java
deleted file mode 100644
index 68d70be..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/NestedBuildersTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.Vehicle;
-import protobuf_unittest.Wheel;
-
-import junit.framework.TestCase;
-
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Test cases that exercise end-to-end use cases involving
- * {@link SingleFieldBuilder} and {@link RepeatedFieldBuilder}.
- *
- * @author jonp@google.com (Jon Perlow)
- */
-public class NestedBuildersTest extends TestCase {
-
- public void testMessagesAndBuilders() {
- Vehicle.Builder vehicleBuilder = Vehicle.newBuilder();
- vehicleBuilder.addWheelBuilder()
- .setRadius(4)
- .setWidth(1);
- vehicleBuilder.addWheelBuilder()
- .setRadius(4)
- .setWidth(2);
- vehicleBuilder.addWheelBuilder()
- .setRadius(4)
- .setWidth(3);
- vehicleBuilder.addWheelBuilder()
- .setRadius(4)
- .setWidth(4);
- vehicleBuilder.getEngineBuilder()
- .setLiters(10);
-
- Vehicle vehicle = vehicleBuilder.build();
- assertEquals(4, vehicle.getWheelCount());
- for (int i = 0; i < 4; i++) {
- Wheel wheel = vehicle.getWheel(i);
- assertEquals(4, wheel.getRadius());
- assertEquals(i + 1, wheel.getWidth());
- }
- assertEquals(10, vehicle.getEngine().getLiters());
-
- for (int i = 0; i < 4; i++) {
- vehicleBuilder.getWheelBuilder(i)
- .setRadius(5)
- .setWidth(i + 10);
- }
- vehicleBuilder.getEngineBuilder().setLiters(20);
-
- vehicle = vehicleBuilder.build();
- for (int i = 0; i < 4; i++) {
- Wheel wheel = vehicle.getWheel(i);
- assertEquals(5, wheel.getRadius());
- assertEquals(i + 10, wheel.getWidth());
- }
- assertEquals(20, vehicle.getEngine().getLiters());
- assertTrue(vehicle.hasEngine());
- }
-
- public void testMessagesAreCached() {
- Vehicle.Builder vehicleBuilder = Vehicle.newBuilder();
- vehicleBuilder.addWheelBuilder()
- .setRadius(1)
- .setWidth(2);
- vehicleBuilder.addWheelBuilder()
- .setRadius(3)
- .setWidth(4);
- vehicleBuilder.addWheelBuilder()
- .setRadius(5)
- .setWidth(6);
- vehicleBuilder.addWheelBuilder()
- .setRadius(7)
- .setWidth(8);
-
- // Make sure messages are cached.
- List<Wheel> wheels = new ArrayList<Wheel>(vehicleBuilder.getWheelList());
- for (int i = 0; i < wheels.size(); i++) {
- assertSame(wheels.get(i), vehicleBuilder.getWheel(i));
- }
-
- // Now get builders and check they didn't change.
- for (int i = 0; i < wheels.size(); i++) {
- vehicleBuilder.getWheel(i);
- }
- for (int i = 0; i < wheels.size(); i++) {
- assertSame(wheels.get(i), vehicleBuilder.getWheel(i));
- }
-
- // Change just one
- vehicleBuilder.getWheelBuilder(3)
- .setRadius(20).setWidth(20);
-
- // Now get wheels and check that only that one changed
- for (int i = 0; i < wheels.size(); i++) {
- if (i < 3) {
- assertSame(wheels.get(i), vehicleBuilder.getWheel(i));
- } else {
- assertNotSame(wheels.get(i), vehicleBuilder.getWheel(i));
- }
- }
- }
-
- public void testRemove_WithNestedBuilders() {
- Vehicle.Builder vehicleBuilder = Vehicle.newBuilder();
- vehicleBuilder.addWheelBuilder()
- .setRadius(1)
- .setWidth(1);
- vehicleBuilder.addWheelBuilder()
- .setRadius(2)
- .setWidth(2);
- vehicleBuilder.removeWheel(0);
-
- assertEquals(1, vehicleBuilder.getWheelCount());
- assertEquals(2, vehicleBuilder.getWheel(0).getRadius());
- }
-
- public void testRemove_WithNestedMessages() {
- Vehicle.Builder vehicleBuilder = Vehicle.newBuilder();
- vehicleBuilder.addWheel(Wheel.newBuilder()
- .setRadius(1)
- .setWidth(1));
- vehicleBuilder.addWheel(Wheel.newBuilder()
- .setRadius(2)
- .setWidth(2));
- vehicleBuilder.removeWheel(0);
-
- assertEquals(1, vehicleBuilder.getWheelCount());
- assertEquals(2, vehicleBuilder.getWheel(0).getRadius());
- }
-
- public void testMerge() {
- Vehicle vehicle1 = Vehicle.newBuilder()
- .addWheel(Wheel.newBuilder().setRadius(1).build())
- .addWheel(Wheel.newBuilder().setRadius(2).build())
- .build();
-
- Vehicle vehicle2 = Vehicle.newBuilder()
- .mergeFrom(vehicle1)
- .build();
- // List should be the same -- no allocation
- assertSame(vehicle1.getWheelList(), vehicle2.getWheelList());
-
- Vehicle vehicle3 = vehicle1.toBuilder().build();
- assertSame(vehicle1.getWheelList(), vehicle3.getWheelList());
- }
-
- public void testGettingBuilderMarksFieldAsHaving() {
- Vehicle.Builder vehicleBuilder = Vehicle.newBuilder();
- vehicleBuilder.getEngineBuilder();
- Vehicle vehicle = vehicleBuilder.buildPartial();
- assertTrue(vehicle.hasEngine());
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java
deleted file mode 100644
index b35af68..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ParserTest.java
+++ /dev/null
@@ -1,278 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestOptimizeFor.TestOptimizedForSize;
-import protobuf_unittest.UnittestOptimizeFor.TestRequiredOptimizedForSize;
-import protobuf_unittest.UnittestOptimizeFor;
-import protobuf_unittest.UnittestProto.ForeignMessage;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestEmptyMessage;
-import protobuf_unittest.UnittestProto.TestRequired;
-import protobuf_unittest.UnittestProto.TestParsingMerge;
-import protobuf_unittest.UnittestProto;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Unit test for {@link Parser}.
- *
- * @author liujisi@google.com (Pherl Liu)
- */
-public class ParserTest extends TestCase {
- public void testGeneratedMessageParserSingleton() throws Exception {
- for (int i = 0; i < 10; i++) {
- assertEquals(TestAllTypes.PARSER,
- TestUtil.getAllSet().getParserForType());
- }
- }
-
- private void assertRoundTripEquals(MessageLite message,
- ExtensionRegistryLite registry)
- throws Exception {
- final byte[] data = message.toByteArray();
- final int offset = 20;
- final int length = data.length;
- final int padding = 30;
- Parser<? extends MessageLite> parser = message.getParserForType();
- assertMessageEquals(message, parser.parseFrom(data, registry));
- assertMessageEquals(message, parser.parseFrom(
- generatePaddingArray(data, offset, padding),
- offset, length, registry));
- assertMessageEquals(message, parser.parseFrom(
- message.toByteString(), registry));
- assertMessageEquals(message, parser.parseFrom(
- new ByteArrayInputStream(data), registry));
- assertMessageEquals(message, parser.parseFrom(
- CodedInputStream.newInstance(data), registry));
- }
-
- private void assertRoundTripEquals(MessageLite message) throws Exception {
- final byte[] data = message.toByteArray();
- final int offset = 20;
- final int length = data.length;
- final int padding = 30;
- Parser<? extends MessageLite> parser = message.getParserForType();
- assertMessageEquals(message, parser.parseFrom(data));
- assertMessageEquals(message, parser.parseFrom(
- generatePaddingArray(data, offset, padding),
- offset, length));
- assertMessageEquals(message, parser.parseFrom(message.toByteString()));
- assertMessageEquals(message, parser.parseFrom(
- new ByteArrayInputStream(data)));
- assertMessageEquals(message, parser.parseFrom(
- CodedInputStream.newInstance(data)));
- }
-
- private void assertMessageEquals(MessageLite expected, MessageLite actual)
- throws Exception {
- if (expected instanceof Message) {
- assertEquals(expected, actual);
- } else {
- assertEquals(expected.toByteString(), actual.toByteString());
- }
- }
-
- private byte[] generatePaddingArray(byte[] data, int offset, int padding) {
- byte[] result = new byte[offset + data.length + padding];
- System.arraycopy(data, 0, result, offset, data.length);
- return result;
- }
-
- public void testNormalMessage() throws Exception {
- assertRoundTripEquals(TestUtil.getAllSet());
- }
-
- public void testParsePartial() throws Exception {
- Parser<TestRequired> parser = TestRequired.PARSER;
- final String errorString =
- "Should throw exceptions when the parsed message isn't initialized.";
-
- // TestRequired.b and TestRequired.c are not set.
- TestRequired partialMessage = TestRequired.newBuilder()
- .setA(1).buildPartial();
-
- // parsePartialFrom should pass.
- byte[] data = partialMessage.toByteArray();
- assertEquals(partialMessage, parser.parsePartialFrom(data));
- assertEquals(partialMessage, parser.parsePartialFrom(
- partialMessage.toByteString()));
- assertEquals(partialMessage, parser.parsePartialFrom(
- new ByteArrayInputStream(data)));
- assertEquals(partialMessage, parser.parsePartialFrom(
- CodedInputStream.newInstance(data)));
-
- // parseFrom(ByteArray)
- try {
- parser.parseFrom(partialMessage.toByteArray());
- fail(errorString);
- } catch (InvalidProtocolBufferException e) {
- // pass.
- }
-
- // parseFrom(ByteString)
- try {
- parser.parseFrom(partialMessage.toByteString());
- fail(errorString);
- } catch (InvalidProtocolBufferException e) {
- // pass.
- }
-
- // parseFrom(InputStream)
- try {
- parser.parseFrom(new ByteArrayInputStream(partialMessage.toByteArray()));
- fail(errorString);
- } catch (IOException e) {
- // pass.
- }
-
- // parseFrom(CodedInputStream)
- try {
- parser.parseFrom(CodedInputStream.newInstance(
- partialMessage.toByteArray()));
- fail(errorString);
- } catch (IOException e) {
- // pass.
- }
- }
-
- public void testParseDelimitedTo() throws Exception {
- // Write normal Message.
- TestAllTypes normalMessage = TestUtil.getAllSet();
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- normalMessage.writeDelimitedTo(output);
-
- InputStream input = new ByteArrayInputStream(output.toByteArray());
- assertMessageEquals(
- normalMessage,
- normalMessage.getParserForType().parseDelimitedFrom(input));
- }
-
- public void testParseUnknownFields() throws Exception {
- // All fields will be treated as unknown fields in emptyMessage.
- TestEmptyMessage emptyMessage = TestEmptyMessage.PARSER.parseFrom(
- TestUtil.getAllSet().toByteString());
- assertEquals(
- TestUtil.getAllSet().toByteString(),
- emptyMessage.toByteString());
- }
-
- public void testOptimizeForSize() throws Exception {
- TestOptimizedForSize.Builder builder = TestOptimizedForSize.newBuilder();
- builder.setI(12).setMsg(ForeignMessage.newBuilder().setC(34).build());
- builder.setExtension(TestOptimizedForSize.testExtension, 56);
- builder.setExtension(TestOptimizedForSize.testExtension2,
- TestRequiredOptimizedForSize.newBuilder().setX(78).build());
-
- TestOptimizedForSize message = builder.build();
- ExtensionRegistry registry = ExtensionRegistry.newInstance();
- UnittestOptimizeFor.registerAllExtensions(registry);
-
- assertRoundTripEquals(message, registry);
- }
-
- /** Helper method for {@link #testParsingMerge()}.*/
- private void assertMessageMerged(TestAllTypes allTypes)
- throws Exception {
- assertEquals(3, allTypes.getOptionalInt32());
- assertEquals(2, allTypes.getOptionalInt64());
- assertEquals("hello", allTypes.getOptionalString());
- }
-
- public void testParsingMerge() throws Exception {
- // Build messages.
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TestAllTypes msg1 = builder.setOptionalInt32(1).build();
- builder.clear();
- TestAllTypes msg2 = builder.setOptionalInt64(2).build();
- builder.clear();
- TestAllTypes msg3 = builder.setOptionalInt32(3)
- .setOptionalString("hello").build();
-
- // Build groups.
- TestParsingMerge.RepeatedFieldsGenerator.Group1 optionalG1 =
- TestParsingMerge.RepeatedFieldsGenerator.Group1.newBuilder()
- .setField1(msg1).build();
- TestParsingMerge.RepeatedFieldsGenerator.Group1 optionalG2 =
- TestParsingMerge.RepeatedFieldsGenerator.Group1.newBuilder()
- .setField1(msg2).build();
- TestParsingMerge.RepeatedFieldsGenerator.Group1 optionalG3 =
- TestParsingMerge.RepeatedFieldsGenerator.Group1.newBuilder()
- .setField1(msg3).build();
- TestParsingMerge.RepeatedFieldsGenerator.Group2 repeatedG1 =
- TestParsingMerge.RepeatedFieldsGenerator.Group2.newBuilder()
- .setField1(msg1).build();
- TestParsingMerge.RepeatedFieldsGenerator.Group2 repeatedG2 =
- TestParsingMerge.RepeatedFieldsGenerator.Group2.newBuilder()
- .setField1(msg2).build();
- TestParsingMerge.RepeatedFieldsGenerator.Group2 repeatedG3 =
- TestParsingMerge.RepeatedFieldsGenerator.Group2.newBuilder()
- .setField1(msg3).build();
-
- // Assign and serialize RepeatedFieldsGenerator.
- ByteString data = TestParsingMerge.RepeatedFieldsGenerator.newBuilder()
- .addField1(msg1).addField1(msg2).addField1(msg3)
- .addField2(msg1).addField2(msg2).addField2(msg3)
- .addField3(msg1).addField3(msg2).addField3(msg3)
- .addGroup1(optionalG1).addGroup1(optionalG2).addGroup1(optionalG3)
- .addGroup2(repeatedG1).addGroup2(repeatedG2).addGroup2(repeatedG3)
- .addExt1(msg1).addExt1(msg2).addExt1(msg3)
- .addExt2(msg1).addExt2(msg2).addExt2(msg3)
- .build().toByteString();
-
- // Parse TestParsingMerge.
- ExtensionRegistry registry = ExtensionRegistry.newInstance();
- UnittestProto.registerAllExtensions(registry);
- TestParsingMerge parsingMerge =
- TestParsingMerge.PARSER.parseFrom(data, registry);
-
- // Required and optional fields should be merged.
- assertMessageMerged(parsingMerge.getRequiredAllTypes());
- assertMessageMerged(parsingMerge.getOptionalAllTypes());
- assertMessageMerged(
- parsingMerge.getOptionalGroup().getOptionalGroupAllTypes());
- assertMessageMerged(parsingMerge.getExtension(
- TestParsingMerge.optionalExt));
-
- // Repeated fields should not be merged.
- assertEquals(3, parsingMerge.getRepeatedAllTypesCount());
- assertEquals(3, parsingMerge.getRepeatedGroupCount());
- assertEquals(3, parsingMerge.getExtensionCount(
- TestParsingMerge.repeatedExt));
- }
-
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java
deleted file mode 100644
index c122385..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringSubstringTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Iterator;
-
-/**
- * This class tests {@link RopeByteString#substring(int, int)} by inheriting the tests from
- * {@link LiteralByteStringTest}. Only a couple of methods are overridden.
- *
- * @author carlanton@google.com (Carl Haverl)
- */
-public class RopeByteStringSubstringTest extends LiteralByteStringTest {
-
- @Override
- protected void setUp() throws Exception {
- classUnderTest = "RopeByteString";
- byte[] sourceBytes = ByteStringTest.getTestBytes(22341, 22337766L);
- Iterator<ByteString> iter = ByteStringTest.makeConcretePieces(sourceBytes).iterator();
- ByteString sourceString = iter.next();
- while (iter.hasNext()) {
- sourceString = sourceString.concat(iter.next());
- }
-
- int from = 1130;
- int to = sourceBytes.length - 5555;
- stringUnderTest = sourceString.substring(from, to);
- referenceBytes = new byte[to - from];
- System.arraycopy(sourceBytes, from, referenceBytes, 0, to - from);
- expectedHashCode = -1259260680;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java
deleted file mode 100644
index 19098de..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/RopeByteStringTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-import java.util.Iterator;
-
-/**
- * This class tests {@link RopeByteString} by inheriting the tests from
- * {@link LiteralByteStringTest}. Only a couple of methods are overridden.
- *
- * <p>A full test of the result of {@link RopeByteString#substring(int, int)} is found in the
- * separate class {@link RopeByteStringSubstringTest}.
- *
- * @author carlanton@google.com (Carl Haverl)
- */
-public class RopeByteStringTest extends LiteralByteStringTest {
-
- @Override
- protected void setUp() throws Exception {
- classUnderTest = "RopeByteString";
- referenceBytes = ByteStringTest.getTestBytes(22341, 22337766L);
- Iterator<ByteString> iter = ByteStringTest.makeConcretePieces(referenceBytes).iterator();
- stringUnderTest = iter.next();
- while (iter.hasNext()) {
- stringUnderTest = stringUnderTest.concat(iter.next());
- }
- expectedHashCode = -1214197238;
- }
-
- public void testBalance() {
- int numberOfPieces = 10000;
- int pieceSize = 64;
- byte[] testBytes = ByteStringTest.getTestBytes(numberOfPieces * pieceSize, 113377L);
-
- // Build up a big ByteString from smaller pieces to force a rebalance
- ByteString concatenated = ByteString.EMPTY;
- for (int i = 0; i < numberOfPieces; ++i) {
- concatenated = concatenated.concat(ByteString.copyFrom(testBytes, i * pieceSize, pieceSize));
- }
-
- assertEquals(classUnderTest + " from string must have the expected type",
- classUnderTest, getActualClassName(concatenated));
- assertTrue(classUnderTest + " underlying bytes must match after balancing",
- Arrays.equals(testBytes, concatenated.toByteArray()));
- ByteString testString = ByteString.copyFrom(testBytes);
- assertTrue(classUnderTest + " balanced string must equal flat string",
- concatenated.equals(testString));
- assertTrue(classUnderTest + " flat string must equal balanced string",
- testString.equals(concatenated));
- assertEquals(classUnderTest + " balanced string must have same hash code as flat string",
- testString.hashCode(), concatenated.hashCode());
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java
deleted file mode 100644
index 4c7f751..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/ServiceTest.java
+++ /dev/null
@@ -1,321 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import com.google.protobuf.Descriptors.FileDescriptor;
-import com.google.protobuf.Descriptors.MethodDescriptor;
-import google.protobuf.no_generic_services_test.UnittestNoGenericServices;
-import protobuf_unittest.MessageWithNoOuter;
-import protobuf_unittest.ServiceWithNoOuter;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestService;
-import protobuf_unittest.UnittestProto.FooRequest;
-import protobuf_unittest.UnittestProto.FooResponse;
-import protobuf_unittest.UnittestProto.BarRequest;
-import protobuf_unittest.UnittestProto.BarResponse;
-
-import org.easymock.classextension.EasyMock;
-import org.easymock.classextension.IMocksControl;
-import org.easymock.IArgumentMatcher;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-/**
- * Tests services and stubs.
- *
- * @author kenton@google.com Kenton Varda
- */
-public class ServiceTest extends TestCase {
- private IMocksControl control;
- private RpcController mockController;
-
- private final Descriptors.MethodDescriptor fooDescriptor =
- TestService.getDescriptor().getMethods().get(0);
- private final Descriptors.MethodDescriptor barDescriptor =
- TestService.getDescriptor().getMethods().get(1);
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- control = EasyMock.createStrictControl();
- mockController = control.createMock(RpcController.class);
- }
-
- // =================================================================
-
- /** Tests Service.callMethod(). */
- public void testCallMethod() throws Exception {
- FooRequest fooRequest = FooRequest.newBuilder().build();
- BarRequest barRequest = BarRequest.newBuilder().build();
- MockCallback<Message> fooCallback = new MockCallback<Message>();
- MockCallback<Message> barCallback = new MockCallback<Message>();
- TestService mockService = control.createMock(TestService.class);
-
- mockService.foo(EasyMock.same(mockController), EasyMock.same(fooRequest),
- this.<FooResponse>wrapsCallback(fooCallback));
- mockService.bar(EasyMock.same(mockController), EasyMock.same(barRequest),
- this.<BarResponse>wrapsCallback(barCallback));
- control.replay();
-
- mockService.callMethod(fooDescriptor, mockController,
- fooRequest, fooCallback);
- mockService.callMethod(barDescriptor, mockController,
- barRequest, barCallback);
- control.verify();
- }
-
- /** Tests Service.get{Request,Response}Prototype(). */
- public void testGetPrototype() throws Exception {
- TestService mockService = control.createMock(TestService.class);
-
- assertSame(mockService.getRequestPrototype(fooDescriptor),
- FooRequest.getDefaultInstance());
- assertSame(mockService.getResponsePrototype(fooDescriptor),
- FooResponse.getDefaultInstance());
- assertSame(mockService.getRequestPrototype(barDescriptor),
- BarRequest.getDefaultInstance());
- assertSame(mockService.getResponsePrototype(barDescriptor),
- BarResponse.getDefaultInstance());
- }
-
- /** Tests generated stubs. */
- public void testStub() throws Exception {
- FooRequest fooRequest = FooRequest.newBuilder().build();
- BarRequest barRequest = BarRequest.newBuilder().build();
- MockCallback<FooResponse> fooCallback = new MockCallback<FooResponse>();
- MockCallback<BarResponse> barCallback = new MockCallback<BarResponse>();
- RpcChannel mockChannel = control.createMock(RpcChannel.class);
- TestService stub = TestService.newStub(mockChannel);
-
- mockChannel.callMethod(
- EasyMock.same(fooDescriptor),
- EasyMock.same(mockController),
- EasyMock.same(fooRequest),
- EasyMock.same(FooResponse.getDefaultInstance()),
- this.<Message>wrapsCallback(fooCallback));
- mockChannel.callMethod(
- EasyMock.same(barDescriptor),
- EasyMock.same(mockController),
- EasyMock.same(barRequest),
- EasyMock.same(BarResponse.getDefaultInstance()),
- this.<Message>wrapsCallback(barCallback));
- control.replay();
-
- stub.foo(mockController, fooRequest, fooCallback);
- stub.bar(mockController, barRequest, barCallback);
- control.verify();
- }
-
- /** Tests generated blocking stubs. */
- public void testBlockingStub() throws Exception {
- FooRequest fooRequest = FooRequest.newBuilder().build();
- BarRequest barRequest = BarRequest.newBuilder().build();
- BlockingRpcChannel mockChannel =
- control.createMock(BlockingRpcChannel.class);
- TestService.BlockingInterface stub =
- TestService.newBlockingStub(mockChannel);
-
- FooResponse fooResponse = FooResponse.newBuilder().build();
- BarResponse barResponse = BarResponse.newBuilder().build();
-
- EasyMock.expect(mockChannel.callBlockingMethod(
- EasyMock.same(fooDescriptor),
- EasyMock.same(mockController),
- EasyMock.same(fooRequest),
- EasyMock.same(FooResponse.getDefaultInstance()))).andReturn(fooResponse);
- EasyMock.expect(mockChannel.callBlockingMethod(
- EasyMock.same(barDescriptor),
- EasyMock.same(mockController),
- EasyMock.same(barRequest),
- EasyMock.same(BarResponse.getDefaultInstance()))).andReturn(barResponse);
- control.replay();
-
- assertSame(fooResponse, stub.foo(mockController, fooRequest));
- assertSame(barResponse, stub.bar(mockController, barRequest));
- control.verify();
- }
-
- public void testNewReflectiveService() {
- ServiceWithNoOuter.Interface impl =
- control.createMock(ServiceWithNoOuter.Interface.class);
- RpcController controller = control.createMock(RpcController.class);
- Service service = ServiceWithNoOuter.newReflectiveService(impl);
-
- MethodDescriptor fooMethod =
- ServiceWithNoOuter.getDescriptor().findMethodByName("Foo");
- MessageWithNoOuter request = MessageWithNoOuter.getDefaultInstance();
- RpcCallback<Message> callback = new RpcCallback<Message>() {
- public void run(Message parameter) {
- // No reason this should be run.
- fail();
- }
- };
- RpcCallback<TestAllTypes> specializedCallback =
- RpcUtil.specializeCallback(callback);
-
- impl.foo(EasyMock.same(controller), EasyMock.same(request),
- EasyMock.same(specializedCallback));
- EasyMock.expectLastCall();
-
- control.replay();
-
- service.callMethod(fooMethod, controller, request, callback);
-
- control.verify();
- }
-
- public void testNewReflectiveBlockingService() throws ServiceException {
- ServiceWithNoOuter.BlockingInterface impl =
- control.createMock(ServiceWithNoOuter.BlockingInterface.class);
- RpcController controller = control.createMock(RpcController.class);
- BlockingService service =
- ServiceWithNoOuter.newReflectiveBlockingService(impl);
-
- MethodDescriptor fooMethod =
- ServiceWithNoOuter.getDescriptor().findMethodByName("Foo");
- MessageWithNoOuter request = MessageWithNoOuter.getDefaultInstance();
-
- TestAllTypes expectedResponse = TestAllTypes.getDefaultInstance();
- EasyMock.expect(impl.foo(EasyMock.same(controller), EasyMock.same(request)))
- .andReturn(expectedResponse);
-
- control.replay();
-
- Message response =
- service.callBlockingMethod(fooMethod, controller, request);
- assertEquals(expectedResponse, response);
-
- control.verify();
- }
-
- public void testNoGenericServices() throws Exception {
- // Non-services should be usable.
- UnittestNoGenericServices.TestMessage message =
- UnittestNoGenericServices.TestMessage.newBuilder()
- .setA(123)
- .setExtension(UnittestNoGenericServices.testExtension, 456)
- .build();
- assertEquals(123, message.getA());
- assertEquals(1, UnittestNoGenericServices.TestEnum.FOO.getNumber());
-
- // Build a list of the class names nested in UnittestNoGenericServices.
- String outerName = "google.protobuf.no_generic_services_test." +
- "UnittestNoGenericServices";
- Class<?> outerClass = Class.forName(outerName);
-
- Set<String> innerClassNames = new HashSet<String>();
- for (Class<?> innerClass : outerClass.getClasses()) {
- String fullName = innerClass.getName();
- // Figure out the unqualified name of the inner class.
- // Note: Surprisingly, the full name of an inner class will be separated
- // from the outer class name by a '$' rather than a '.'. This is not
- // mentioned in the documentation for java.lang.Class. I don't want to
- // make assumptions, so I'm just going to accept any character as the
- // separator.
- assertTrue(fullName.startsWith(outerName));
-
- if (!Service.class.isAssignableFrom(innerClass) &&
- !Message.class.isAssignableFrom(innerClass) &&
- !ProtocolMessageEnum.class.isAssignableFrom(innerClass)) {
- // Ignore any classes not generated by the base code generator.
- continue;
- }
-
- innerClassNames.add(fullName.substring(outerName.length() + 1));
- }
-
- // No service class should have been generated.
- assertTrue(innerClassNames.contains("TestMessage"));
- assertTrue(innerClassNames.contains("TestEnum"));
- assertFalse(innerClassNames.contains("TestService"));
-
- // But descriptors are there.
- FileDescriptor file = UnittestNoGenericServices.getDescriptor();
- assertEquals(1, file.getServices().size());
- assertEquals("TestService", file.getServices().get(0).getName());
- assertEquals(1, file.getServices().get(0).getMethods().size());
- assertEquals("Foo",
- file.getServices().get(0).getMethods().get(0).getName());
- }
-
- // =================================================================
-
- /**
- * wrapsCallback() is an EasyMock argument predicate. wrapsCallback(c)
- * matches a callback if calling that callback causes c to be called.
- * In other words, c wraps the given callback.
- */
- private <Type extends Message> RpcCallback<Type> wrapsCallback(
- MockCallback<?> callback) {
- EasyMock.reportMatcher(new WrapsCallback(callback));
- return null;
- }
-
- /** The parameter to wrapsCallback() must be a MockCallback. */
- private static class MockCallback<Type extends Message>
- implements RpcCallback<Type> {
- private boolean called = false;
-
- public boolean isCalled() { return called; }
-
- public void reset() { called = false; }
- public void run(Type message) { called = true; }
- }
-
- /** Implementation of the wrapsCallback() argument matcher. */
- private static class WrapsCallback implements IArgumentMatcher {
- private MockCallback<?> callback;
-
- public WrapsCallback(MockCallback<?> callback) {
- this.callback = callback;
- }
-
- @SuppressWarnings("unchecked")
- public boolean matches(Object actual) {
- if (!(actual instanceof RpcCallback)) {
- return false;
- }
- RpcCallback actualCallback = (RpcCallback)actual;
-
- callback.reset();
- actualCallback.run(null);
- return callback.isCalled();
- }
-
- public void appendTo(StringBuffer buffer) {
- buffer.append("wrapsCallback(mockCallback)");
- }
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
deleted file mode 100644
index 5086732..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestBadIdentifiers.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import junit.framework.TestCase;
-
-/**
- * Tests that proto2 api generation doesn't cause compile errors when
- * compiling protocol buffers that have names that would otherwise conflict
- * if not fully qualified (like @Deprecated and @Override).
- *
- * @author jonp@google.com (Jon Perlow)
- */
-public class TestBadIdentifiers extends TestCase {
-
- public void testCompilation() {
- // If this compiles, it means the generation was correct.
- TestBadIdentifiersProto.Deprecated.newBuilder();
- TestBadIdentifiersProto.Override.newBuilder();
- }
-
- public void testGetDescriptor() {
- Descriptors.FileDescriptor fileDescriptor =
- TestBadIdentifiersProto.getDescriptor();
- String descriptorField = TestBadIdentifiersProto.Descriptor
- .getDefaultInstance().getDescriptor();
- Descriptors.Descriptor protoDescriptor = TestBadIdentifiersProto.Descriptor
- .getDefaultInstance().getDescriptorForType();
- String nestedDescriptorField = TestBadIdentifiersProto.Descriptor
- .NestedDescriptor.getDefaultInstance().getDescriptor();
- Descriptors.Descriptor nestedProtoDescriptor = TestBadIdentifiersProto
- .Descriptor.NestedDescriptor.getDefaultInstance()
- .getDescriptorForType();
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java
deleted file mode 100644
index a923483..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java
+++ /dev/null
@@ -1,3068 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto;
-
-// The static imports are to avoid 100+ char lines. The following is roughly equivalent to
-// import static protobuf_unittest.UnittestProto.*;
-import static protobuf_unittest.UnittestProto.defaultInt32Extension;
-import static protobuf_unittest.UnittestProto.defaultInt64Extension;
-import static protobuf_unittest.UnittestProto.defaultUint32Extension;
-import static protobuf_unittest.UnittestProto.defaultUint64Extension;
-import static protobuf_unittest.UnittestProto.defaultSint32Extension;
-import static protobuf_unittest.UnittestProto.defaultSint64Extension;
-import static protobuf_unittest.UnittestProto.defaultFixed32Extension;
-import static protobuf_unittest.UnittestProto.defaultFixed64Extension;
-import static protobuf_unittest.UnittestProto.defaultSfixed32Extension;
-import static protobuf_unittest.UnittestProto.defaultSfixed64Extension;
-import static protobuf_unittest.UnittestProto.defaultFloatExtension;
-import static protobuf_unittest.UnittestProto.defaultDoubleExtension;
-import static protobuf_unittest.UnittestProto.defaultBoolExtension;
-import static protobuf_unittest.UnittestProto.defaultStringExtension;
-import static protobuf_unittest.UnittestProto.defaultBytesExtension;
-import static protobuf_unittest.UnittestProto.defaultNestedEnumExtension;
-import static protobuf_unittest.UnittestProto.defaultForeignEnumExtension;
-import static protobuf_unittest.UnittestProto.defaultImportEnumExtension;
-import static protobuf_unittest.UnittestProto.defaultStringPieceExtension;
-import static protobuf_unittest.UnittestProto.defaultCordExtension;
-
-import static protobuf_unittest.UnittestProto.optionalInt32Extension;
-import static protobuf_unittest.UnittestProto.optionalInt64Extension;
-import static protobuf_unittest.UnittestProto.optionalUint32Extension;
-import static protobuf_unittest.UnittestProto.optionalUint64Extension;
-import static protobuf_unittest.UnittestProto.optionalSint32Extension;
-import static protobuf_unittest.UnittestProto.optionalSint64Extension;
-import static protobuf_unittest.UnittestProto.optionalFixed32Extension;
-import static protobuf_unittest.UnittestProto.optionalFixed64Extension;
-import static protobuf_unittest.UnittestProto.optionalSfixed32Extension;
-import static protobuf_unittest.UnittestProto.optionalSfixed64Extension;
-import static protobuf_unittest.UnittestProto.optionalFloatExtension;
-import static protobuf_unittest.UnittestProto.optionalDoubleExtension;
-import static protobuf_unittest.UnittestProto.optionalBoolExtension;
-import static protobuf_unittest.UnittestProto.optionalStringExtension;
-import static protobuf_unittest.UnittestProto.optionalBytesExtension;
-import static protobuf_unittest.UnittestProto.optionalGroupExtension;
-import static protobuf_unittest.UnittestProto.optionalCordExtension;
-import static protobuf_unittest.UnittestProto.optionalForeignEnumExtension;
-import static protobuf_unittest.UnittestProto.optionalForeignMessageExtension;
-import static protobuf_unittest.UnittestProto.optionalImportEnumExtension;
-import static protobuf_unittest.UnittestProto.optionalImportMessageExtension;
-import static protobuf_unittest.UnittestProto.optionalNestedEnumExtension;
-import static protobuf_unittest.UnittestProto.optionalNestedMessageExtension;
-import static protobuf_unittest.UnittestProto.optionalPublicImportMessageExtension;
-import static protobuf_unittest.UnittestProto.optionalLazyMessageExtension;
-import static protobuf_unittest.UnittestProto.optionalStringPieceExtension;
-
-import static protobuf_unittest.UnittestProto.repeatedInt32Extension;
-import static protobuf_unittest.UnittestProto.repeatedInt64Extension;
-import static protobuf_unittest.UnittestProto.repeatedUint32Extension;
-import static protobuf_unittest.UnittestProto.repeatedUint64Extension;
-import static protobuf_unittest.UnittestProto.repeatedSint32Extension;
-import static protobuf_unittest.UnittestProto.repeatedSint64Extension;
-import static protobuf_unittest.UnittestProto.repeatedFixed32Extension;
-import static protobuf_unittest.UnittestProto.repeatedFixed64Extension;
-import static protobuf_unittest.UnittestProto.repeatedSfixed32Extension;
-import static protobuf_unittest.UnittestProto.repeatedSfixed64Extension;
-import static protobuf_unittest.UnittestProto.repeatedFloatExtension;
-import static protobuf_unittest.UnittestProto.repeatedDoubleExtension;
-import static protobuf_unittest.UnittestProto.repeatedBoolExtension;
-import static protobuf_unittest.UnittestProto.repeatedStringExtension;
-import static protobuf_unittest.UnittestProto.repeatedBytesExtension;
-import static protobuf_unittest.UnittestProto.repeatedGroupExtension;
-import static protobuf_unittest.UnittestProto.repeatedNestedMessageExtension;
-import static protobuf_unittest.UnittestProto.repeatedForeignMessageExtension;
-import static protobuf_unittest.UnittestProto.repeatedImportMessageExtension;
-import static protobuf_unittest.UnittestProto.repeatedLazyMessageExtension;
-import static protobuf_unittest.UnittestProto.repeatedNestedEnumExtension;
-import static protobuf_unittest.UnittestProto.repeatedForeignEnumExtension;
-import static protobuf_unittest.UnittestProto.repeatedImportEnumExtension;
-import static protobuf_unittest.UnittestProto.repeatedStringPieceExtension;
-import static protobuf_unittest.UnittestProto.repeatedCordExtension;
-
-import static protobuf_unittest.UnittestProto.OptionalGroup_extension;
-import static protobuf_unittest.UnittestProto.RepeatedGroup_extension;
-
-import static protobuf_unittest.UnittestProto.packedInt32Extension;
-import static protobuf_unittest.UnittestProto.packedInt64Extension;
-import static protobuf_unittest.UnittestProto.packedUint32Extension;
-import static protobuf_unittest.UnittestProto.packedUint64Extension;
-import static protobuf_unittest.UnittestProto.packedSint32Extension;
-import static protobuf_unittest.UnittestProto.packedSint64Extension;
-import static protobuf_unittest.UnittestProto.packedFixed32Extension;
-import static protobuf_unittest.UnittestProto.packedFixed64Extension;
-import static protobuf_unittest.UnittestProto.packedSfixed32Extension;
-import static protobuf_unittest.UnittestProto.packedSfixed64Extension;
-import static protobuf_unittest.UnittestProto.packedFloatExtension;
-import static protobuf_unittest.UnittestProto.packedDoubleExtension;
-import static protobuf_unittest.UnittestProto.packedBoolExtension;
-import static protobuf_unittest.UnittestProto.packedEnumExtension;
-
-
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllExtensionsOrBuilder;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder;
-import protobuf_unittest.UnittestProto.TestPackedExtensions;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
-import protobuf_unittest.UnittestProto.TestUnpackedTypes;
-import protobuf_unittest.UnittestProto.ForeignMessage;
-import protobuf_unittest.UnittestProto.ForeignEnum;
-import com.google.protobuf.test.UnittestImport.ImportEnum;
-import com.google.protobuf.test.UnittestImport.ImportMessage;
-import com.google.protobuf.test.UnittestImportPublic.PublicImportMessage;
-
-import junit.framework.Assert;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-
-/**
- * Contains methods for setting all fields of {@code TestAllTypes} to
- * some values as well as checking that all the fields are set to those values.
- * These are useful for testing various protocol message features, e.g.
- * set all fields of a message, serialize it, parse it, and check that all
- * fields are set.
- *
- * <p>This code is not to be used outside of {@code com.google.protobuf} and
- * subpackages.
- *
- * @author kenton@google.com Kenton Varda
- */
-public final class TestUtil {
- private TestUtil() {}
-
- /** Helper to convert a String to ByteString. */
- static ByteString toBytes(String str) {
- try {
- return ByteString.copyFrom(str.getBytes("UTF-8"));
- } catch(java.io.UnsupportedEncodingException e) {
- throw new RuntimeException("UTF-8 not supported.", e);
- }
- }
-
- /**
- * Get a {@code TestAllTypes} with all fields set as they would be by
- * {@link #setAllFields(TestAllTypes.Builder)}.
- */
- public static TestAllTypes getAllSet() {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- setAllFields(builder);
- return builder.build();
- }
-
- /**
- * Get a {@code TestAllTypes.Builder} with all fields set as they would be by
- * {@link #setAllFields(TestAllTypes.Builder)}.
- */
- public static TestAllTypes.Builder getAllSetBuilder() {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- setAllFields(builder);
- return builder;
- }
-
- /**
- * Get a {@code TestAllExtensions} with all fields set as they would be by
- * {@link #setAllExtensions(TestAllExtensions.Builder)}.
- */
- public static TestAllExtensions getAllExtensionsSet() {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- setAllExtensions(builder);
- return builder.build();
- }
-
- public static TestPackedTypes getPackedSet() {
- TestPackedTypes.Builder builder = TestPackedTypes.newBuilder();
- setPackedFields(builder);
- return builder.build();
- }
-
- public static TestUnpackedTypes getUnpackedSet() {
- TestUnpackedTypes.Builder builder = TestUnpackedTypes.newBuilder();
- setUnpackedFields(builder);
- return builder.build();
- }
-
- public static TestPackedExtensions getPackedExtensionsSet() {
- TestPackedExtensions.Builder builder = TestPackedExtensions.newBuilder();
- setPackedExtensions(builder);
- return builder.build();
- }
-
- /**
- * Set every field of {@code message} to the values expected by
- * {@code assertAllFieldsSet()}.
- */
- public static void setAllFields(TestAllTypes.Builder message) {
- message.setOptionalInt32 (101);
- message.setOptionalInt64 (102);
- message.setOptionalUint32 (103);
- message.setOptionalUint64 (104);
- message.setOptionalSint32 (105);
- message.setOptionalSint64 (106);
- message.setOptionalFixed32 (107);
- message.setOptionalFixed64 (108);
- message.setOptionalSfixed32(109);
- message.setOptionalSfixed64(110);
- message.setOptionalFloat (111);
- message.setOptionalDouble (112);
- message.setOptionalBool (true);
- message.setOptionalString ("115");
- message.setOptionalBytes (toBytes("116"));
-
- message.setOptionalGroup(
- TestAllTypes.OptionalGroup.newBuilder().setA(117).build());
- message.setOptionalNestedMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(118).build());
- message.setOptionalForeignMessage(
- ForeignMessage.newBuilder().setC(119).build());
- message.setOptionalImportMessage(
- ImportMessage.newBuilder().setD(120).build());
- message.setOptionalPublicImportMessage(
- PublicImportMessage.newBuilder().setE(126).build());
- message.setOptionalLazyMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(127).build());
-
- message.setOptionalNestedEnum (TestAllTypes.NestedEnum.BAZ);
- message.setOptionalForeignEnum(ForeignEnum.FOREIGN_BAZ);
- message.setOptionalImportEnum (ImportEnum.IMPORT_BAZ);
-
- message.setOptionalStringPiece("124");
- message.setOptionalCord("125");
-
- // -----------------------------------------------------------------
-
- message.addRepeatedInt32 (201);
- message.addRepeatedInt64 (202);
- message.addRepeatedUint32 (203);
- message.addRepeatedUint64 (204);
- message.addRepeatedSint32 (205);
- message.addRepeatedSint64 (206);
- message.addRepeatedFixed32 (207);
- message.addRepeatedFixed64 (208);
- message.addRepeatedSfixed32(209);
- message.addRepeatedSfixed64(210);
- message.addRepeatedFloat (211);
- message.addRepeatedDouble (212);
- message.addRepeatedBool (true);
- message.addRepeatedString ("215");
- message.addRepeatedBytes (toBytes("216"));
-
- message.addRepeatedGroup(
- TestAllTypes.RepeatedGroup.newBuilder().setA(217).build());
- message.addRepeatedNestedMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(218).build());
- message.addRepeatedForeignMessage(
- ForeignMessage.newBuilder().setC(219).build());
- message.addRepeatedImportMessage(
- ImportMessage.newBuilder().setD(220).build());
- message.addRepeatedLazyMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(227).build());
-
- message.addRepeatedNestedEnum (TestAllTypes.NestedEnum.BAR);
- message.addRepeatedForeignEnum(ForeignEnum.FOREIGN_BAR);
- message.addRepeatedImportEnum (ImportEnum.IMPORT_BAR);
-
- message.addRepeatedStringPiece("224");
- message.addRepeatedCord("225");
-
- // Add a second one of each field.
- message.addRepeatedInt32 (301);
- message.addRepeatedInt64 (302);
- message.addRepeatedUint32 (303);
- message.addRepeatedUint64 (304);
- message.addRepeatedSint32 (305);
- message.addRepeatedSint64 (306);
- message.addRepeatedFixed32 (307);
- message.addRepeatedFixed64 (308);
- message.addRepeatedSfixed32(309);
- message.addRepeatedSfixed64(310);
- message.addRepeatedFloat (311);
- message.addRepeatedDouble (312);
- message.addRepeatedBool (false);
- message.addRepeatedString ("315");
- message.addRepeatedBytes (toBytes("316"));
-
- message.addRepeatedGroup(
- TestAllTypes.RepeatedGroup.newBuilder().setA(317).build());
- message.addRepeatedNestedMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(318).build());
- message.addRepeatedForeignMessage(
- ForeignMessage.newBuilder().setC(319).build());
- message.addRepeatedImportMessage(
- ImportMessage.newBuilder().setD(320).build());
- message.addRepeatedLazyMessage(
- TestAllTypes.NestedMessage.newBuilder().setBb(327).build());
-
- message.addRepeatedNestedEnum (TestAllTypes.NestedEnum.BAZ);
- message.addRepeatedForeignEnum(ForeignEnum.FOREIGN_BAZ);
- message.addRepeatedImportEnum (ImportEnum.IMPORT_BAZ);
-
- message.addRepeatedStringPiece("324");
- message.addRepeatedCord("325");
-
- // -----------------------------------------------------------------
-
- message.setDefaultInt32 (401);
- message.setDefaultInt64 (402);
- message.setDefaultUint32 (403);
- message.setDefaultUint64 (404);
- message.setDefaultSint32 (405);
- message.setDefaultSint64 (406);
- message.setDefaultFixed32 (407);
- message.setDefaultFixed64 (408);
- message.setDefaultSfixed32(409);
- message.setDefaultSfixed64(410);
- message.setDefaultFloat (411);
- message.setDefaultDouble (412);
- message.setDefaultBool (false);
- message.setDefaultString ("415");
- message.setDefaultBytes (toBytes("416"));
-
- message.setDefaultNestedEnum (TestAllTypes.NestedEnum.FOO);
- message.setDefaultForeignEnum(ForeignEnum.FOREIGN_FOO);
- message.setDefaultImportEnum (ImportEnum.IMPORT_FOO);
-
- message.setDefaultStringPiece("424");
- message.setDefaultCord("425");
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Modify the repeated fields of {@code message} to contain the values
- * expected by {@code assertRepeatedFieldsModified()}.
- */
- public static void modifyRepeatedFields(TestAllTypes.Builder message) {
- message.setRepeatedInt32 (1, 501);
- message.setRepeatedInt64 (1, 502);
- message.setRepeatedUint32 (1, 503);
- message.setRepeatedUint64 (1, 504);
- message.setRepeatedSint32 (1, 505);
- message.setRepeatedSint64 (1, 506);
- message.setRepeatedFixed32 (1, 507);
- message.setRepeatedFixed64 (1, 508);
- message.setRepeatedSfixed32(1, 509);
- message.setRepeatedSfixed64(1, 510);
- message.setRepeatedFloat (1, 511);
- message.setRepeatedDouble (1, 512);
- message.setRepeatedBool (1, true);
- message.setRepeatedString (1, "515");
- message.setRepeatedBytes (1, toBytes("516"));
-
- message.setRepeatedGroup(1,
- TestAllTypes.RepeatedGroup.newBuilder().setA(517).build());
- message.setRepeatedNestedMessage(1,
- TestAllTypes.NestedMessage.newBuilder().setBb(518).build());
- message.setRepeatedForeignMessage(1,
- ForeignMessage.newBuilder().setC(519).build());
- message.setRepeatedImportMessage(1,
- ImportMessage.newBuilder().setD(520).build());
- message.setRepeatedLazyMessage(1,
- TestAllTypes.NestedMessage.newBuilder().setBb(527).build());
-
- message.setRepeatedNestedEnum (1, TestAllTypes.NestedEnum.FOO);
- message.setRepeatedForeignEnum(1, ForeignEnum.FOREIGN_FOO);
- message.setRepeatedImportEnum (1, ImportEnum.IMPORT_FOO);
-
- message.setRepeatedStringPiece(1, "524");
- message.setRepeatedCord(1, "525");
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are set to the values assigned by {@code setAllFields}.
- */
- public static void assertAllFieldsSet(TestAllTypesOrBuilder message) {
- Assert.assertTrue(message.hasOptionalInt32 ());
- Assert.assertTrue(message.hasOptionalInt64 ());
- Assert.assertTrue(message.hasOptionalUint32 ());
- Assert.assertTrue(message.hasOptionalUint64 ());
- Assert.assertTrue(message.hasOptionalSint32 ());
- Assert.assertTrue(message.hasOptionalSint64 ());
- Assert.assertTrue(message.hasOptionalFixed32 ());
- Assert.assertTrue(message.hasOptionalFixed64 ());
- Assert.assertTrue(message.hasOptionalSfixed32());
- Assert.assertTrue(message.hasOptionalSfixed64());
- Assert.assertTrue(message.hasOptionalFloat ());
- Assert.assertTrue(message.hasOptionalDouble ());
- Assert.assertTrue(message.hasOptionalBool ());
- Assert.assertTrue(message.hasOptionalString ());
- Assert.assertTrue(message.hasOptionalBytes ());
-
- Assert.assertTrue(message.hasOptionalGroup ());
- Assert.assertTrue(message.hasOptionalNestedMessage ());
- Assert.assertTrue(message.hasOptionalForeignMessage());
- Assert.assertTrue(message.hasOptionalImportMessage ());
-
- Assert.assertTrue(message.getOptionalGroup ().hasA());
- Assert.assertTrue(message.getOptionalNestedMessage ().hasBb());
- Assert.assertTrue(message.getOptionalForeignMessage().hasC());
- Assert.assertTrue(message.getOptionalImportMessage ().hasD());
-
- Assert.assertTrue(message.hasOptionalNestedEnum ());
- Assert.assertTrue(message.hasOptionalForeignEnum());
- Assert.assertTrue(message.hasOptionalImportEnum ());
-
- Assert.assertTrue(message.hasOptionalStringPiece());
- Assert.assertTrue(message.hasOptionalCord());
-
- Assert.assertEquals(101 , message.getOptionalInt32 ());
- Assert.assertEquals(102 , message.getOptionalInt64 ());
- Assert.assertEquals(103 , message.getOptionalUint32 ());
- Assert.assertEquals(104 , message.getOptionalUint64 ());
- Assert.assertEquals(105 , message.getOptionalSint32 ());
- Assert.assertEquals(106 , message.getOptionalSint64 ());
- Assert.assertEquals(107 , message.getOptionalFixed32 ());
- Assert.assertEquals(108 , message.getOptionalFixed64 ());
- Assert.assertEquals(109 , message.getOptionalSfixed32());
- Assert.assertEquals(110 , message.getOptionalSfixed64());
- Assert.assertEquals(111 , message.getOptionalFloat (), 0.0);
- Assert.assertEquals(112 , message.getOptionalDouble (), 0.0);
- Assert.assertEquals(true , message.getOptionalBool ());
- Assert.assertEquals("115", message.getOptionalString ());
- Assert.assertEquals(toBytes("116"), message.getOptionalBytes());
-
- Assert.assertEquals(117, message.getOptionalGroup ().getA());
- Assert.assertEquals(118, message.getOptionalNestedMessage ().getBb());
- Assert.assertEquals(119, message.getOptionalForeignMessage ().getC());
- Assert.assertEquals(120, message.getOptionalImportMessage ().getD());
- Assert.assertEquals(126, message.getOptionalPublicImportMessage().getE());
- Assert.assertEquals(127, message.getOptionalLazyMessage ().getBb());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.BAZ, message.getOptionalNestedEnum());
- Assert.assertEquals(ForeignEnum.FOREIGN_BAZ, message.getOptionalForeignEnum());
- Assert.assertEquals(ImportEnum.IMPORT_BAZ, message.getOptionalImportEnum());
-
- Assert.assertEquals("124", message.getOptionalStringPiece());
- Assert.assertEquals("125", message.getOptionalCord());
-
- // -----------------------------------------------------------------
-
- Assert.assertEquals(2, message.getRepeatedInt32Count ());
- Assert.assertEquals(2, message.getRepeatedInt64Count ());
- Assert.assertEquals(2, message.getRepeatedUint32Count ());
- Assert.assertEquals(2, message.getRepeatedUint64Count ());
- Assert.assertEquals(2, message.getRepeatedSint32Count ());
- Assert.assertEquals(2, message.getRepeatedSint64Count ());
- Assert.assertEquals(2, message.getRepeatedFixed32Count ());
- Assert.assertEquals(2, message.getRepeatedFixed64Count ());
- Assert.assertEquals(2, message.getRepeatedSfixed32Count());
- Assert.assertEquals(2, message.getRepeatedSfixed64Count());
- Assert.assertEquals(2, message.getRepeatedFloatCount ());
- Assert.assertEquals(2, message.getRepeatedDoubleCount ());
- Assert.assertEquals(2, message.getRepeatedBoolCount ());
- Assert.assertEquals(2, message.getRepeatedStringCount ());
- Assert.assertEquals(2, message.getRepeatedBytesCount ());
-
- Assert.assertEquals(2, message.getRepeatedGroupCount ());
- Assert.assertEquals(2, message.getRepeatedNestedMessageCount ());
- Assert.assertEquals(2, message.getRepeatedForeignMessageCount());
- Assert.assertEquals(2, message.getRepeatedImportMessageCount ());
- Assert.assertEquals(2, message.getRepeatedLazyMessageCount ());
- Assert.assertEquals(2, message.getRepeatedNestedEnumCount ());
- Assert.assertEquals(2, message.getRepeatedForeignEnumCount ());
- Assert.assertEquals(2, message.getRepeatedImportEnumCount ());
-
- Assert.assertEquals(2, message.getRepeatedStringPieceCount());
- Assert.assertEquals(2, message.getRepeatedCordCount());
-
- Assert.assertEquals(201 , message.getRepeatedInt32 (0));
- Assert.assertEquals(202 , message.getRepeatedInt64 (0));
- Assert.assertEquals(203 , message.getRepeatedUint32 (0));
- Assert.assertEquals(204 , message.getRepeatedUint64 (0));
- Assert.assertEquals(205 , message.getRepeatedSint32 (0));
- Assert.assertEquals(206 , message.getRepeatedSint64 (0));
- Assert.assertEquals(207 , message.getRepeatedFixed32 (0));
- Assert.assertEquals(208 , message.getRepeatedFixed64 (0));
- Assert.assertEquals(209 , message.getRepeatedSfixed32(0));
- Assert.assertEquals(210 , message.getRepeatedSfixed64(0));
- Assert.assertEquals(211 , message.getRepeatedFloat (0), 0.0);
- Assert.assertEquals(212 , message.getRepeatedDouble (0), 0.0);
- Assert.assertEquals(true , message.getRepeatedBool (0));
- Assert.assertEquals("215", message.getRepeatedString (0));
- Assert.assertEquals(toBytes("216"), message.getRepeatedBytes(0));
-
- Assert.assertEquals(217, message.getRepeatedGroup (0).getA());
- Assert.assertEquals(218, message.getRepeatedNestedMessage (0).getBb());
- Assert.assertEquals(219, message.getRepeatedForeignMessage(0).getC());
- Assert.assertEquals(220, message.getRepeatedImportMessage (0).getD());
- Assert.assertEquals(227, message.getRepeatedLazyMessage (0).getBb());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.BAR, message.getRepeatedNestedEnum (0));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAR, message.getRepeatedForeignEnum(0));
- Assert.assertEquals(ImportEnum.IMPORT_BAR, message.getRepeatedImportEnum(0));
-
- Assert.assertEquals("224", message.getRepeatedStringPiece(0));
- Assert.assertEquals("225", message.getRepeatedCord(0));
-
- Assert.assertEquals(301 , message.getRepeatedInt32 (1));
- Assert.assertEquals(302 , message.getRepeatedInt64 (1));
- Assert.assertEquals(303 , message.getRepeatedUint32 (1));
- Assert.assertEquals(304 , message.getRepeatedUint64 (1));
- Assert.assertEquals(305 , message.getRepeatedSint32 (1));
- Assert.assertEquals(306 , message.getRepeatedSint64 (1));
- Assert.assertEquals(307 , message.getRepeatedFixed32 (1));
- Assert.assertEquals(308 , message.getRepeatedFixed64 (1));
- Assert.assertEquals(309 , message.getRepeatedSfixed32(1));
- Assert.assertEquals(310 , message.getRepeatedSfixed64(1));
- Assert.assertEquals(311 , message.getRepeatedFloat (1), 0.0);
- Assert.assertEquals(312 , message.getRepeatedDouble (1), 0.0);
- Assert.assertEquals(false, message.getRepeatedBool (1));
- Assert.assertEquals("315", message.getRepeatedString (1));
- Assert.assertEquals(toBytes("316"), message.getRepeatedBytes(1));
-
- Assert.assertEquals(317, message.getRepeatedGroup (1).getA());
- Assert.assertEquals(318, message.getRepeatedNestedMessage (1).getBb());
- Assert.assertEquals(319, message.getRepeatedForeignMessage(1).getC());
- Assert.assertEquals(320, message.getRepeatedImportMessage (1).getD());
- Assert.assertEquals(327, message.getRepeatedLazyMessage (1).getBb());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.BAZ, message.getRepeatedNestedEnum (1));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAZ, message.getRepeatedForeignEnum(1));
- Assert.assertEquals(ImportEnum.IMPORT_BAZ, message.getRepeatedImportEnum(1));
-
- Assert.assertEquals("324", message.getRepeatedStringPiece(1));
- Assert.assertEquals("325", message.getRepeatedCord(1));
-
- // -----------------------------------------------------------------
-
- Assert.assertTrue(message.hasDefaultInt32 ());
- Assert.assertTrue(message.hasDefaultInt64 ());
- Assert.assertTrue(message.hasDefaultUint32 ());
- Assert.assertTrue(message.hasDefaultUint64 ());
- Assert.assertTrue(message.hasDefaultSint32 ());
- Assert.assertTrue(message.hasDefaultSint64 ());
- Assert.assertTrue(message.hasDefaultFixed32 ());
- Assert.assertTrue(message.hasDefaultFixed64 ());
- Assert.assertTrue(message.hasDefaultSfixed32());
- Assert.assertTrue(message.hasDefaultSfixed64());
- Assert.assertTrue(message.hasDefaultFloat ());
- Assert.assertTrue(message.hasDefaultDouble ());
- Assert.assertTrue(message.hasDefaultBool ());
- Assert.assertTrue(message.hasDefaultString ());
- Assert.assertTrue(message.hasDefaultBytes ());
-
- Assert.assertTrue(message.hasDefaultNestedEnum ());
- Assert.assertTrue(message.hasDefaultForeignEnum());
- Assert.assertTrue(message.hasDefaultImportEnum ());
-
- Assert.assertTrue(message.hasDefaultStringPiece());
- Assert.assertTrue(message.hasDefaultCord());
-
- Assert.assertEquals(401 , message.getDefaultInt32 ());
- Assert.assertEquals(402 , message.getDefaultInt64 ());
- Assert.assertEquals(403 , message.getDefaultUint32 ());
- Assert.assertEquals(404 , message.getDefaultUint64 ());
- Assert.assertEquals(405 , message.getDefaultSint32 ());
- Assert.assertEquals(406 , message.getDefaultSint64 ());
- Assert.assertEquals(407 , message.getDefaultFixed32 ());
- Assert.assertEquals(408 , message.getDefaultFixed64 ());
- Assert.assertEquals(409 , message.getDefaultSfixed32());
- Assert.assertEquals(410 , message.getDefaultSfixed64());
- Assert.assertEquals(411 , message.getDefaultFloat (), 0.0);
- Assert.assertEquals(412 , message.getDefaultDouble (), 0.0);
- Assert.assertEquals(false, message.getDefaultBool ());
- Assert.assertEquals("415", message.getDefaultString ());
- Assert.assertEquals(toBytes("416"), message.getDefaultBytes());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.FOO, message.getDefaultNestedEnum ());
- Assert.assertEquals(ForeignEnum.FOREIGN_FOO, message.getDefaultForeignEnum());
- Assert.assertEquals(ImportEnum.IMPORT_FOO, message.getDefaultImportEnum());
-
- Assert.assertEquals("424", message.getDefaultStringPiece());
- Assert.assertEquals("425", message.getDefaultCord());
- }
-
- // -------------------------------------------------------------------
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are cleared, and that getting the fields returns their
- * default values.
- */
- public static void assertClear(TestAllTypesOrBuilder message) {
- // hasBlah() should initially be false for all optional fields.
- Assert.assertFalse(message.hasOptionalInt32 ());
- Assert.assertFalse(message.hasOptionalInt64 ());
- Assert.assertFalse(message.hasOptionalUint32 ());
- Assert.assertFalse(message.hasOptionalUint64 ());
- Assert.assertFalse(message.hasOptionalSint32 ());
- Assert.assertFalse(message.hasOptionalSint64 ());
- Assert.assertFalse(message.hasOptionalFixed32 ());
- Assert.assertFalse(message.hasOptionalFixed64 ());
- Assert.assertFalse(message.hasOptionalSfixed32());
- Assert.assertFalse(message.hasOptionalSfixed64());
- Assert.assertFalse(message.hasOptionalFloat ());
- Assert.assertFalse(message.hasOptionalDouble ());
- Assert.assertFalse(message.hasOptionalBool ());
- Assert.assertFalse(message.hasOptionalString ());
- Assert.assertFalse(message.hasOptionalBytes ());
-
- Assert.assertFalse(message.hasOptionalGroup ());
- Assert.assertFalse(message.hasOptionalNestedMessage ());
- Assert.assertFalse(message.hasOptionalForeignMessage());
- Assert.assertFalse(message.hasOptionalImportMessage ());
-
- Assert.assertFalse(message.hasOptionalNestedEnum ());
- Assert.assertFalse(message.hasOptionalForeignEnum());
- Assert.assertFalse(message.hasOptionalImportEnum ());
-
- Assert.assertFalse(message.hasOptionalStringPiece());
- Assert.assertFalse(message.hasOptionalCord());
-
- // Optional fields without defaults are set to zero or something like it.
- Assert.assertEquals(0 , message.getOptionalInt32 ());
- Assert.assertEquals(0 , message.getOptionalInt64 ());
- Assert.assertEquals(0 , message.getOptionalUint32 ());
- Assert.assertEquals(0 , message.getOptionalUint64 ());
- Assert.assertEquals(0 , message.getOptionalSint32 ());
- Assert.assertEquals(0 , message.getOptionalSint64 ());
- Assert.assertEquals(0 , message.getOptionalFixed32 ());
- Assert.assertEquals(0 , message.getOptionalFixed64 ());
- Assert.assertEquals(0 , message.getOptionalSfixed32());
- Assert.assertEquals(0 , message.getOptionalSfixed64());
- Assert.assertEquals(0 , message.getOptionalFloat (), 0.0);
- Assert.assertEquals(0 , message.getOptionalDouble (), 0.0);
- Assert.assertEquals(false, message.getOptionalBool ());
- Assert.assertEquals("" , message.getOptionalString ());
- Assert.assertEquals(ByteString.EMPTY, message.getOptionalBytes());
-
- // Embedded messages should also be clear.
- Assert.assertFalse(message.getOptionalGroup ().hasA());
- Assert.assertFalse(message.getOptionalNestedMessage ().hasBb());
- Assert.assertFalse(message.getOptionalForeignMessage ().hasC());
- Assert.assertFalse(message.getOptionalImportMessage ().hasD());
- Assert.assertFalse(message.getOptionalPublicImportMessage().hasE());
- Assert.assertFalse(message.getOptionalLazyMessage ().hasBb());
-
- Assert.assertEquals(0, message.getOptionalGroup ().getA());
- Assert.assertEquals(0, message.getOptionalNestedMessage ().getBb());
- Assert.assertEquals(0, message.getOptionalForeignMessage ().getC());
- Assert.assertEquals(0, message.getOptionalImportMessage ().getD());
- Assert.assertEquals(0, message.getOptionalPublicImportMessage().getE());
- Assert.assertEquals(0, message.getOptionalLazyMessage ().getBb());
-
- // Enums without defaults are set to the first value in the enum.
- Assert.assertEquals(TestAllTypes.NestedEnum.FOO, message.getOptionalNestedEnum ());
- Assert.assertEquals(ForeignEnum.FOREIGN_FOO, message.getOptionalForeignEnum());
- Assert.assertEquals(ImportEnum.IMPORT_FOO, message.getOptionalImportEnum());
-
- Assert.assertEquals("", message.getOptionalStringPiece());
- Assert.assertEquals("", message.getOptionalCord());
-
- // Repeated fields are empty.
- Assert.assertEquals(0, message.getRepeatedInt32Count ());
- Assert.assertEquals(0, message.getRepeatedInt64Count ());
- Assert.assertEquals(0, message.getRepeatedUint32Count ());
- Assert.assertEquals(0, message.getRepeatedUint64Count ());
- Assert.assertEquals(0, message.getRepeatedSint32Count ());
- Assert.assertEquals(0, message.getRepeatedSint64Count ());
- Assert.assertEquals(0, message.getRepeatedFixed32Count ());
- Assert.assertEquals(0, message.getRepeatedFixed64Count ());
- Assert.assertEquals(0, message.getRepeatedSfixed32Count());
- Assert.assertEquals(0, message.getRepeatedSfixed64Count());
- Assert.assertEquals(0, message.getRepeatedFloatCount ());
- Assert.assertEquals(0, message.getRepeatedDoubleCount ());
- Assert.assertEquals(0, message.getRepeatedBoolCount ());
- Assert.assertEquals(0, message.getRepeatedStringCount ());
- Assert.assertEquals(0, message.getRepeatedBytesCount ());
-
- Assert.assertEquals(0, message.getRepeatedGroupCount ());
- Assert.assertEquals(0, message.getRepeatedNestedMessageCount ());
- Assert.assertEquals(0, message.getRepeatedForeignMessageCount());
- Assert.assertEquals(0, message.getRepeatedImportMessageCount ());
- Assert.assertEquals(0, message.getRepeatedLazyMessageCount ());
- Assert.assertEquals(0, message.getRepeatedNestedEnumCount ());
- Assert.assertEquals(0, message.getRepeatedForeignEnumCount ());
- Assert.assertEquals(0, message.getRepeatedImportEnumCount ());
-
- Assert.assertEquals(0, message.getRepeatedStringPieceCount());
- Assert.assertEquals(0, message.getRepeatedCordCount());
-
- // hasBlah() should also be false for all default fields.
- Assert.assertFalse(message.hasDefaultInt32 ());
- Assert.assertFalse(message.hasDefaultInt64 ());
- Assert.assertFalse(message.hasDefaultUint32 ());
- Assert.assertFalse(message.hasDefaultUint64 ());
- Assert.assertFalse(message.hasDefaultSint32 ());
- Assert.assertFalse(message.hasDefaultSint64 ());
- Assert.assertFalse(message.hasDefaultFixed32 ());
- Assert.assertFalse(message.hasDefaultFixed64 ());
- Assert.assertFalse(message.hasDefaultSfixed32());
- Assert.assertFalse(message.hasDefaultSfixed64());
- Assert.assertFalse(message.hasDefaultFloat ());
- Assert.assertFalse(message.hasDefaultDouble ());
- Assert.assertFalse(message.hasDefaultBool ());
- Assert.assertFalse(message.hasDefaultString ());
- Assert.assertFalse(message.hasDefaultBytes ());
-
- Assert.assertFalse(message.hasDefaultNestedEnum ());
- Assert.assertFalse(message.hasDefaultForeignEnum());
- Assert.assertFalse(message.hasDefaultImportEnum ());
-
- Assert.assertFalse(message.hasDefaultStringPiece());
- Assert.assertFalse(message.hasDefaultCord());
-
- // Fields with defaults have their default values (duh).
- Assert.assertEquals( 41 , message.getDefaultInt32 ());
- Assert.assertEquals( 42 , message.getDefaultInt64 ());
- Assert.assertEquals( 43 , message.getDefaultUint32 ());
- Assert.assertEquals( 44 , message.getDefaultUint64 ());
- Assert.assertEquals(-45 , message.getDefaultSint32 ());
- Assert.assertEquals( 46 , message.getDefaultSint64 ());
- Assert.assertEquals( 47 , message.getDefaultFixed32 ());
- Assert.assertEquals( 48 , message.getDefaultFixed64 ());
- Assert.assertEquals( 49 , message.getDefaultSfixed32());
- Assert.assertEquals(-50 , message.getDefaultSfixed64());
- Assert.assertEquals( 51.5 , message.getDefaultFloat (), 0.0);
- Assert.assertEquals( 52e3 , message.getDefaultDouble (), 0.0);
- Assert.assertEquals(true , message.getDefaultBool ());
- Assert.assertEquals("hello", message.getDefaultString ());
- Assert.assertEquals(toBytes("world"), message.getDefaultBytes());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.BAR, message.getDefaultNestedEnum ());
- Assert.assertEquals(ForeignEnum.FOREIGN_BAR, message.getDefaultForeignEnum());
- Assert.assertEquals(ImportEnum.IMPORT_BAR, message.getDefaultImportEnum());
-
- Assert.assertEquals("abc", message.getDefaultStringPiece());
- Assert.assertEquals("123", message.getDefaultCord());
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are set to the values assigned by {@code setAllFields}
- * followed by {@code modifyRepeatedFields}.
- */
- public static void assertRepeatedFieldsModified(
- TestAllTypesOrBuilder message) {
- // ModifyRepeatedFields only sets the second repeated element of each
- // field. In addition to verifying this, we also verify that the first
- // element and size were *not* modified.
- Assert.assertEquals(2, message.getRepeatedInt32Count ());
- Assert.assertEquals(2, message.getRepeatedInt64Count ());
- Assert.assertEquals(2, message.getRepeatedUint32Count ());
- Assert.assertEquals(2, message.getRepeatedUint64Count ());
- Assert.assertEquals(2, message.getRepeatedSint32Count ());
- Assert.assertEquals(2, message.getRepeatedSint64Count ());
- Assert.assertEquals(2, message.getRepeatedFixed32Count ());
- Assert.assertEquals(2, message.getRepeatedFixed64Count ());
- Assert.assertEquals(2, message.getRepeatedSfixed32Count());
- Assert.assertEquals(2, message.getRepeatedSfixed64Count());
- Assert.assertEquals(2, message.getRepeatedFloatCount ());
- Assert.assertEquals(2, message.getRepeatedDoubleCount ());
- Assert.assertEquals(2, message.getRepeatedBoolCount ());
- Assert.assertEquals(2, message.getRepeatedStringCount ());
- Assert.assertEquals(2, message.getRepeatedBytesCount ());
-
- Assert.assertEquals(2, message.getRepeatedGroupCount ());
- Assert.assertEquals(2, message.getRepeatedNestedMessageCount ());
- Assert.assertEquals(2, message.getRepeatedForeignMessageCount());
- Assert.assertEquals(2, message.getRepeatedImportMessageCount ());
- Assert.assertEquals(2, message.getRepeatedLazyMessageCount ());
- Assert.assertEquals(2, message.getRepeatedNestedEnumCount ());
- Assert.assertEquals(2, message.getRepeatedForeignEnumCount ());
- Assert.assertEquals(2, message.getRepeatedImportEnumCount ());
-
- Assert.assertEquals(2, message.getRepeatedStringPieceCount());
- Assert.assertEquals(2, message.getRepeatedCordCount());
-
- Assert.assertEquals(201 , message.getRepeatedInt32 (0));
- Assert.assertEquals(202L , message.getRepeatedInt64 (0));
- Assert.assertEquals(203 , message.getRepeatedUint32 (0));
- Assert.assertEquals(204L , message.getRepeatedUint64 (0));
- Assert.assertEquals(205 , message.getRepeatedSint32 (0));
- Assert.assertEquals(206L , message.getRepeatedSint64 (0));
- Assert.assertEquals(207 , message.getRepeatedFixed32 (0));
- Assert.assertEquals(208L , message.getRepeatedFixed64 (0));
- Assert.assertEquals(209 , message.getRepeatedSfixed32(0));
- Assert.assertEquals(210L , message.getRepeatedSfixed64(0));
- Assert.assertEquals(211F , message.getRepeatedFloat (0));
- Assert.assertEquals(212D , message.getRepeatedDouble (0));
- Assert.assertEquals(true , message.getRepeatedBool (0));
- Assert.assertEquals("215", message.getRepeatedString (0));
- Assert.assertEquals(toBytes("216"), message.getRepeatedBytes(0));
-
- Assert.assertEquals(217, message.getRepeatedGroup (0).getA());
- Assert.assertEquals(218, message.getRepeatedNestedMessage (0).getBb());
- Assert.assertEquals(219, message.getRepeatedForeignMessage(0).getC());
- Assert.assertEquals(220, message.getRepeatedImportMessage (0).getD());
- Assert.assertEquals(227, message.getRepeatedLazyMessage (0).getBb());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.BAR, message.getRepeatedNestedEnum (0));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAR, message.getRepeatedForeignEnum(0));
- Assert.assertEquals(ImportEnum.IMPORT_BAR, message.getRepeatedImportEnum(0));
-
- Assert.assertEquals("224", message.getRepeatedStringPiece(0));
- Assert.assertEquals("225", message.getRepeatedCord(0));
-
- // Actually verify the second (modified) elements now.
- Assert.assertEquals(501 , message.getRepeatedInt32 (1));
- Assert.assertEquals(502L , message.getRepeatedInt64 (1));
- Assert.assertEquals(503 , message.getRepeatedUint32 (1));
- Assert.assertEquals(504L , message.getRepeatedUint64 (1));
- Assert.assertEquals(505 , message.getRepeatedSint32 (1));
- Assert.assertEquals(506L , message.getRepeatedSint64 (1));
- Assert.assertEquals(507 , message.getRepeatedFixed32 (1));
- Assert.assertEquals(508L , message.getRepeatedFixed64 (1));
- Assert.assertEquals(509 , message.getRepeatedSfixed32(1));
- Assert.assertEquals(510L , message.getRepeatedSfixed64(1));
- Assert.assertEquals(511F , message.getRepeatedFloat (1));
- Assert.assertEquals(512D , message.getRepeatedDouble (1));
- Assert.assertEquals(true , message.getRepeatedBool (1));
- Assert.assertEquals("515", message.getRepeatedString (1));
- Assert.assertEquals(toBytes("516"), message.getRepeatedBytes(1));
-
- Assert.assertEquals(517, message.getRepeatedGroup (1).getA());
- Assert.assertEquals(518, message.getRepeatedNestedMessage (1).getBb());
- Assert.assertEquals(519, message.getRepeatedForeignMessage(1).getC());
- Assert.assertEquals(520, message.getRepeatedImportMessage (1).getD());
- Assert.assertEquals(527, message.getRepeatedLazyMessage (1).getBb());
-
- Assert.assertEquals(TestAllTypes.NestedEnum.FOO, message.getRepeatedNestedEnum (1));
- Assert.assertEquals(ForeignEnum.FOREIGN_FOO, message.getRepeatedForeignEnum(1));
- Assert.assertEquals(ImportEnum.IMPORT_FOO, message.getRepeatedImportEnum(1));
-
- Assert.assertEquals("524", message.getRepeatedStringPiece(1));
- Assert.assertEquals("525", message.getRepeatedCord(1));
- }
-
- /**
- * Set every field of {@code message} to a unique value.
- */
- public static void setPackedFields(TestPackedTypes.Builder message) {
- message.addPackedInt32 (601);
- message.addPackedInt64 (602);
- message.addPackedUint32 (603);
- message.addPackedUint64 (604);
- message.addPackedSint32 (605);
- message.addPackedSint64 (606);
- message.addPackedFixed32 (607);
- message.addPackedFixed64 (608);
- message.addPackedSfixed32(609);
- message.addPackedSfixed64(610);
- message.addPackedFloat (611);
- message.addPackedDouble (612);
- message.addPackedBool (true);
- message.addPackedEnum (ForeignEnum.FOREIGN_BAR);
- // Add a second one of each field.
- message.addPackedInt32 (701);
- message.addPackedInt64 (702);
- message.addPackedUint32 (703);
- message.addPackedUint64 (704);
- message.addPackedSint32 (705);
- message.addPackedSint64 (706);
- message.addPackedFixed32 (707);
- message.addPackedFixed64 (708);
- message.addPackedSfixed32(709);
- message.addPackedSfixed64(710);
- message.addPackedFloat (711);
- message.addPackedDouble (712);
- message.addPackedBool (false);
- message.addPackedEnum (ForeignEnum.FOREIGN_BAZ);
- }
-
- /**
- * Set every field of {@code message} to a unique value. Must correspond with
- * the values applied by {@code setPackedFields}.
- */
- public static void setUnpackedFields(TestUnpackedTypes.Builder message) {
- message.addUnpackedInt32 (601);
- message.addUnpackedInt64 (602);
- message.addUnpackedUint32 (603);
- message.addUnpackedUint64 (604);
- message.addUnpackedSint32 (605);
- message.addUnpackedSint64 (606);
- message.addUnpackedFixed32 (607);
- message.addUnpackedFixed64 (608);
- message.addUnpackedSfixed32(609);
- message.addUnpackedSfixed64(610);
- message.addUnpackedFloat (611);
- message.addUnpackedDouble (612);
- message.addUnpackedBool (true);
- message.addUnpackedEnum (ForeignEnum.FOREIGN_BAR);
- // Add a second one of each field.
- message.addUnpackedInt32 (701);
- message.addUnpackedInt64 (702);
- message.addUnpackedUint32 (703);
- message.addUnpackedUint64 (704);
- message.addUnpackedSint32 (705);
- message.addUnpackedSint64 (706);
- message.addUnpackedFixed32 (707);
- message.addUnpackedFixed64 (708);
- message.addUnpackedSfixed32(709);
- message.addUnpackedSfixed64(710);
- message.addUnpackedFloat (711);
- message.addUnpackedDouble (712);
- message.addUnpackedBool (false);
- message.addUnpackedEnum (ForeignEnum.FOREIGN_BAZ);
- }
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are set to the values assigned by {@code setPackedFields}.
- */
- public static void assertPackedFieldsSet(TestPackedTypes message) {
- Assert.assertEquals(2, message.getPackedInt32Count ());
- Assert.assertEquals(2, message.getPackedInt64Count ());
- Assert.assertEquals(2, message.getPackedUint32Count ());
- Assert.assertEquals(2, message.getPackedUint64Count ());
- Assert.assertEquals(2, message.getPackedSint32Count ());
- Assert.assertEquals(2, message.getPackedSint64Count ());
- Assert.assertEquals(2, message.getPackedFixed32Count ());
- Assert.assertEquals(2, message.getPackedFixed64Count ());
- Assert.assertEquals(2, message.getPackedSfixed32Count());
- Assert.assertEquals(2, message.getPackedSfixed64Count());
- Assert.assertEquals(2, message.getPackedFloatCount ());
- Assert.assertEquals(2, message.getPackedDoubleCount ());
- Assert.assertEquals(2, message.getPackedBoolCount ());
- Assert.assertEquals(2, message.getPackedEnumCount ());
- Assert.assertEquals(601 , message.getPackedInt32 (0));
- Assert.assertEquals(602 , message.getPackedInt64 (0));
- Assert.assertEquals(603 , message.getPackedUint32 (0));
- Assert.assertEquals(604 , message.getPackedUint64 (0));
- Assert.assertEquals(605 , message.getPackedSint32 (0));
- Assert.assertEquals(606 , message.getPackedSint64 (0));
- Assert.assertEquals(607 , message.getPackedFixed32 (0));
- Assert.assertEquals(608 , message.getPackedFixed64 (0));
- Assert.assertEquals(609 , message.getPackedSfixed32(0));
- Assert.assertEquals(610 , message.getPackedSfixed64(0));
- Assert.assertEquals(611 , message.getPackedFloat (0), 0.0);
- Assert.assertEquals(612 , message.getPackedDouble (0), 0.0);
- Assert.assertEquals(true , message.getPackedBool (0));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAR, message.getPackedEnum(0));
- Assert.assertEquals(701 , message.getPackedInt32 (1));
- Assert.assertEquals(702 , message.getPackedInt64 (1));
- Assert.assertEquals(703 , message.getPackedUint32 (1));
- Assert.assertEquals(704 , message.getPackedUint64 (1));
- Assert.assertEquals(705 , message.getPackedSint32 (1));
- Assert.assertEquals(706 , message.getPackedSint64 (1));
- Assert.assertEquals(707 , message.getPackedFixed32 (1));
- Assert.assertEquals(708 , message.getPackedFixed64 (1));
- Assert.assertEquals(709 , message.getPackedSfixed32(1));
- Assert.assertEquals(710 , message.getPackedSfixed64(1));
- Assert.assertEquals(711 , message.getPackedFloat (1), 0.0);
- Assert.assertEquals(712 , message.getPackedDouble (1), 0.0);
- Assert.assertEquals(false, message.getPackedBool (1));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAZ, message.getPackedEnum(1));
- }
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are set to the values assigned by {@code setUnpackedFields}.
- */
- public static void assertUnpackedFieldsSet(TestUnpackedTypes message) {
- Assert.assertEquals(2, message.getUnpackedInt32Count ());
- Assert.assertEquals(2, message.getUnpackedInt64Count ());
- Assert.assertEquals(2, message.getUnpackedUint32Count ());
- Assert.assertEquals(2, message.getUnpackedUint64Count ());
- Assert.assertEquals(2, message.getUnpackedSint32Count ());
- Assert.assertEquals(2, message.getUnpackedSint64Count ());
- Assert.assertEquals(2, message.getUnpackedFixed32Count ());
- Assert.assertEquals(2, message.getUnpackedFixed64Count ());
- Assert.assertEquals(2, message.getUnpackedSfixed32Count());
- Assert.assertEquals(2, message.getUnpackedSfixed64Count());
- Assert.assertEquals(2, message.getUnpackedFloatCount ());
- Assert.assertEquals(2, message.getUnpackedDoubleCount ());
- Assert.assertEquals(2, message.getUnpackedBoolCount ());
- Assert.assertEquals(2, message.getUnpackedEnumCount ());
- Assert.assertEquals(601 , message.getUnpackedInt32 (0));
- Assert.assertEquals(602 , message.getUnpackedInt64 (0));
- Assert.assertEquals(603 , message.getUnpackedUint32 (0));
- Assert.assertEquals(604 , message.getUnpackedUint64 (0));
- Assert.assertEquals(605 , message.getUnpackedSint32 (0));
- Assert.assertEquals(606 , message.getUnpackedSint64 (0));
- Assert.assertEquals(607 , message.getUnpackedFixed32 (0));
- Assert.assertEquals(608 , message.getUnpackedFixed64 (0));
- Assert.assertEquals(609 , message.getUnpackedSfixed32(0));
- Assert.assertEquals(610 , message.getUnpackedSfixed64(0));
- Assert.assertEquals(611 , message.getUnpackedFloat (0), 0.0);
- Assert.assertEquals(612 , message.getUnpackedDouble (0), 0.0);
- Assert.assertEquals(true , message.getUnpackedBool (0));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAR, message.getUnpackedEnum(0));
- Assert.assertEquals(701 , message.getUnpackedInt32 (1));
- Assert.assertEquals(702 , message.getUnpackedInt64 (1));
- Assert.assertEquals(703 , message.getUnpackedUint32 (1));
- Assert.assertEquals(704 , message.getUnpackedUint64 (1));
- Assert.assertEquals(705 , message.getUnpackedSint32 (1));
- Assert.assertEquals(706 , message.getUnpackedSint64 (1));
- Assert.assertEquals(707 , message.getUnpackedFixed32 (1));
- Assert.assertEquals(708 , message.getUnpackedFixed64 (1));
- Assert.assertEquals(709 , message.getUnpackedSfixed32(1));
- Assert.assertEquals(710 , message.getUnpackedSfixed64(1));
- Assert.assertEquals(711 , message.getUnpackedFloat (1), 0.0);
- Assert.assertEquals(712 , message.getUnpackedDouble (1), 0.0);
- Assert.assertEquals(false, message.getUnpackedBool (1));
- Assert.assertEquals(ForeignEnum.FOREIGN_BAZ, message.getUnpackedEnum(1));
- }
-
- // ===================================================================
- // Like above, but for extensions
-
- // Java gets confused with things like assertEquals(int, Integer): it can't
- // decide whether to call assertEquals(int, int) or assertEquals(Object,
- // Object). So we define these methods to help it.
- private static void assertEqualsExactType(int a, int b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(long a, long b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(float a, float b) {
- Assert.assertEquals(a, b, 0.0);
- }
- private static void assertEqualsExactType(double a, double b) {
- Assert.assertEquals(a, b, 0.0);
- }
- private static void assertEqualsExactType(boolean a, boolean b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(String a, String b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(ByteString a, ByteString b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(TestAllTypes.NestedEnum a,
- TestAllTypes.NestedEnum b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(ForeignEnum a, ForeignEnum b) {
- Assert.assertEquals(a, b);
- }
- private static void assertEqualsExactType(ImportEnum a, ImportEnum b) {
- Assert.assertEquals(a, b);
- }
- /**
- * Get an unmodifiable {@link ExtensionRegistry} containing all the
- * extensions of {@code TestAllExtensions}.
- */
- public static ExtensionRegistry getExtensionRegistry() {
- ExtensionRegistry registry = ExtensionRegistry.newInstance();
- registerAllExtensions(registry);
- return registry.getUnmodifiable();
- }
-
-
- /**
- * Register all of {@code TestAllExtensions}'s extensions with the
- * given {@link ExtensionRegistry}.
- */
- public static void registerAllExtensions(ExtensionRegistry registry) {
- UnittestProto.registerAllExtensions(registry);
- }
-
-
- /**
- * Set every field of {@code message} to the values expected by
- * {@code assertAllExtensionsSet()}.
- */
- public static void setAllExtensions(TestAllExtensions.Builder message) {
- message.setExtension(optionalInt32Extension , 101);
- message.setExtension(optionalInt64Extension , 102L);
- message.setExtension(optionalUint32Extension , 103);
- message.setExtension(optionalUint64Extension , 104L);
- message.setExtension(optionalSint32Extension , 105);
- message.setExtension(optionalSint64Extension , 106L);
- message.setExtension(optionalFixed32Extension , 107);
- message.setExtension(optionalFixed64Extension , 108L);
- message.setExtension(optionalSfixed32Extension, 109);
- message.setExtension(optionalSfixed64Extension, 110L);
- message.setExtension(optionalFloatExtension , 111F);
- message.setExtension(optionalDoubleExtension , 112D);
- message.setExtension(optionalBoolExtension , true);
- message.setExtension(optionalStringExtension , "115");
- message.setExtension(optionalBytesExtension , toBytes("116"));
-
- message.setExtension(optionalGroupExtension,
- OptionalGroup_extension.newBuilder().setA(117).build());
- message.setExtension(optionalNestedMessageExtension,
- TestAllTypes.NestedMessage.newBuilder().setBb(118).build());
- message.setExtension(optionalForeignMessageExtension,
- ForeignMessage.newBuilder().setC(119).build());
- message.setExtension(optionalImportMessageExtension,
- ImportMessage.newBuilder().setD(120).build());
- message.setExtension(optionalPublicImportMessageExtension,
- PublicImportMessage.newBuilder().setE(126).build());
- message.setExtension(optionalLazyMessageExtension,
- TestAllTypes.NestedMessage.newBuilder().setBb(127).build());
-
- message.setExtension(optionalNestedEnumExtension, TestAllTypes.NestedEnum.BAZ);
- message.setExtension(optionalForeignEnumExtension, ForeignEnum.FOREIGN_BAZ);
- message.setExtension(optionalImportEnumExtension, ImportEnum.IMPORT_BAZ);
-
- message.setExtension(optionalStringPieceExtension, "124");
- message.setExtension(optionalCordExtension, "125");
-
- // -----------------------------------------------------------------
-
- message.addExtension(repeatedInt32Extension , 201);
- message.addExtension(repeatedInt64Extension , 202L);
- message.addExtension(repeatedUint32Extension , 203);
- message.addExtension(repeatedUint64Extension , 204L);
- message.addExtension(repeatedSint32Extension , 205);
- message.addExtension(repeatedSint64Extension , 206L);
- message.addExtension(repeatedFixed32Extension , 207);
- message.addExtension(repeatedFixed64Extension , 208L);
- message.addExtension(repeatedSfixed32Extension, 209);
- message.addExtension(repeatedSfixed64Extension, 210L);
- message.addExtension(repeatedFloatExtension , 211F);
- message.addExtension(repeatedDoubleExtension , 212D);
- message.addExtension(repeatedBoolExtension , true);
- message.addExtension(repeatedStringExtension , "215");
- message.addExtension(repeatedBytesExtension , toBytes("216"));
-
- message.addExtension(repeatedGroupExtension,
- RepeatedGroup_extension.newBuilder().setA(217).build());
- message.addExtension(repeatedNestedMessageExtension,
- TestAllTypes.NestedMessage.newBuilder().setBb(218).build());
- message.addExtension(repeatedForeignMessageExtension,
- ForeignMessage.newBuilder().setC(219).build());
- message.addExtension(repeatedImportMessageExtension,
- ImportMessage.newBuilder().setD(220).build());
- message.addExtension(repeatedLazyMessageExtension,
- TestAllTypes.NestedMessage.newBuilder().setBb(227).build());
-
- message.addExtension(repeatedNestedEnumExtension, TestAllTypes.NestedEnum.BAR);
- message.addExtension(repeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAR);
- message.addExtension(repeatedImportEnumExtension, ImportEnum.IMPORT_BAR);
-
- message.addExtension(repeatedStringPieceExtension, "224");
- message.addExtension(repeatedCordExtension, "225");
-
- // Add a second one of each field.
- message.addExtension(repeatedInt32Extension , 301);
- message.addExtension(repeatedInt64Extension , 302L);
- message.addExtension(repeatedUint32Extension , 303);
- message.addExtension(repeatedUint64Extension , 304L);
- message.addExtension(repeatedSint32Extension , 305);
- message.addExtension(repeatedSint64Extension , 306L);
- message.addExtension(repeatedFixed32Extension , 307);
- message.addExtension(repeatedFixed64Extension , 308L);
- message.addExtension(repeatedSfixed32Extension, 309);
- message.addExtension(repeatedSfixed64Extension, 310L);
- message.addExtension(repeatedFloatExtension , 311F);
- message.addExtension(repeatedDoubleExtension , 312D);
- message.addExtension(repeatedBoolExtension , false);
- message.addExtension(repeatedStringExtension , "315");
- message.addExtension(repeatedBytesExtension , toBytes("316"));
-
- message.addExtension(repeatedGroupExtension,
- RepeatedGroup_extension.newBuilder().setA(317).build());
- message.addExtension(repeatedNestedMessageExtension,
- TestAllTypes.NestedMessage.newBuilder().setBb(318).build());
- message.addExtension(repeatedForeignMessageExtension,
- ForeignMessage.newBuilder().setC(319).build());
- message.addExtension(repeatedImportMessageExtension,
- ImportMessage.newBuilder().setD(320).build());
- message.addExtension(repeatedLazyMessageExtension,
- TestAllTypes.NestedMessage.newBuilder().setBb(327).build());
-
- message.addExtension(repeatedNestedEnumExtension, TestAllTypes.NestedEnum.BAZ);
- message.addExtension(repeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAZ);
- message.addExtension(repeatedImportEnumExtension, ImportEnum.IMPORT_BAZ);
-
- message.addExtension(repeatedStringPieceExtension, "324");
- message.addExtension(repeatedCordExtension, "325");
-
- // -----------------------------------------------------------------
-
- message.setExtension(defaultInt32Extension , 401);
- message.setExtension(defaultInt64Extension , 402L);
- message.setExtension(defaultUint32Extension , 403);
- message.setExtension(defaultUint64Extension , 404L);
- message.setExtension(defaultSint32Extension , 405);
- message.setExtension(defaultSint64Extension , 406L);
- message.setExtension(defaultFixed32Extension , 407);
- message.setExtension(defaultFixed64Extension , 408L);
- message.setExtension(defaultSfixed32Extension, 409);
- message.setExtension(defaultSfixed64Extension, 410L);
- message.setExtension(defaultFloatExtension , 411F);
- message.setExtension(defaultDoubleExtension , 412D);
- message.setExtension(defaultBoolExtension , false);
- message.setExtension(defaultStringExtension , "415");
- message.setExtension(defaultBytesExtension , toBytes("416"));
-
- message.setExtension(defaultNestedEnumExtension, TestAllTypes.NestedEnum.FOO);
- message.setExtension(defaultForeignEnumExtension, ForeignEnum.FOREIGN_FOO);
- message.setExtension(defaultImportEnumExtension, ImportEnum.IMPORT_FOO);
-
- message.setExtension(defaultStringPieceExtension, "424");
- message.setExtension(defaultCordExtension, "425");
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Modify the repeated extensions of {@code message} to contain the values
- * expected by {@code assertRepeatedExtensionsModified()}.
- */
- public static void modifyRepeatedExtensions(
- TestAllExtensions.Builder message) {
- message.setExtension(repeatedInt32Extension , 1, 501);
- message.setExtension(repeatedInt64Extension , 1, 502L);
- message.setExtension(repeatedUint32Extension , 1, 503);
- message.setExtension(repeatedUint64Extension , 1, 504L);
- message.setExtension(repeatedSint32Extension , 1, 505);
- message.setExtension(repeatedSint64Extension , 1, 506L);
- message.setExtension(repeatedFixed32Extension , 1, 507);
- message.setExtension(repeatedFixed64Extension , 1, 508L);
- message.setExtension(repeatedSfixed32Extension, 1, 509);
- message.setExtension(repeatedSfixed64Extension, 1, 510L);
- message.setExtension(repeatedFloatExtension , 1, 511F);
- message.setExtension(repeatedDoubleExtension , 1, 512D);
- message.setExtension(repeatedBoolExtension , 1, true);
- message.setExtension(repeatedStringExtension , 1, "515");
- message.setExtension(repeatedBytesExtension , 1, toBytes("516"));
-
- message.setExtension(repeatedGroupExtension, 1,
- RepeatedGroup_extension.newBuilder().setA(517).build());
- message.setExtension(repeatedNestedMessageExtension, 1,
- TestAllTypes.NestedMessage.newBuilder().setBb(518).build());
- message.setExtension(repeatedForeignMessageExtension, 1,
- ForeignMessage.newBuilder().setC(519).build());
- message.setExtension(repeatedImportMessageExtension, 1,
- ImportMessage.newBuilder().setD(520).build());
- message.setExtension(repeatedLazyMessageExtension, 1,
- TestAllTypes.NestedMessage.newBuilder().setBb(527).build());
-
- message.setExtension(repeatedNestedEnumExtension , 1, TestAllTypes.NestedEnum.FOO);
- message.setExtension(repeatedForeignEnumExtension, 1, ForeignEnum.FOREIGN_FOO);
- message.setExtension(repeatedImportEnumExtension , 1, ImportEnum.IMPORT_FOO);
-
- message.setExtension(repeatedStringPieceExtension, 1, "524");
- message.setExtension(repeatedCordExtension, 1, "525");
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all extensions of
- * {@code message} are set to the values assigned by {@code setAllExtensions}.
- */
- public static void assertAllExtensionsSet(
- TestAllExtensionsOrBuilder message) {
- Assert.assertTrue(message.hasExtension(optionalInt32Extension ));
- Assert.assertTrue(message.hasExtension(optionalInt64Extension ));
- Assert.assertTrue(message.hasExtension(optionalUint32Extension ));
- Assert.assertTrue(message.hasExtension(optionalUint64Extension ));
- Assert.assertTrue(message.hasExtension(optionalSint32Extension ));
- Assert.assertTrue(message.hasExtension(optionalSint64Extension ));
- Assert.assertTrue(message.hasExtension(optionalFixed32Extension ));
- Assert.assertTrue(message.hasExtension(optionalFixed64Extension ));
- Assert.assertTrue(message.hasExtension(optionalSfixed32Extension));
- Assert.assertTrue(message.hasExtension(optionalSfixed64Extension));
- Assert.assertTrue(message.hasExtension(optionalFloatExtension ));
- Assert.assertTrue(message.hasExtension(optionalDoubleExtension ));
- Assert.assertTrue(message.hasExtension(optionalBoolExtension ));
- Assert.assertTrue(message.hasExtension(optionalStringExtension ));
- Assert.assertTrue(message.hasExtension(optionalBytesExtension ));
-
- Assert.assertTrue(message.hasExtension(optionalGroupExtension ));
- Assert.assertTrue(message.hasExtension(optionalNestedMessageExtension ));
- Assert.assertTrue(message.hasExtension(optionalForeignMessageExtension));
- Assert.assertTrue(message.hasExtension(optionalImportMessageExtension ));
-
- Assert.assertTrue(message.getExtension(optionalGroupExtension ).hasA());
- Assert.assertTrue(message.getExtension(optionalNestedMessageExtension ).hasBb());
- Assert.assertTrue(message.getExtension(optionalForeignMessageExtension).hasC());
- Assert.assertTrue(message.getExtension(optionalImportMessageExtension ).hasD());
-
- Assert.assertTrue(message.hasExtension(optionalNestedEnumExtension ));
- Assert.assertTrue(message.hasExtension(optionalForeignEnumExtension));
- Assert.assertTrue(message.hasExtension(optionalImportEnumExtension ));
-
- Assert.assertTrue(message.hasExtension(optionalStringPieceExtension));
- Assert.assertTrue(message.hasExtension(optionalCordExtension));
-
- assertEqualsExactType(101 , message.getExtension(optionalInt32Extension ));
- assertEqualsExactType(102L , message.getExtension(optionalInt64Extension ));
- assertEqualsExactType(103 , message.getExtension(optionalUint32Extension ));
- assertEqualsExactType(104L , message.getExtension(optionalUint64Extension ));
- assertEqualsExactType(105 , message.getExtension(optionalSint32Extension ));
- assertEqualsExactType(106L , message.getExtension(optionalSint64Extension ));
- assertEqualsExactType(107 , message.getExtension(optionalFixed32Extension ));
- assertEqualsExactType(108L , message.getExtension(optionalFixed64Extension ));
- assertEqualsExactType(109 , message.getExtension(optionalSfixed32Extension));
- assertEqualsExactType(110L , message.getExtension(optionalSfixed64Extension));
- assertEqualsExactType(111F , message.getExtension(optionalFloatExtension ));
- assertEqualsExactType(112D , message.getExtension(optionalDoubleExtension ));
- assertEqualsExactType(true , message.getExtension(optionalBoolExtension ));
- assertEqualsExactType("115", message.getExtension(optionalStringExtension ));
- assertEqualsExactType(toBytes("116"), message.getExtension(optionalBytesExtension));
-
- assertEqualsExactType(117, message.getExtension(optionalGroupExtension ).getA());
- assertEqualsExactType(118, message.getExtension(optionalNestedMessageExtension ).getBb());
- assertEqualsExactType(119, message.getExtension(optionalForeignMessageExtension ).getC());
- assertEqualsExactType(120, message.getExtension(optionalImportMessageExtension ).getD());
- assertEqualsExactType(126, message.getExtension(optionalPublicImportMessageExtension).getE());
- assertEqualsExactType(127, message.getExtension(optionalLazyMessageExtension ).getBb());
-
- assertEqualsExactType(TestAllTypes.NestedEnum.BAZ,
- message.getExtension(optionalNestedEnumExtension));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAZ,
- message.getExtension(optionalForeignEnumExtension));
- assertEqualsExactType(ImportEnum.IMPORT_BAZ,
- message.getExtension(optionalImportEnumExtension));
-
- assertEqualsExactType("124", message.getExtension(optionalStringPieceExtension));
- assertEqualsExactType("125", message.getExtension(optionalCordExtension));
-
- // -----------------------------------------------------------------
-
- Assert.assertEquals(2, message.getExtensionCount(repeatedInt32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedInt64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedUint32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedUint64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSint32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSint64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedFixed32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedFixed64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSfixed32Extension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSfixed64Extension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedFloatExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedDoubleExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedBoolExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedStringExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedBytesExtension ));
-
- Assert.assertEquals(2, message.getExtensionCount(repeatedGroupExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedNestedMessageExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedForeignMessageExtension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedImportMessageExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedLazyMessageExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedNestedEnumExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedForeignEnumExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedImportEnumExtension ));
-
- Assert.assertEquals(2, message.getExtensionCount(repeatedStringPieceExtension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedCordExtension));
-
- assertEqualsExactType(201 , message.getExtension(repeatedInt32Extension , 0));
- assertEqualsExactType(202L , message.getExtension(repeatedInt64Extension , 0));
- assertEqualsExactType(203 , message.getExtension(repeatedUint32Extension , 0));
- assertEqualsExactType(204L , message.getExtension(repeatedUint64Extension , 0));
- assertEqualsExactType(205 , message.getExtension(repeatedSint32Extension , 0));
- assertEqualsExactType(206L , message.getExtension(repeatedSint64Extension , 0));
- assertEqualsExactType(207 , message.getExtension(repeatedFixed32Extension , 0));
- assertEqualsExactType(208L , message.getExtension(repeatedFixed64Extension , 0));
- assertEqualsExactType(209 , message.getExtension(repeatedSfixed32Extension, 0));
- assertEqualsExactType(210L , message.getExtension(repeatedSfixed64Extension, 0));
- assertEqualsExactType(211F , message.getExtension(repeatedFloatExtension , 0));
- assertEqualsExactType(212D , message.getExtension(repeatedDoubleExtension , 0));
- assertEqualsExactType(true , message.getExtension(repeatedBoolExtension , 0));
- assertEqualsExactType("215", message.getExtension(repeatedStringExtension , 0));
- assertEqualsExactType(toBytes("216"), message.getExtension(repeatedBytesExtension, 0));
-
- assertEqualsExactType(217, message.getExtension(repeatedGroupExtension , 0).getA());
- assertEqualsExactType(218, message.getExtension(repeatedNestedMessageExtension , 0).getBb());
- assertEqualsExactType(219, message.getExtension(repeatedForeignMessageExtension, 0).getC());
- assertEqualsExactType(220, message.getExtension(repeatedImportMessageExtension , 0).getD());
- assertEqualsExactType(227, message.getExtension(repeatedLazyMessageExtension , 0).getBb());
-
- assertEqualsExactType(TestAllTypes.NestedEnum.BAR,
- message.getExtension(repeatedNestedEnumExtension, 0));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAR,
- message.getExtension(repeatedForeignEnumExtension, 0));
- assertEqualsExactType(ImportEnum.IMPORT_BAR,
- message.getExtension(repeatedImportEnumExtension, 0));
-
- assertEqualsExactType("224", message.getExtension(repeatedStringPieceExtension, 0));
- assertEqualsExactType("225", message.getExtension(repeatedCordExtension, 0));
-
- assertEqualsExactType(301 , message.getExtension(repeatedInt32Extension , 1));
- assertEqualsExactType(302L , message.getExtension(repeatedInt64Extension , 1));
- assertEqualsExactType(303 , message.getExtension(repeatedUint32Extension , 1));
- assertEqualsExactType(304L , message.getExtension(repeatedUint64Extension , 1));
- assertEqualsExactType(305 , message.getExtension(repeatedSint32Extension , 1));
- assertEqualsExactType(306L , message.getExtension(repeatedSint64Extension , 1));
- assertEqualsExactType(307 , message.getExtension(repeatedFixed32Extension , 1));
- assertEqualsExactType(308L , message.getExtension(repeatedFixed64Extension , 1));
- assertEqualsExactType(309 , message.getExtension(repeatedSfixed32Extension, 1));
- assertEqualsExactType(310L , message.getExtension(repeatedSfixed64Extension, 1));
- assertEqualsExactType(311F , message.getExtension(repeatedFloatExtension , 1));
- assertEqualsExactType(312D , message.getExtension(repeatedDoubleExtension , 1));
- assertEqualsExactType(false, message.getExtension(repeatedBoolExtension , 1));
- assertEqualsExactType("315", message.getExtension(repeatedStringExtension , 1));
- assertEqualsExactType(toBytes("316"), message.getExtension(repeatedBytesExtension, 1));
-
- assertEqualsExactType(317, message.getExtension(repeatedGroupExtension , 1).getA());
- assertEqualsExactType(318, message.getExtension(repeatedNestedMessageExtension , 1).getBb());
- assertEqualsExactType(319, message.getExtension(repeatedForeignMessageExtension, 1).getC());
- assertEqualsExactType(320, message.getExtension(repeatedImportMessageExtension , 1).getD());
- assertEqualsExactType(327, message.getExtension(repeatedLazyMessageExtension , 1).getBb());
-
- assertEqualsExactType(TestAllTypes.NestedEnum.BAZ,
- message.getExtension(repeatedNestedEnumExtension, 1));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAZ,
- message.getExtension(repeatedForeignEnumExtension, 1));
- assertEqualsExactType(ImportEnum.IMPORT_BAZ,
- message.getExtension(repeatedImportEnumExtension, 1));
-
- assertEqualsExactType("324", message.getExtension(repeatedStringPieceExtension, 1));
- assertEqualsExactType("325", message.getExtension(repeatedCordExtension, 1));
-
- // -----------------------------------------------------------------
-
- Assert.assertTrue(message.hasExtension(defaultInt32Extension ));
- Assert.assertTrue(message.hasExtension(defaultInt64Extension ));
- Assert.assertTrue(message.hasExtension(defaultUint32Extension ));
- Assert.assertTrue(message.hasExtension(defaultUint64Extension ));
- Assert.assertTrue(message.hasExtension(defaultSint32Extension ));
- Assert.assertTrue(message.hasExtension(defaultSint64Extension ));
- Assert.assertTrue(message.hasExtension(defaultFixed32Extension ));
- Assert.assertTrue(message.hasExtension(defaultFixed64Extension ));
- Assert.assertTrue(message.hasExtension(defaultSfixed32Extension));
- Assert.assertTrue(message.hasExtension(defaultSfixed64Extension));
- Assert.assertTrue(message.hasExtension(defaultFloatExtension ));
- Assert.assertTrue(message.hasExtension(defaultDoubleExtension ));
- Assert.assertTrue(message.hasExtension(defaultBoolExtension ));
- Assert.assertTrue(message.hasExtension(defaultStringExtension ));
- Assert.assertTrue(message.hasExtension(defaultBytesExtension ));
-
- Assert.assertTrue(message.hasExtension(defaultNestedEnumExtension ));
- Assert.assertTrue(message.hasExtension(defaultForeignEnumExtension));
- Assert.assertTrue(message.hasExtension(defaultImportEnumExtension ));
-
- Assert.assertTrue(message.hasExtension(defaultStringPieceExtension));
- Assert.assertTrue(message.hasExtension(defaultCordExtension));
-
- assertEqualsExactType(401 , message.getExtension(defaultInt32Extension ));
- assertEqualsExactType(402L , message.getExtension(defaultInt64Extension ));
- assertEqualsExactType(403 , message.getExtension(defaultUint32Extension ));
- assertEqualsExactType(404L , message.getExtension(defaultUint64Extension ));
- assertEqualsExactType(405 , message.getExtension(defaultSint32Extension ));
- assertEqualsExactType(406L , message.getExtension(defaultSint64Extension ));
- assertEqualsExactType(407 , message.getExtension(defaultFixed32Extension ));
- assertEqualsExactType(408L , message.getExtension(defaultFixed64Extension ));
- assertEqualsExactType(409 , message.getExtension(defaultSfixed32Extension));
- assertEqualsExactType(410L , message.getExtension(defaultSfixed64Extension));
- assertEqualsExactType(411F , message.getExtension(defaultFloatExtension ));
- assertEqualsExactType(412D , message.getExtension(defaultDoubleExtension ));
- assertEqualsExactType(false, message.getExtension(defaultBoolExtension ));
- assertEqualsExactType("415", message.getExtension(defaultStringExtension ));
- assertEqualsExactType(toBytes("416"), message.getExtension(defaultBytesExtension));
-
- assertEqualsExactType(TestAllTypes.NestedEnum.FOO,
- message.getExtension(defaultNestedEnumExtension ));
- assertEqualsExactType(ForeignEnum.FOREIGN_FOO,
- message.getExtension(defaultForeignEnumExtension));
- assertEqualsExactType(ImportEnum.IMPORT_FOO,
- message.getExtension(defaultImportEnumExtension));
-
- assertEqualsExactType("424", message.getExtension(defaultStringPieceExtension));
- assertEqualsExactType("425", message.getExtension(defaultCordExtension));
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all extensions of
- * {@code message} are cleared, and that getting the extensions returns their
- * default values.
- */
- public static void assertExtensionsClear(TestAllExtensionsOrBuilder message) {
- // hasBlah() should initially be false for all optional fields.
- Assert.assertFalse(message.hasExtension(optionalInt32Extension ));
- Assert.assertFalse(message.hasExtension(optionalInt64Extension ));
- Assert.assertFalse(message.hasExtension(optionalUint32Extension ));
- Assert.assertFalse(message.hasExtension(optionalUint64Extension ));
- Assert.assertFalse(message.hasExtension(optionalSint32Extension ));
- Assert.assertFalse(message.hasExtension(optionalSint64Extension ));
- Assert.assertFalse(message.hasExtension(optionalFixed32Extension ));
- Assert.assertFalse(message.hasExtension(optionalFixed64Extension ));
- Assert.assertFalse(message.hasExtension(optionalSfixed32Extension));
- Assert.assertFalse(message.hasExtension(optionalSfixed64Extension));
- Assert.assertFalse(message.hasExtension(optionalFloatExtension ));
- Assert.assertFalse(message.hasExtension(optionalDoubleExtension ));
- Assert.assertFalse(message.hasExtension(optionalBoolExtension ));
- Assert.assertFalse(message.hasExtension(optionalStringExtension ));
- Assert.assertFalse(message.hasExtension(optionalBytesExtension ));
-
- Assert.assertFalse(message.hasExtension(optionalGroupExtension ));
- Assert.assertFalse(message.hasExtension(optionalNestedMessageExtension ));
- Assert.assertFalse(message.hasExtension(optionalForeignMessageExtension));
- Assert.assertFalse(message.hasExtension(optionalImportMessageExtension ));
-
- Assert.assertFalse(message.hasExtension(optionalNestedEnumExtension ));
- Assert.assertFalse(message.hasExtension(optionalForeignEnumExtension));
- Assert.assertFalse(message.hasExtension(optionalImportEnumExtension ));
-
- Assert.assertFalse(message.hasExtension(optionalStringPieceExtension));
- Assert.assertFalse(message.hasExtension(optionalCordExtension));
-
- // Optional fields without defaults are set to zero or something like it.
- assertEqualsExactType(0 , message.getExtension(optionalInt32Extension ));
- assertEqualsExactType(0L , message.getExtension(optionalInt64Extension ));
- assertEqualsExactType(0 , message.getExtension(optionalUint32Extension ));
- assertEqualsExactType(0L , message.getExtension(optionalUint64Extension ));
- assertEqualsExactType(0 , message.getExtension(optionalSint32Extension ));
- assertEqualsExactType(0L , message.getExtension(optionalSint64Extension ));
- assertEqualsExactType(0 , message.getExtension(optionalFixed32Extension ));
- assertEqualsExactType(0L , message.getExtension(optionalFixed64Extension ));
- assertEqualsExactType(0 , message.getExtension(optionalSfixed32Extension));
- assertEqualsExactType(0L , message.getExtension(optionalSfixed64Extension));
- assertEqualsExactType(0F , message.getExtension(optionalFloatExtension ));
- assertEqualsExactType(0D , message.getExtension(optionalDoubleExtension ));
- assertEqualsExactType(false, message.getExtension(optionalBoolExtension ));
- assertEqualsExactType("" , message.getExtension(optionalStringExtension ));
- assertEqualsExactType(ByteString.EMPTY, message.getExtension(optionalBytesExtension));
-
- // Embedded messages should also be clear.
- Assert.assertFalse(message.getExtension(optionalGroupExtension ).hasA());
- Assert.assertFalse(message.getExtension(optionalNestedMessageExtension ).hasBb());
- Assert.assertFalse(message.getExtension(optionalForeignMessageExtension).hasC());
- Assert.assertFalse(message.getExtension(optionalImportMessageExtension ).hasD());
-
- assertEqualsExactType(0, message.getExtension(optionalGroupExtension ).getA());
- assertEqualsExactType(0, message.getExtension(optionalNestedMessageExtension ).getBb());
- assertEqualsExactType(0, message.getExtension(optionalForeignMessageExtension).getC());
- assertEqualsExactType(0, message.getExtension(optionalImportMessageExtension ).getD());
-
- // Enums without defaults are set to the first value in the enum.
- assertEqualsExactType(TestAllTypes.NestedEnum.FOO,
- message.getExtension(optionalNestedEnumExtension ));
- assertEqualsExactType(ForeignEnum.FOREIGN_FOO,
- message.getExtension(optionalForeignEnumExtension));
- assertEqualsExactType(ImportEnum.IMPORT_FOO,
- message.getExtension(optionalImportEnumExtension));
-
- assertEqualsExactType("", message.getExtension(optionalStringPieceExtension));
- assertEqualsExactType("", message.getExtension(optionalCordExtension));
-
- // Repeated fields are empty.
- Assert.assertEquals(0, message.getExtensionCount(repeatedInt32Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedInt64Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedUint32Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedUint64Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedSint32Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedSint64Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedFixed32Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedFixed64Extension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedSfixed32Extension));
- Assert.assertEquals(0, message.getExtensionCount(repeatedSfixed64Extension));
- Assert.assertEquals(0, message.getExtensionCount(repeatedFloatExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedDoubleExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedBoolExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedStringExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedBytesExtension ));
-
- Assert.assertEquals(0, message.getExtensionCount(repeatedGroupExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedNestedMessageExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedForeignMessageExtension));
- Assert.assertEquals(0, message.getExtensionCount(repeatedImportMessageExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedLazyMessageExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedNestedEnumExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedForeignEnumExtension ));
- Assert.assertEquals(0, message.getExtensionCount(repeatedImportEnumExtension ));
-
- Assert.assertEquals(0, message.getExtensionCount(repeatedStringPieceExtension));
- Assert.assertEquals(0, message.getExtensionCount(repeatedCordExtension));
-
- // Repeated fields are empty via getExtension().size().
- Assert.assertEquals(0, message.getExtension(repeatedInt32Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedInt64Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedUint32Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedUint64Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedSint32Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedSint64Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedFixed32Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedFixed64Extension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedSfixed32Extension).size());
- Assert.assertEquals(0, message.getExtension(repeatedSfixed64Extension).size());
- Assert.assertEquals(0, message.getExtension(repeatedFloatExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedDoubleExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedBoolExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedStringExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedBytesExtension ).size());
-
- Assert.assertEquals(0, message.getExtension(repeatedGroupExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedNestedMessageExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedForeignMessageExtension).size());
- Assert.assertEquals(0, message.getExtension(repeatedImportMessageExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedLazyMessageExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedNestedEnumExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedForeignEnumExtension ).size());
- Assert.assertEquals(0, message.getExtension(repeatedImportEnumExtension ).size());
-
- Assert.assertEquals(0, message.getExtension(repeatedStringPieceExtension).size());
- Assert.assertEquals(0, message.getExtension(repeatedCordExtension).size());
-
- // hasBlah() should also be false for all default fields.
- Assert.assertFalse(message.hasExtension(defaultInt32Extension ));
- Assert.assertFalse(message.hasExtension(defaultInt64Extension ));
- Assert.assertFalse(message.hasExtension(defaultUint32Extension ));
- Assert.assertFalse(message.hasExtension(defaultUint64Extension ));
- Assert.assertFalse(message.hasExtension(defaultSint32Extension ));
- Assert.assertFalse(message.hasExtension(defaultSint64Extension ));
- Assert.assertFalse(message.hasExtension(defaultFixed32Extension ));
- Assert.assertFalse(message.hasExtension(defaultFixed64Extension ));
- Assert.assertFalse(message.hasExtension(defaultSfixed32Extension));
- Assert.assertFalse(message.hasExtension(defaultSfixed64Extension));
- Assert.assertFalse(message.hasExtension(defaultFloatExtension ));
- Assert.assertFalse(message.hasExtension(defaultDoubleExtension ));
- Assert.assertFalse(message.hasExtension(defaultBoolExtension ));
- Assert.assertFalse(message.hasExtension(defaultStringExtension ));
- Assert.assertFalse(message.hasExtension(defaultBytesExtension ));
-
- Assert.assertFalse(message.hasExtension(defaultNestedEnumExtension ));
- Assert.assertFalse(message.hasExtension(defaultForeignEnumExtension));
- Assert.assertFalse(message.hasExtension(defaultImportEnumExtension ));
-
- Assert.assertFalse(message.hasExtension(defaultStringPieceExtension));
- Assert.assertFalse(message.hasExtension(defaultCordExtension));
-
- // Fields with defaults have their default values (duh).
- assertEqualsExactType( 41 , message.getExtension(defaultInt32Extension ));
- assertEqualsExactType( 42L , message.getExtension(defaultInt64Extension ));
- assertEqualsExactType( 43 , message.getExtension(defaultUint32Extension ));
- assertEqualsExactType( 44L , message.getExtension(defaultUint64Extension ));
- assertEqualsExactType(-45 , message.getExtension(defaultSint32Extension ));
- assertEqualsExactType( 46L , message.getExtension(defaultSint64Extension ));
- assertEqualsExactType( 47 , message.getExtension(defaultFixed32Extension ));
- assertEqualsExactType( 48L , message.getExtension(defaultFixed64Extension ));
- assertEqualsExactType( 49 , message.getExtension(defaultSfixed32Extension));
- assertEqualsExactType(-50L , message.getExtension(defaultSfixed64Extension));
- assertEqualsExactType( 51.5F , message.getExtension(defaultFloatExtension ));
- assertEqualsExactType( 52e3D , message.getExtension(defaultDoubleExtension ));
- assertEqualsExactType(true , message.getExtension(defaultBoolExtension ));
- assertEqualsExactType("hello", message.getExtension(defaultStringExtension ));
- assertEqualsExactType(toBytes("world"), message.getExtension(defaultBytesExtension));
-
- assertEqualsExactType(TestAllTypes.NestedEnum.BAR,
- message.getExtension(defaultNestedEnumExtension ));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAR,
- message.getExtension(defaultForeignEnumExtension));
- assertEqualsExactType(ImportEnum.IMPORT_BAR,
- message.getExtension(defaultImportEnumExtension));
-
- assertEqualsExactType("abc", message.getExtension(defaultStringPieceExtension));
- assertEqualsExactType("123", message.getExtension(defaultCordExtension));
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all extensions of
- * {@code message} are set to the values assigned by {@code setAllExtensions}
- * followed by {@code modifyRepeatedExtensions}.
- */
- public static void assertRepeatedExtensionsModified(
- TestAllExtensionsOrBuilder message) {
- // ModifyRepeatedFields only sets the second repeated element of each
- // field. In addition to verifying this, we also verify that the first
- // element and size were *not* modified.
- Assert.assertEquals(2, message.getExtensionCount(repeatedInt32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedInt64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedUint32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedUint64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSint32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSint64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedFixed32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedFixed64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSfixed32Extension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedSfixed64Extension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedFloatExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedDoubleExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedBoolExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedStringExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedBytesExtension ));
-
- Assert.assertEquals(2, message.getExtensionCount(repeatedGroupExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedNestedMessageExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedForeignMessageExtension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedImportMessageExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedLazyMessageExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedNestedEnumExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedForeignEnumExtension ));
- Assert.assertEquals(2, message.getExtensionCount(repeatedImportEnumExtension ));
-
- Assert.assertEquals(2, message.getExtensionCount(repeatedStringPieceExtension));
- Assert.assertEquals(2, message.getExtensionCount(repeatedCordExtension));
-
- assertEqualsExactType(201 , message.getExtension(repeatedInt32Extension , 0));
- assertEqualsExactType(202L , message.getExtension(repeatedInt64Extension , 0));
- assertEqualsExactType(203 , message.getExtension(repeatedUint32Extension , 0));
- assertEqualsExactType(204L , message.getExtension(repeatedUint64Extension , 0));
- assertEqualsExactType(205 , message.getExtension(repeatedSint32Extension , 0));
- assertEqualsExactType(206L , message.getExtension(repeatedSint64Extension , 0));
- assertEqualsExactType(207 , message.getExtension(repeatedFixed32Extension , 0));
- assertEqualsExactType(208L , message.getExtension(repeatedFixed64Extension , 0));
- assertEqualsExactType(209 , message.getExtension(repeatedSfixed32Extension, 0));
- assertEqualsExactType(210L , message.getExtension(repeatedSfixed64Extension, 0));
- assertEqualsExactType(211F , message.getExtension(repeatedFloatExtension , 0));
- assertEqualsExactType(212D , message.getExtension(repeatedDoubleExtension , 0));
- assertEqualsExactType(true , message.getExtension(repeatedBoolExtension , 0));
- assertEqualsExactType("215", message.getExtension(repeatedStringExtension , 0));
- assertEqualsExactType(toBytes("216"), message.getExtension(repeatedBytesExtension, 0));
-
- assertEqualsExactType(217, message.getExtension(repeatedGroupExtension , 0).getA());
- assertEqualsExactType(218, message.getExtension(repeatedNestedMessageExtension , 0).getBb());
- assertEqualsExactType(219, message.getExtension(repeatedForeignMessageExtension, 0).getC());
- assertEqualsExactType(220, message.getExtension(repeatedImportMessageExtension , 0).getD());
- assertEqualsExactType(227, message.getExtension(repeatedLazyMessageExtension , 0).getBb());
-
- assertEqualsExactType(TestAllTypes.NestedEnum.BAR,
- message.getExtension(repeatedNestedEnumExtension, 0));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAR,
- message.getExtension(repeatedForeignEnumExtension, 0));
- assertEqualsExactType(ImportEnum.IMPORT_BAR,
- message.getExtension(repeatedImportEnumExtension, 0));
-
- assertEqualsExactType("224", message.getExtension(repeatedStringPieceExtension, 0));
- assertEqualsExactType("225", message.getExtension(repeatedCordExtension, 0));
-
- // Actually verify the second (modified) elements now.
- assertEqualsExactType(501 , message.getExtension(repeatedInt32Extension , 1));
- assertEqualsExactType(502L , message.getExtension(repeatedInt64Extension , 1));
- assertEqualsExactType(503 , message.getExtension(repeatedUint32Extension , 1));
- assertEqualsExactType(504L , message.getExtension(repeatedUint64Extension , 1));
- assertEqualsExactType(505 , message.getExtension(repeatedSint32Extension , 1));
- assertEqualsExactType(506L , message.getExtension(repeatedSint64Extension , 1));
- assertEqualsExactType(507 , message.getExtension(repeatedFixed32Extension , 1));
- assertEqualsExactType(508L , message.getExtension(repeatedFixed64Extension , 1));
- assertEqualsExactType(509 , message.getExtension(repeatedSfixed32Extension, 1));
- assertEqualsExactType(510L , message.getExtension(repeatedSfixed64Extension, 1));
- assertEqualsExactType(511F , message.getExtension(repeatedFloatExtension , 1));
- assertEqualsExactType(512D , message.getExtension(repeatedDoubleExtension , 1));
- assertEqualsExactType(true , message.getExtension(repeatedBoolExtension , 1));
- assertEqualsExactType("515", message.getExtension(repeatedStringExtension , 1));
- assertEqualsExactType(toBytes("516"), message.getExtension(repeatedBytesExtension, 1));
-
- assertEqualsExactType(517, message.getExtension(repeatedGroupExtension , 1).getA());
- assertEqualsExactType(518, message.getExtension(repeatedNestedMessageExtension , 1).getBb());
- assertEqualsExactType(519, message.getExtension(repeatedForeignMessageExtension, 1).getC());
- assertEqualsExactType(520, message.getExtension(repeatedImportMessageExtension , 1).getD());
- assertEqualsExactType(527, message.getExtension(repeatedLazyMessageExtension , 1).getBb());
-
- assertEqualsExactType(TestAllTypes.NestedEnum.FOO,
- message.getExtension(repeatedNestedEnumExtension, 1));
- assertEqualsExactType(ForeignEnum.FOREIGN_FOO,
- message.getExtension(repeatedForeignEnumExtension, 1));
- assertEqualsExactType(ImportEnum.IMPORT_FOO,
- message.getExtension(repeatedImportEnumExtension, 1));
-
- assertEqualsExactType("524", message.getExtension(repeatedStringPieceExtension, 1));
- assertEqualsExactType("525", message.getExtension(repeatedCordExtension, 1));
- }
-
- public static void setPackedExtensions(TestPackedExtensions.Builder message) {
- message.addExtension(packedInt32Extension , 601);
- message.addExtension(packedInt64Extension , 602L);
- message.addExtension(packedUint32Extension , 603);
- message.addExtension(packedUint64Extension , 604L);
- message.addExtension(packedSint32Extension , 605);
- message.addExtension(packedSint64Extension , 606L);
- message.addExtension(packedFixed32Extension , 607);
- message.addExtension(packedFixed64Extension , 608L);
- message.addExtension(packedSfixed32Extension, 609);
- message.addExtension(packedSfixed64Extension, 610L);
- message.addExtension(packedFloatExtension , 611F);
- message.addExtension(packedDoubleExtension , 612D);
- message.addExtension(packedBoolExtension , true);
- message.addExtension(packedEnumExtension, ForeignEnum.FOREIGN_BAR);
- // Add a second one of each field.
- message.addExtension(packedInt32Extension , 701);
- message.addExtension(packedInt64Extension , 702L);
- message.addExtension(packedUint32Extension , 703);
- message.addExtension(packedUint64Extension , 704L);
- message.addExtension(packedSint32Extension , 705);
- message.addExtension(packedSint64Extension , 706L);
- message.addExtension(packedFixed32Extension , 707);
- message.addExtension(packedFixed64Extension , 708L);
- message.addExtension(packedSfixed32Extension, 709);
- message.addExtension(packedSfixed64Extension, 710L);
- message.addExtension(packedFloatExtension , 711F);
- message.addExtension(packedDoubleExtension , 712D);
- message.addExtension(packedBoolExtension , false);
- message.addExtension(packedEnumExtension, ForeignEnum.FOREIGN_BAZ);
- }
-
- public static void assertPackedExtensionsSet(TestPackedExtensions message) {
- Assert.assertEquals(2, message.getExtensionCount(packedInt32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedInt64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedUint32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedUint64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedSint32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedSint64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedFixed32Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedFixed64Extension ));
- Assert.assertEquals(2, message.getExtensionCount(packedSfixed32Extension));
- Assert.assertEquals(2, message.getExtensionCount(packedSfixed64Extension));
- Assert.assertEquals(2, message.getExtensionCount(packedFloatExtension ));
- Assert.assertEquals(2, message.getExtensionCount(packedDoubleExtension ));
- Assert.assertEquals(2, message.getExtensionCount(packedBoolExtension ));
- Assert.assertEquals(2, message.getExtensionCount(packedEnumExtension));
- assertEqualsExactType(601 , message.getExtension(packedInt32Extension , 0));
- assertEqualsExactType(602L , message.getExtension(packedInt64Extension , 0));
- assertEqualsExactType(603 , message.getExtension(packedUint32Extension , 0));
- assertEqualsExactType(604L , message.getExtension(packedUint64Extension , 0));
- assertEqualsExactType(605 , message.getExtension(packedSint32Extension , 0));
- assertEqualsExactType(606L , message.getExtension(packedSint64Extension , 0));
- assertEqualsExactType(607 , message.getExtension(packedFixed32Extension , 0));
- assertEqualsExactType(608L , message.getExtension(packedFixed64Extension , 0));
- assertEqualsExactType(609 , message.getExtension(packedSfixed32Extension, 0));
- assertEqualsExactType(610L , message.getExtension(packedSfixed64Extension, 0));
- assertEqualsExactType(611F , message.getExtension(packedFloatExtension , 0));
- assertEqualsExactType(612D , message.getExtension(packedDoubleExtension , 0));
- assertEqualsExactType(true , message.getExtension(packedBoolExtension , 0));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAR,
- message.getExtension(packedEnumExtension, 0));
- assertEqualsExactType(701 , message.getExtension(packedInt32Extension , 1));
- assertEqualsExactType(702L , message.getExtension(packedInt64Extension , 1));
- assertEqualsExactType(703 , message.getExtension(packedUint32Extension , 1));
- assertEqualsExactType(704L , message.getExtension(packedUint64Extension , 1));
- assertEqualsExactType(705 , message.getExtension(packedSint32Extension , 1));
- assertEqualsExactType(706L , message.getExtension(packedSint64Extension , 1));
- assertEqualsExactType(707 , message.getExtension(packedFixed32Extension , 1));
- assertEqualsExactType(708L , message.getExtension(packedFixed64Extension , 1));
- assertEqualsExactType(709 , message.getExtension(packedSfixed32Extension, 1));
- assertEqualsExactType(710L , message.getExtension(packedSfixed64Extension, 1));
- assertEqualsExactType(711F , message.getExtension(packedFloatExtension , 1));
- assertEqualsExactType(712D , message.getExtension(packedDoubleExtension , 1));
- assertEqualsExactType(false, message.getExtension(packedBoolExtension , 1));
- assertEqualsExactType(ForeignEnum.FOREIGN_BAZ,
- message.getExtension(packedEnumExtension, 1));
- }
-
- // =================================================================
-
- /**
- * Performs the same things that the methods of {@code TestUtil} do, but
- * via the reflection interface. This is its own class because it needs
- * to know what descriptor to use.
- */
- public static class ReflectionTester {
- private final Descriptors.Descriptor baseDescriptor;
- private final ExtensionRegistry extensionRegistry;
-
- private final Descriptors.FileDescriptor file;
- private final Descriptors.FileDescriptor importFile;
- private final Descriptors.FileDescriptor publicImportFile;
-
- private final Descriptors.Descriptor optionalGroup;
- private final Descriptors.Descriptor repeatedGroup;
- private final Descriptors.Descriptor nestedMessage;
- private final Descriptors.Descriptor foreignMessage;
- private final Descriptors.Descriptor importMessage;
- private final Descriptors.Descriptor publicImportMessage;
-
- private final Descriptors.FieldDescriptor groupA;
- private final Descriptors.FieldDescriptor repeatedGroupA;
- private final Descriptors.FieldDescriptor nestedB;
- private final Descriptors.FieldDescriptor foreignC;
- private final Descriptors.FieldDescriptor importD;
- private final Descriptors.FieldDescriptor importE;
-
- private final Descriptors.EnumDescriptor nestedEnum;
- private final Descriptors.EnumDescriptor foreignEnum;
- private final Descriptors.EnumDescriptor importEnum;
-
- private final Descriptors.EnumValueDescriptor nestedFoo;
- private final Descriptors.EnumValueDescriptor nestedBar;
- private final Descriptors.EnumValueDescriptor nestedBaz;
- private final Descriptors.EnumValueDescriptor foreignFoo;
- private final Descriptors.EnumValueDescriptor foreignBar;
- private final Descriptors.EnumValueDescriptor foreignBaz;
- private final Descriptors.EnumValueDescriptor importFoo;
- private final Descriptors.EnumValueDescriptor importBar;
- private final Descriptors.EnumValueDescriptor importBaz;
-
- /**
- * Construct a {@code ReflectionTester} that will expect messages using
- * the given descriptor.
- *
- * Normally {@code baseDescriptor} should be a descriptor for the type
- * {@code TestAllTypes}, defined in
- * {@code google/protobuf/unittest.proto}. However, if
- * {@code extensionRegistry} is non-null, then {@code baseDescriptor} should
- * be for {@code TestAllExtensions} instead, and instead of reading and
- * writing normal fields, the tester will read and write extensions.
- * All of {@code TestAllExtensions}' extensions must be registered in the
- * registry.
- */
- public ReflectionTester(Descriptors.Descriptor baseDescriptor,
- ExtensionRegistry extensionRegistry) {
- this.baseDescriptor = baseDescriptor;
- this.extensionRegistry = extensionRegistry;
-
- this.file = baseDescriptor.getFile();
- Assert.assertEquals(1, file.getDependencies().size());
- this.importFile = file.getDependencies().get(0);
- this.publicImportFile = importFile.getDependencies().get(0);
-
- Descriptors.Descriptor testAllTypes;
- if (baseDescriptor.getName() == "TestAllTypes") {
- testAllTypes = baseDescriptor;
- } else {
- testAllTypes = file.findMessageTypeByName("TestAllTypes");
- Assert.assertNotNull(testAllTypes);
- }
-
- if (extensionRegistry == null) {
- // Use testAllTypes, rather than baseDescriptor, to allow
- // initialization using TestPackedTypes descriptors. These objects
- // won't be used by the methods for packed fields.
- this.optionalGroup =
- testAllTypes.findNestedTypeByName("OptionalGroup");
- this.repeatedGroup =
- testAllTypes.findNestedTypeByName("RepeatedGroup");
- } else {
- this.optionalGroup =
- file.findMessageTypeByName("OptionalGroup_extension");
- this.repeatedGroup =
- file.findMessageTypeByName("RepeatedGroup_extension");
- }
- this.nestedMessage = testAllTypes.findNestedTypeByName("NestedMessage");
- this.foreignMessage = file.findMessageTypeByName("ForeignMessage");
- this.importMessage = importFile.findMessageTypeByName("ImportMessage");
- this.publicImportMessage = publicImportFile.findMessageTypeByName(
- "PublicImportMessage");
-
- this.nestedEnum = testAllTypes.findEnumTypeByName("NestedEnum");
- this.foreignEnum = file.findEnumTypeByName("ForeignEnum");
- this.importEnum = importFile.findEnumTypeByName("ImportEnum");
-
- Assert.assertNotNull(optionalGroup );
- Assert.assertNotNull(repeatedGroup );
- Assert.assertNotNull(nestedMessage );
- Assert.assertNotNull(foreignMessage);
- Assert.assertNotNull(importMessage );
- Assert.assertNotNull(nestedEnum );
- Assert.assertNotNull(foreignEnum );
- Assert.assertNotNull(importEnum );
-
- this.nestedB = nestedMessage .findFieldByName("bb");
- this.foreignC = foreignMessage.findFieldByName("c");
- this.importD = importMessage .findFieldByName("d");
- this.importE = publicImportMessage.findFieldByName("e");
- this.nestedFoo = nestedEnum.findValueByName("FOO");
- this.nestedBar = nestedEnum.findValueByName("BAR");
- this.nestedBaz = nestedEnum.findValueByName("BAZ");
- this.foreignFoo = foreignEnum.findValueByName("FOREIGN_FOO");
- this.foreignBar = foreignEnum.findValueByName("FOREIGN_BAR");
- this.foreignBaz = foreignEnum.findValueByName("FOREIGN_BAZ");
- this.importFoo = importEnum.findValueByName("IMPORT_FOO");
- this.importBar = importEnum.findValueByName("IMPORT_BAR");
- this.importBaz = importEnum.findValueByName("IMPORT_BAZ");
-
- this.groupA = optionalGroup.findFieldByName("a");
- this.repeatedGroupA = repeatedGroup.findFieldByName("a");
-
- Assert.assertNotNull(groupA );
- Assert.assertNotNull(repeatedGroupA);
- Assert.assertNotNull(nestedB );
- Assert.assertNotNull(foreignC );
- Assert.assertNotNull(importD );
- Assert.assertNotNull(importE );
- Assert.assertNotNull(nestedFoo );
- Assert.assertNotNull(nestedBar );
- Assert.assertNotNull(nestedBaz );
- Assert.assertNotNull(foreignFoo );
- Assert.assertNotNull(foreignBar );
- Assert.assertNotNull(foreignBaz );
- Assert.assertNotNull(importFoo );
- Assert.assertNotNull(importBar );
- Assert.assertNotNull(importBaz );
- }
-
- /**
- * Shorthand to get a FieldDescriptor for a field of unittest::TestAllTypes.
- */
- private Descriptors.FieldDescriptor f(String name) {
- Descriptors.FieldDescriptor result;
- if (extensionRegistry == null) {
- result = baseDescriptor.findFieldByName(name);
- } else {
- result = file.findExtensionByName(name + "_extension");
- }
- Assert.assertNotNull(result);
- return result;
- }
-
- /**
- * Calls {@code parent.newBuilderForField()} or uses the
- * {@code ExtensionRegistry} to find an appropriate builder, depending
- * on what type is being tested.
- */
- private Message.Builder newBuilderForField(
- Message.Builder parent, Descriptors.FieldDescriptor field) {
- if (extensionRegistry == null) {
- return parent.newBuilderForField(field);
- } else {
- ExtensionRegistry.ExtensionInfo extension =
- extensionRegistry.findExtensionByNumber(field.getContainingType(),
- field.getNumber());
- Assert.assertNotNull(extension);
- Assert.assertNotNull(extension.defaultInstance);
- return extension.defaultInstance.newBuilderForType();
- }
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Set every field of {@code message} to the values expected by
- * {@code assertAllFieldsSet()}, using the {@link Message.Builder}
- * reflection interface.
- */
- void setAllFieldsViaReflection(Message.Builder message) {
- message.setField(f("optional_int32" ), 101 );
- message.setField(f("optional_int64" ), 102L);
- message.setField(f("optional_uint32" ), 103 );
- message.setField(f("optional_uint64" ), 104L);
- message.setField(f("optional_sint32" ), 105 );
- message.setField(f("optional_sint64" ), 106L);
- message.setField(f("optional_fixed32" ), 107 );
- message.setField(f("optional_fixed64" ), 108L);
- message.setField(f("optional_sfixed32"), 109 );
- message.setField(f("optional_sfixed64"), 110L);
- message.setField(f("optional_float" ), 111F);
- message.setField(f("optional_double" ), 112D);
- message.setField(f("optional_bool" ), true);
- message.setField(f("optional_string" ), "115");
- message.setField(f("optional_bytes" ), toBytes("116"));
-
- message.setField(f("optionalgroup"),
- newBuilderForField(message, f("optionalgroup"))
- .setField(groupA, 117).build());
- message.setField(f("optional_nested_message"),
- newBuilderForField(message, f("optional_nested_message"))
- .setField(nestedB, 118).build());
- message.setField(f("optional_foreign_message"),
- newBuilderForField(message, f("optional_foreign_message"))
- .setField(foreignC, 119).build());
- message.setField(f("optional_import_message"),
- newBuilderForField(message, f("optional_import_message"))
- .setField(importD, 120).build());
- message.setField(f("optional_public_import_message"),
- newBuilderForField(message, f("optional_public_import_message"))
- .setField(importE, 126).build());
- message.setField(f("optional_lazy_message"),
- newBuilderForField(message, f("optional_lazy_message"))
- .setField(nestedB, 127).build());
-
- message.setField(f("optional_nested_enum" ), nestedBaz);
- message.setField(f("optional_foreign_enum"), foreignBaz);
- message.setField(f("optional_import_enum" ), importBaz);
-
- message.setField(f("optional_string_piece" ), "124");
- message.setField(f("optional_cord" ), "125");
-
- // -----------------------------------------------------------------
-
- message.addRepeatedField(f("repeated_int32" ), 201 );
- message.addRepeatedField(f("repeated_int64" ), 202L);
- message.addRepeatedField(f("repeated_uint32" ), 203 );
- message.addRepeatedField(f("repeated_uint64" ), 204L);
- message.addRepeatedField(f("repeated_sint32" ), 205 );
- message.addRepeatedField(f("repeated_sint64" ), 206L);
- message.addRepeatedField(f("repeated_fixed32" ), 207 );
- message.addRepeatedField(f("repeated_fixed64" ), 208L);
- message.addRepeatedField(f("repeated_sfixed32"), 209 );
- message.addRepeatedField(f("repeated_sfixed64"), 210L);
- message.addRepeatedField(f("repeated_float" ), 211F);
- message.addRepeatedField(f("repeated_double" ), 212D);
- message.addRepeatedField(f("repeated_bool" ), true);
- message.addRepeatedField(f("repeated_string" ), "215");
- message.addRepeatedField(f("repeated_bytes" ), toBytes("216"));
-
- message.addRepeatedField(f("repeatedgroup"),
- newBuilderForField(message, f("repeatedgroup"))
- .setField(repeatedGroupA, 217).build());
- message.addRepeatedField(f("repeated_nested_message"),
- newBuilderForField(message, f("repeated_nested_message"))
- .setField(nestedB, 218).build());
- message.addRepeatedField(f("repeated_foreign_message"),
- newBuilderForField(message, f("repeated_foreign_message"))
- .setField(foreignC, 219).build());
- message.addRepeatedField(f("repeated_import_message"),
- newBuilderForField(message, f("repeated_import_message"))
- .setField(importD, 220).build());
- message.addRepeatedField(f("repeated_lazy_message"),
- newBuilderForField(message, f("repeated_lazy_message"))
- .setField(nestedB, 227).build());
-
- message.addRepeatedField(f("repeated_nested_enum" ), nestedBar);
- message.addRepeatedField(f("repeated_foreign_enum"), foreignBar);
- message.addRepeatedField(f("repeated_import_enum" ), importBar);
-
- message.addRepeatedField(f("repeated_string_piece" ), "224");
- message.addRepeatedField(f("repeated_cord" ), "225");
-
- // Add a second one of each field.
- message.addRepeatedField(f("repeated_int32" ), 301 );
- message.addRepeatedField(f("repeated_int64" ), 302L);
- message.addRepeatedField(f("repeated_uint32" ), 303 );
- message.addRepeatedField(f("repeated_uint64" ), 304L);
- message.addRepeatedField(f("repeated_sint32" ), 305 );
- message.addRepeatedField(f("repeated_sint64" ), 306L);
- message.addRepeatedField(f("repeated_fixed32" ), 307 );
- message.addRepeatedField(f("repeated_fixed64" ), 308L);
- message.addRepeatedField(f("repeated_sfixed32"), 309 );
- message.addRepeatedField(f("repeated_sfixed64"), 310L);
- message.addRepeatedField(f("repeated_float" ), 311F);
- message.addRepeatedField(f("repeated_double" ), 312D);
- message.addRepeatedField(f("repeated_bool" ), false);
- message.addRepeatedField(f("repeated_string" ), "315");
- message.addRepeatedField(f("repeated_bytes" ), toBytes("316"));
-
- message.addRepeatedField(f("repeatedgroup"),
- newBuilderForField(message, f("repeatedgroup"))
- .setField(repeatedGroupA, 317).build());
- message.addRepeatedField(f("repeated_nested_message"),
- newBuilderForField(message, f("repeated_nested_message"))
- .setField(nestedB, 318).build());
- message.addRepeatedField(f("repeated_foreign_message"),
- newBuilderForField(message, f("repeated_foreign_message"))
- .setField(foreignC, 319).build());
- message.addRepeatedField(f("repeated_import_message"),
- newBuilderForField(message, f("repeated_import_message"))
- .setField(importD, 320).build());
- message.addRepeatedField(f("repeated_lazy_message"),
- newBuilderForField(message, f("repeated_lazy_message"))
- .setField(nestedB, 327).build());
-
- message.addRepeatedField(f("repeated_nested_enum" ), nestedBaz);
- message.addRepeatedField(f("repeated_foreign_enum"), foreignBaz);
- message.addRepeatedField(f("repeated_import_enum" ), importBaz);
-
- message.addRepeatedField(f("repeated_string_piece" ), "324");
- message.addRepeatedField(f("repeated_cord" ), "325");
-
- // -----------------------------------------------------------------
-
- message.setField(f("default_int32" ), 401 );
- message.setField(f("default_int64" ), 402L);
- message.setField(f("default_uint32" ), 403 );
- message.setField(f("default_uint64" ), 404L);
- message.setField(f("default_sint32" ), 405 );
- message.setField(f("default_sint64" ), 406L);
- message.setField(f("default_fixed32" ), 407 );
- message.setField(f("default_fixed64" ), 408L);
- message.setField(f("default_sfixed32"), 409 );
- message.setField(f("default_sfixed64"), 410L);
- message.setField(f("default_float" ), 411F);
- message.setField(f("default_double" ), 412D);
- message.setField(f("default_bool" ), false);
- message.setField(f("default_string" ), "415");
- message.setField(f("default_bytes" ), toBytes("416"));
-
- message.setField(f("default_nested_enum" ), nestedFoo);
- message.setField(f("default_foreign_enum"), foreignFoo);
- message.setField(f("default_import_enum" ), importFoo);
-
- message.setField(f("default_string_piece" ), "424");
- message.setField(f("default_cord" ), "425");
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Modify the repeated fields of {@code message} to contain the values
- * expected by {@code assertRepeatedFieldsModified()}, using the
- * {@link Message.Builder} reflection interface.
- */
- void modifyRepeatedFieldsViaReflection(Message.Builder message) {
- message.setRepeatedField(f("repeated_int32" ), 1, 501 );
- message.setRepeatedField(f("repeated_int64" ), 1, 502L);
- message.setRepeatedField(f("repeated_uint32" ), 1, 503 );
- message.setRepeatedField(f("repeated_uint64" ), 1, 504L);
- message.setRepeatedField(f("repeated_sint32" ), 1, 505 );
- message.setRepeatedField(f("repeated_sint64" ), 1, 506L);
- message.setRepeatedField(f("repeated_fixed32" ), 1, 507 );
- message.setRepeatedField(f("repeated_fixed64" ), 1, 508L);
- message.setRepeatedField(f("repeated_sfixed32"), 1, 509 );
- message.setRepeatedField(f("repeated_sfixed64"), 1, 510L);
- message.setRepeatedField(f("repeated_float" ), 1, 511F);
- message.setRepeatedField(f("repeated_double" ), 1, 512D);
- message.setRepeatedField(f("repeated_bool" ), 1, true);
- message.setRepeatedField(f("repeated_string" ), 1, "515");
- message.setRepeatedField(f("repeated_bytes" ), 1, toBytes("516"));
-
- message.setRepeatedField(f("repeatedgroup"), 1,
- newBuilderForField(message, f("repeatedgroup"))
- .setField(repeatedGroupA, 517).build());
- message.setRepeatedField(f("repeated_nested_message"), 1,
- newBuilderForField(message, f("repeated_nested_message"))
- .setField(nestedB, 518).build());
- message.setRepeatedField(f("repeated_foreign_message"), 1,
- newBuilderForField(message, f("repeated_foreign_message"))
- .setField(foreignC, 519).build());
- message.setRepeatedField(f("repeated_import_message"), 1,
- newBuilderForField(message, f("repeated_import_message"))
- .setField(importD, 520).build());
- message.setRepeatedField(f("repeated_lazy_message"), 1,
- newBuilderForField(message, f("repeated_lazy_message"))
- .setField(nestedB, 527).build());
-
- message.setRepeatedField(f("repeated_nested_enum" ), 1, nestedFoo);
- message.setRepeatedField(f("repeated_foreign_enum"), 1, foreignFoo);
- message.setRepeatedField(f("repeated_import_enum" ), 1, importFoo);
-
- message.setRepeatedField(f("repeated_string_piece"), 1, "524");
- message.setRepeatedField(f("repeated_cord"), 1, "525");
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are set to the values assigned by {@code setAllFields},
- * using the {@link Message} reflection interface.
- */
- public void assertAllFieldsSetViaReflection(MessageOrBuilder message) {
- Assert.assertTrue(message.hasField(f("optional_int32" )));
- Assert.assertTrue(message.hasField(f("optional_int64" )));
- Assert.assertTrue(message.hasField(f("optional_uint32" )));
- Assert.assertTrue(message.hasField(f("optional_uint64" )));
- Assert.assertTrue(message.hasField(f("optional_sint32" )));
- Assert.assertTrue(message.hasField(f("optional_sint64" )));
- Assert.assertTrue(message.hasField(f("optional_fixed32" )));
- Assert.assertTrue(message.hasField(f("optional_fixed64" )));
- Assert.assertTrue(message.hasField(f("optional_sfixed32")));
- Assert.assertTrue(message.hasField(f("optional_sfixed64")));
- Assert.assertTrue(message.hasField(f("optional_float" )));
- Assert.assertTrue(message.hasField(f("optional_double" )));
- Assert.assertTrue(message.hasField(f("optional_bool" )));
- Assert.assertTrue(message.hasField(f("optional_string" )));
- Assert.assertTrue(message.hasField(f("optional_bytes" )));
-
- Assert.assertTrue(message.hasField(f("optionalgroup" )));
- Assert.assertTrue(message.hasField(f("optional_nested_message" )));
- Assert.assertTrue(message.hasField(f("optional_foreign_message")));
- Assert.assertTrue(message.hasField(f("optional_import_message" )));
-
- Assert.assertTrue(
- ((Message)message.getField(f("optionalgroup"))).hasField(groupA));
- Assert.assertTrue(
- ((Message)message.getField(f("optional_nested_message")))
- .hasField(nestedB));
- Assert.assertTrue(
- ((Message)message.getField(f("optional_foreign_message")))
- .hasField(foreignC));
- Assert.assertTrue(
- ((Message)message.getField(f("optional_import_message")))
- .hasField(importD));
-
- Assert.assertTrue(message.hasField(f("optional_nested_enum" )));
- Assert.assertTrue(message.hasField(f("optional_foreign_enum")));
- Assert.assertTrue(message.hasField(f("optional_import_enum" )));
-
- Assert.assertTrue(message.hasField(f("optional_string_piece")));
- Assert.assertTrue(message.hasField(f("optional_cord")));
-
- Assert.assertEquals(101 , message.getField(f("optional_int32" )));
- Assert.assertEquals(102L , message.getField(f("optional_int64" )));
- Assert.assertEquals(103 , message.getField(f("optional_uint32" )));
- Assert.assertEquals(104L , message.getField(f("optional_uint64" )));
- Assert.assertEquals(105 , message.getField(f("optional_sint32" )));
- Assert.assertEquals(106L , message.getField(f("optional_sint64" )));
- Assert.assertEquals(107 , message.getField(f("optional_fixed32" )));
- Assert.assertEquals(108L , message.getField(f("optional_fixed64" )));
- Assert.assertEquals(109 , message.getField(f("optional_sfixed32")));
- Assert.assertEquals(110L , message.getField(f("optional_sfixed64")));
- Assert.assertEquals(111F , message.getField(f("optional_float" )));
- Assert.assertEquals(112D , message.getField(f("optional_double" )));
- Assert.assertEquals(true , message.getField(f("optional_bool" )));
- Assert.assertEquals("115", message.getField(f("optional_string" )));
- Assert.assertEquals(toBytes("116"), message.getField(f("optional_bytes")));
-
- Assert.assertEquals(117,
- ((Message)message.getField(f("optionalgroup"))).getField(groupA));
- Assert.assertEquals(118,
- ((Message)message.getField(f("optional_nested_message")))
- .getField(nestedB));
- Assert.assertEquals(119,
- ((Message)message.getField(f("optional_foreign_message")))
- .getField(foreignC));
- Assert.assertEquals(120,
- ((Message)message.getField(f("optional_import_message")))
- .getField(importD));
- Assert.assertEquals(126,
- ((Message)message.getField(f("optional_public_import_message")))
- .getField(importE));
- Assert.assertEquals(127,
- ((Message)message.getField(f("optional_lazy_message")))
- .getField(nestedB));
-
- Assert.assertEquals( nestedBaz, message.getField(f("optional_nested_enum" )));
- Assert.assertEquals(foreignBaz, message.getField(f("optional_foreign_enum")));
- Assert.assertEquals( importBaz, message.getField(f("optional_import_enum" )));
-
- Assert.assertEquals("124", message.getField(f("optional_string_piece")));
- Assert.assertEquals("125", message.getField(f("optional_cord")));
-
- // -----------------------------------------------------------------
-
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_int32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_int64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_uint32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_uint64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sint32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sint64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_fixed32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_fixed64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sfixed32")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sfixed64")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_float" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_double" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_bool" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_string" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_bytes" )));
-
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeatedgroup" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_nested_message" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_foreign_message")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_import_message" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_lazy_message" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_nested_enum" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_foreign_enum" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_import_enum" )));
-
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_string_piece")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_cord")));
-
- Assert.assertEquals(201 , message.getRepeatedField(f("repeated_int32" ), 0));
- Assert.assertEquals(202L , message.getRepeatedField(f("repeated_int64" ), 0));
- Assert.assertEquals(203 , message.getRepeatedField(f("repeated_uint32" ), 0));
- Assert.assertEquals(204L , message.getRepeatedField(f("repeated_uint64" ), 0));
- Assert.assertEquals(205 , message.getRepeatedField(f("repeated_sint32" ), 0));
- Assert.assertEquals(206L , message.getRepeatedField(f("repeated_sint64" ), 0));
- Assert.assertEquals(207 , message.getRepeatedField(f("repeated_fixed32" ), 0));
- Assert.assertEquals(208L , message.getRepeatedField(f("repeated_fixed64" ), 0));
- Assert.assertEquals(209 , message.getRepeatedField(f("repeated_sfixed32"), 0));
- Assert.assertEquals(210L , message.getRepeatedField(f("repeated_sfixed64"), 0));
- Assert.assertEquals(211F , message.getRepeatedField(f("repeated_float" ), 0));
- Assert.assertEquals(212D , message.getRepeatedField(f("repeated_double" ), 0));
- Assert.assertEquals(true , message.getRepeatedField(f("repeated_bool" ), 0));
- Assert.assertEquals("215", message.getRepeatedField(f("repeated_string" ), 0));
- Assert.assertEquals(toBytes("216"), message.getRepeatedField(f("repeated_bytes"), 0));
-
- Assert.assertEquals(217,
- ((Message)message.getRepeatedField(f("repeatedgroup"), 0))
- .getField(repeatedGroupA));
- Assert.assertEquals(218,
- ((Message)message.getRepeatedField(f("repeated_nested_message"), 0))
- .getField(nestedB));
- Assert.assertEquals(219,
- ((Message)message.getRepeatedField(f("repeated_foreign_message"), 0))
- .getField(foreignC));
- Assert.assertEquals(220,
- ((Message)message.getRepeatedField(f("repeated_import_message"), 0))
- .getField(importD));
- Assert.assertEquals(227,
- ((Message)message.getRepeatedField(f("repeated_lazy_message"), 0))
- .getField(nestedB));
-
- Assert.assertEquals( nestedBar, message.getRepeatedField(f("repeated_nested_enum" ),0));
- Assert.assertEquals(foreignBar, message.getRepeatedField(f("repeated_foreign_enum"),0));
- Assert.assertEquals( importBar, message.getRepeatedField(f("repeated_import_enum" ),0));
-
- Assert.assertEquals("224", message.getRepeatedField(f("repeated_string_piece"), 0));
- Assert.assertEquals("225", message.getRepeatedField(f("repeated_cord"), 0));
-
- Assert.assertEquals(301 , message.getRepeatedField(f("repeated_int32" ), 1));
- Assert.assertEquals(302L , message.getRepeatedField(f("repeated_int64" ), 1));
- Assert.assertEquals(303 , message.getRepeatedField(f("repeated_uint32" ), 1));
- Assert.assertEquals(304L , message.getRepeatedField(f("repeated_uint64" ), 1));
- Assert.assertEquals(305 , message.getRepeatedField(f("repeated_sint32" ), 1));
- Assert.assertEquals(306L , message.getRepeatedField(f("repeated_sint64" ), 1));
- Assert.assertEquals(307 , message.getRepeatedField(f("repeated_fixed32" ), 1));
- Assert.assertEquals(308L , message.getRepeatedField(f("repeated_fixed64" ), 1));
- Assert.assertEquals(309 , message.getRepeatedField(f("repeated_sfixed32"), 1));
- Assert.assertEquals(310L , message.getRepeatedField(f("repeated_sfixed64"), 1));
- Assert.assertEquals(311F , message.getRepeatedField(f("repeated_float" ), 1));
- Assert.assertEquals(312D , message.getRepeatedField(f("repeated_double" ), 1));
- Assert.assertEquals(false, message.getRepeatedField(f("repeated_bool" ), 1));
- Assert.assertEquals("315", message.getRepeatedField(f("repeated_string" ), 1));
- Assert.assertEquals(toBytes("316"), message.getRepeatedField(f("repeated_bytes"), 1));
-
- Assert.assertEquals(317,
- ((Message)message.getRepeatedField(f("repeatedgroup"), 1))
- .getField(repeatedGroupA));
- Assert.assertEquals(318,
- ((Message)message.getRepeatedField(f("repeated_nested_message"), 1))
- .getField(nestedB));
- Assert.assertEquals(319,
- ((Message)message.getRepeatedField(f("repeated_foreign_message"), 1))
- .getField(foreignC));
- Assert.assertEquals(320,
- ((Message)message.getRepeatedField(f("repeated_import_message"), 1))
- .getField(importD));
- Assert.assertEquals(327,
- ((Message)message.getRepeatedField(f("repeated_lazy_message"), 1))
- .getField(nestedB));
-
- Assert.assertEquals( nestedBaz, message.getRepeatedField(f("repeated_nested_enum" ),1));
- Assert.assertEquals(foreignBaz, message.getRepeatedField(f("repeated_foreign_enum"),1));
- Assert.assertEquals( importBaz, message.getRepeatedField(f("repeated_import_enum" ),1));
-
- Assert.assertEquals("324", message.getRepeatedField(f("repeated_string_piece"), 1));
- Assert.assertEquals("325", message.getRepeatedField(f("repeated_cord"), 1));
-
- // -----------------------------------------------------------------
-
- Assert.assertTrue(message.hasField(f("default_int32" )));
- Assert.assertTrue(message.hasField(f("default_int64" )));
- Assert.assertTrue(message.hasField(f("default_uint32" )));
- Assert.assertTrue(message.hasField(f("default_uint64" )));
- Assert.assertTrue(message.hasField(f("default_sint32" )));
- Assert.assertTrue(message.hasField(f("default_sint64" )));
- Assert.assertTrue(message.hasField(f("default_fixed32" )));
- Assert.assertTrue(message.hasField(f("default_fixed64" )));
- Assert.assertTrue(message.hasField(f("default_sfixed32")));
- Assert.assertTrue(message.hasField(f("default_sfixed64")));
- Assert.assertTrue(message.hasField(f("default_float" )));
- Assert.assertTrue(message.hasField(f("default_double" )));
- Assert.assertTrue(message.hasField(f("default_bool" )));
- Assert.assertTrue(message.hasField(f("default_string" )));
- Assert.assertTrue(message.hasField(f("default_bytes" )));
-
- Assert.assertTrue(message.hasField(f("default_nested_enum" )));
- Assert.assertTrue(message.hasField(f("default_foreign_enum")));
- Assert.assertTrue(message.hasField(f("default_import_enum" )));
-
- Assert.assertTrue(message.hasField(f("default_string_piece")));
- Assert.assertTrue(message.hasField(f("default_cord")));
-
- Assert.assertEquals(401 , message.getField(f("default_int32" )));
- Assert.assertEquals(402L , message.getField(f("default_int64" )));
- Assert.assertEquals(403 , message.getField(f("default_uint32" )));
- Assert.assertEquals(404L , message.getField(f("default_uint64" )));
- Assert.assertEquals(405 , message.getField(f("default_sint32" )));
- Assert.assertEquals(406L , message.getField(f("default_sint64" )));
- Assert.assertEquals(407 , message.getField(f("default_fixed32" )));
- Assert.assertEquals(408L , message.getField(f("default_fixed64" )));
- Assert.assertEquals(409 , message.getField(f("default_sfixed32")));
- Assert.assertEquals(410L , message.getField(f("default_sfixed64")));
- Assert.assertEquals(411F , message.getField(f("default_float" )));
- Assert.assertEquals(412D , message.getField(f("default_double" )));
- Assert.assertEquals(false, message.getField(f("default_bool" )));
- Assert.assertEquals("415", message.getField(f("default_string" )));
- Assert.assertEquals(toBytes("416"), message.getField(f("default_bytes")));
-
- Assert.assertEquals( nestedFoo, message.getField(f("default_nested_enum" )));
- Assert.assertEquals(foreignFoo, message.getField(f("default_foreign_enum")));
- Assert.assertEquals( importFoo, message.getField(f("default_import_enum" )));
-
- Assert.assertEquals("424", message.getField(f("default_string_piece")));
- Assert.assertEquals("425", message.getField(f("default_cord")));
- }
-
- // -------------------------------------------------------------------
-
- /**
- * Assert (using {@code junit.framework.Assert}} that all fields of
- * {@code message} are cleared, and that getting the fields returns their
- * default values, using the {@link Message} reflection interface.
- */
- public void assertClearViaReflection(MessageOrBuilder message) {
- // has_blah() should initially be false for all optional fields.
- Assert.assertFalse(message.hasField(f("optional_int32" )));
- Assert.assertFalse(message.hasField(f("optional_int64" )));
- Assert.assertFalse(message.hasField(f("optional_uint32" )));
- Assert.assertFalse(message.hasField(f("optional_uint64" )));
- Assert.assertFalse(message.hasField(f("optional_sint32" )));
- Assert.assertFalse(message.hasField(f("optional_sint64" )));
- Assert.assertFalse(message.hasField(f("optional_fixed32" )));
- Assert.assertFalse(message.hasField(f("optional_fixed64" )));
- Assert.assertFalse(message.hasField(f("optional_sfixed32")));
- Assert.assertFalse(message.hasField(f("optional_sfixed64")));
- Assert.assertFalse(message.hasField(f("optional_float" )));
- Assert.assertFalse(message.hasField(f("optional_double" )));
- Assert.assertFalse(message.hasField(f("optional_bool" )));
- Assert.assertFalse(message.hasField(f("optional_string" )));
- Assert.assertFalse(message.hasField(f("optional_bytes" )));
-
- Assert.assertFalse(message.hasField(f("optionalgroup" )));
- Assert.assertFalse(message.hasField(f("optional_nested_message" )));
- Assert.assertFalse(message.hasField(f("optional_foreign_message")));
- Assert.assertFalse(message.hasField(f("optional_import_message" )));
-
- Assert.assertFalse(message.hasField(f("optional_nested_enum" )));
- Assert.assertFalse(message.hasField(f("optional_foreign_enum")));
- Assert.assertFalse(message.hasField(f("optional_import_enum" )));
-
- Assert.assertFalse(message.hasField(f("optional_string_piece")));
- Assert.assertFalse(message.hasField(f("optional_cord")));
-
- // Optional fields without defaults are set to zero or something like it.
- Assert.assertEquals(0 , message.getField(f("optional_int32" )));
- Assert.assertEquals(0L , message.getField(f("optional_int64" )));
- Assert.assertEquals(0 , message.getField(f("optional_uint32" )));
- Assert.assertEquals(0L , message.getField(f("optional_uint64" )));
- Assert.assertEquals(0 , message.getField(f("optional_sint32" )));
- Assert.assertEquals(0L , message.getField(f("optional_sint64" )));
- Assert.assertEquals(0 , message.getField(f("optional_fixed32" )));
- Assert.assertEquals(0L , message.getField(f("optional_fixed64" )));
- Assert.assertEquals(0 , message.getField(f("optional_sfixed32")));
- Assert.assertEquals(0L , message.getField(f("optional_sfixed64")));
- Assert.assertEquals(0F , message.getField(f("optional_float" )));
- Assert.assertEquals(0D , message.getField(f("optional_double" )));
- Assert.assertEquals(false, message.getField(f("optional_bool" )));
- Assert.assertEquals("" , message.getField(f("optional_string" )));
- Assert.assertEquals(ByteString.EMPTY, message.getField(f("optional_bytes")));
-
- // Embedded messages should also be clear.
- Assert.assertFalse(
- ((Message)message.getField(f("optionalgroup"))).hasField(groupA));
- Assert.assertFalse(
- ((Message)message.getField(f("optional_nested_message")))
- .hasField(nestedB));
- Assert.assertFalse(
- ((Message)message.getField(f("optional_foreign_message")))
- .hasField(foreignC));
- Assert.assertFalse(
- ((Message)message.getField(f("optional_import_message")))
- .hasField(importD));
- Assert.assertFalse(
- ((Message)message.getField(f("optional_public_import_message")))
- .hasField(importE));
- Assert.assertFalse(
- ((Message)message.getField(f("optional_lazy_message")))
- .hasField(nestedB));
-
- Assert.assertEquals(0,
- ((Message)message.getField(f("optionalgroup"))).getField(groupA));
- Assert.assertEquals(0,
- ((Message)message.getField(f("optional_nested_message")))
- .getField(nestedB));
- Assert.assertEquals(0,
- ((Message)message.getField(f("optional_foreign_message")))
- .getField(foreignC));
- Assert.assertEquals(0,
- ((Message)message.getField(f("optional_import_message")))
- .getField(importD));
- Assert.assertEquals(0,
- ((Message)message.getField(f("optional_public_import_message")))
- .getField(importE));
- Assert.assertEquals(0,
- ((Message)message.getField(f("optional_lazy_message")))
- .getField(nestedB));
-
- // Enums without defaults are set to the first value in the enum.
- Assert.assertEquals( nestedFoo, message.getField(f("optional_nested_enum" )));
- Assert.assertEquals(foreignFoo, message.getField(f("optional_foreign_enum")));
- Assert.assertEquals( importFoo, message.getField(f("optional_import_enum" )));
-
- Assert.assertEquals("", message.getField(f("optional_string_piece")));
- Assert.assertEquals("", message.getField(f("optional_cord")));
-
- // Repeated fields are empty.
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_int32" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_int64" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_uint32" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_uint64" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_sint32" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_sint64" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_fixed32" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_fixed64" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_sfixed32")));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_sfixed64")));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_float" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_double" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_bool" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_string" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_bytes" )));
-
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeatedgroup" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_nested_message" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_foreign_message")));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_import_message" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_lazy_message" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_nested_enum" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_foreign_enum" )));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_import_enum" )));
-
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_string_piece")));
- Assert.assertEquals(0, message.getRepeatedFieldCount(f("repeated_cord")));
-
- // has_blah() should also be false for all default fields.
- Assert.assertFalse(message.hasField(f("default_int32" )));
- Assert.assertFalse(message.hasField(f("default_int64" )));
- Assert.assertFalse(message.hasField(f("default_uint32" )));
- Assert.assertFalse(message.hasField(f("default_uint64" )));
- Assert.assertFalse(message.hasField(f("default_sint32" )));
- Assert.assertFalse(message.hasField(f("default_sint64" )));
- Assert.assertFalse(message.hasField(f("default_fixed32" )));
- Assert.assertFalse(message.hasField(f("default_fixed64" )));
- Assert.assertFalse(message.hasField(f("default_sfixed32")));
- Assert.assertFalse(message.hasField(f("default_sfixed64")));
- Assert.assertFalse(message.hasField(f("default_float" )));
- Assert.assertFalse(message.hasField(f("default_double" )));
- Assert.assertFalse(message.hasField(f("default_bool" )));
- Assert.assertFalse(message.hasField(f("default_string" )));
- Assert.assertFalse(message.hasField(f("default_bytes" )));
-
- Assert.assertFalse(message.hasField(f("default_nested_enum" )));
- Assert.assertFalse(message.hasField(f("default_foreign_enum")));
- Assert.assertFalse(message.hasField(f("default_import_enum" )));
-
- Assert.assertFalse(message.hasField(f("default_string_piece" )));
- Assert.assertFalse(message.hasField(f("default_cord" )));
-
- // Fields with defaults have their default values (duh).
- Assert.assertEquals( 41 , message.getField(f("default_int32" )));
- Assert.assertEquals( 42L , message.getField(f("default_int64" )));
- Assert.assertEquals( 43 , message.getField(f("default_uint32" )));
- Assert.assertEquals( 44L , message.getField(f("default_uint64" )));
- Assert.assertEquals(-45 , message.getField(f("default_sint32" )));
- Assert.assertEquals( 46L , message.getField(f("default_sint64" )));
- Assert.assertEquals( 47 , message.getField(f("default_fixed32" )));
- Assert.assertEquals( 48L , message.getField(f("default_fixed64" )));
- Assert.assertEquals( 49 , message.getField(f("default_sfixed32")));
- Assert.assertEquals(-50L , message.getField(f("default_sfixed64")));
- Assert.assertEquals( 51.5F , message.getField(f("default_float" )));
- Assert.assertEquals( 52e3D , message.getField(f("default_double" )));
- Assert.assertEquals(true , message.getField(f("default_bool" )));
- Assert.assertEquals("hello", message.getField(f("default_string" )));
- Assert.assertEquals(toBytes("world"), message.getField(f("default_bytes")));
-
- Assert.assertEquals( nestedBar, message.getField(f("default_nested_enum" )));
- Assert.assertEquals(foreignBar, message.getField(f("default_foreign_enum")));
- Assert.assertEquals( importBar, message.getField(f("default_import_enum" )));
-
- Assert.assertEquals("abc", message.getField(f("default_string_piece")));
- Assert.assertEquals("123", message.getField(f("default_cord")));
- }
-
-
- // ---------------------------------------------------------------
-
- public void assertRepeatedFieldsModifiedViaReflection(
- MessageOrBuilder message) {
- // ModifyRepeatedFields only sets the second repeated element of each
- // field. In addition to verifying this, we also verify that the first
- // element and size were *not* modified.
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_int32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_int64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_uint32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_uint64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sint32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sint64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_fixed32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_fixed64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sfixed32")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_sfixed64")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_float" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_double" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_bool" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_string" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_bytes" )));
-
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeatedgroup" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_nested_message" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_foreign_message")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_import_message" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_lazy_message" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_nested_enum" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_foreign_enum" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_import_enum" )));
-
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_string_piece")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("repeated_cord")));
-
- Assert.assertEquals(201 , message.getRepeatedField(f("repeated_int32" ), 0));
- Assert.assertEquals(202L , message.getRepeatedField(f("repeated_int64" ), 0));
- Assert.assertEquals(203 , message.getRepeatedField(f("repeated_uint32" ), 0));
- Assert.assertEquals(204L , message.getRepeatedField(f("repeated_uint64" ), 0));
- Assert.assertEquals(205 , message.getRepeatedField(f("repeated_sint32" ), 0));
- Assert.assertEquals(206L , message.getRepeatedField(f("repeated_sint64" ), 0));
- Assert.assertEquals(207 , message.getRepeatedField(f("repeated_fixed32" ), 0));
- Assert.assertEquals(208L , message.getRepeatedField(f("repeated_fixed64" ), 0));
- Assert.assertEquals(209 , message.getRepeatedField(f("repeated_sfixed32"), 0));
- Assert.assertEquals(210L , message.getRepeatedField(f("repeated_sfixed64"), 0));
- Assert.assertEquals(211F , message.getRepeatedField(f("repeated_float" ), 0));
- Assert.assertEquals(212D , message.getRepeatedField(f("repeated_double" ), 0));
- Assert.assertEquals(true , message.getRepeatedField(f("repeated_bool" ), 0));
- Assert.assertEquals("215", message.getRepeatedField(f("repeated_string" ), 0));
- Assert.assertEquals(toBytes("216"), message.getRepeatedField(f("repeated_bytes"), 0));
-
- Assert.assertEquals(217,
- ((Message)message.getRepeatedField(f("repeatedgroup"), 0))
- .getField(repeatedGroupA));
- Assert.assertEquals(218,
- ((Message)message.getRepeatedField(f("repeated_nested_message"), 0))
- .getField(nestedB));
- Assert.assertEquals(219,
- ((Message)message.getRepeatedField(f("repeated_foreign_message"), 0))
- .getField(foreignC));
- Assert.assertEquals(220,
- ((Message)message.getRepeatedField(f("repeated_import_message"), 0))
- .getField(importD));
- Assert.assertEquals(227,
- ((Message)message.getRepeatedField(f("repeated_lazy_message"), 0))
- .getField(nestedB));
-
- Assert.assertEquals( nestedBar, message.getRepeatedField(f("repeated_nested_enum" ),0));
- Assert.assertEquals(foreignBar, message.getRepeatedField(f("repeated_foreign_enum"),0));
- Assert.assertEquals( importBar, message.getRepeatedField(f("repeated_import_enum" ),0));
-
- Assert.assertEquals("224", message.getRepeatedField(f("repeated_string_piece"), 0));
- Assert.assertEquals("225", message.getRepeatedField(f("repeated_cord"), 0));
-
- Assert.assertEquals(501 , message.getRepeatedField(f("repeated_int32" ), 1));
- Assert.assertEquals(502L , message.getRepeatedField(f("repeated_int64" ), 1));
- Assert.assertEquals(503 , message.getRepeatedField(f("repeated_uint32" ), 1));
- Assert.assertEquals(504L , message.getRepeatedField(f("repeated_uint64" ), 1));
- Assert.assertEquals(505 , message.getRepeatedField(f("repeated_sint32" ), 1));
- Assert.assertEquals(506L , message.getRepeatedField(f("repeated_sint64" ), 1));
- Assert.assertEquals(507 , message.getRepeatedField(f("repeated_fixed32" ), 1));
- Assert.assertEquals(508L , message.getRepeatedField(f("repeated_fixed64" ), 1));
- Assert.assertEquals(509 , message.getRepeatedField(f("repeated_sfixed32"), 1));
- Assert.assertEquals(510L , message.getRepeatedField(f("repeated_sfixed64"), 1));
- Assert.assertEquals(511F , message.getRepeatedField(f("repeated_float" ), 1));
- Assert.assertEquals(512D , message.getRepeatedField(f("repeated_double" ), 1));
- Assert.assertEquals(true , message.getRepeatedField(f("repeated_bool" ), 1));
- Assert.assertEquals("515", message.getRepeatedField(f("repeated_string" ), 1));
- Assert.assertEquals(toBytes("516"), message.getRepeatedField(f("repeated_bytes"), 1));
-
- Assert.assertEquals(517,
- ((Message)message.getRepeatedField(f("repeatedgroup"), 1))
- .getField(repeatedGroupA));
- Assert.assertEquals(518,
- ((Message)message.getRepeatedField(f("repeated_nested_message"), 1))
- .getField(nestedB));
- Assert.assertEquals(519,
- ((Message)message.getRepeatedField(f("repeated_foreign_message"), 1))
- .getField(foreignC));
- Assert.assertEquals(520,
- ((Message)message.getRepeatedField(f("repeated_import_message"), 1))
- .getField(importD));
- Assert.assertEquals(527,
- ((Message)message.getRepeatedField(f("repeated_lazy_message"), 1))
- .getField(nestedB));
-
- Assert.assertEquals( nestedFoo, message.getRepeatedField(f("repeated_nested_enum" ),1));
- Assert.assertEquals(foreignFoo, message.getRepeatedField(f("repeated_foreign_enum"),1));
- Assert.assertEquals( importFoo, message.getRepeatedField(f("repeated_import_enum" ),1));
-
- Assert.assertEquals("524", message.getRepeatedField(f("repeated_string_piece"), 1));
- Assert.assertEquals("525", message.getRepeatedField(f("repeated_cord"), 1));
- }
-
- public void setPackedFieldsViaReflection(Message.Builder message) {
- message.addRepeatedField(f("packed_int32" ), 601 );
- message.addRepeatedField(f("packed_int64" ), 602L);
- message.addRepeatedField(f("packed_uint32" ), 603 );
- message.addRepeatedField(f("packed_uint64" ), 604L);
- message.addRepeatedField(f("packed_sint32" ), 605 );
- message.addRepeatedField(f("packed_sint64" ), 606L);
- message.addRepeatedField(f("packed_fixed32" ), 607 );
- message.addRepeatedField(f("packed_fixed64" ), 608L);
- message.addRepeatedField(f("packed_sfixed32"), 609 );
- message.addRepeatedField(f("packed_sfixed64"), 610L);
- message.addRepeatedField(f("packed_float" ), 611F);
- message.addRepeatedField(f("packed_double" ), 612D);
- message.addRepeatedField(f("packed_bool" ), true);
- message.addRepeatedField(f("packed_enum" ), foreignBar);
- // Add a second one of each field.
- message.addRepeatedField(f("packed_int32" ), 701 );
- message.addRepeatedField(f("packed_int64" ), 702L);
- message.addRepeatedField(f("packed_uint32" ), 703 );
- message.addRepeatedField(f("packed_uint64" ), 704L);
- message.addRepeatedField(f("packed_sint32" ), 705 );
- message.addRepeatedField(f("packed_sint64" ), 706L);
- message.addRepeatedField(f("packed_fixed32" ), 707 );
- message.addRepeatedField(f("packed_fixed64" ), 708L);
- message.addRepeatedField(f("packed_sfixed32"), 709 );
- message.addRepeatedField(f("packed_sfixed64"), 710L);
- message.addRepeatedField(f("packed_float" ), 711F);
- message.addRepeatedField(f("packed_double" ), 712D);
- message.addRepeatedField(f("packed_bool" ), false);
- message.addRepeatedField(f("packed_enum" ), foreignBaz);
- }
-
- public void assertPackedFieldsSetViaReflection(MessageOrBuilder message) {
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_int32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_int64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_uint32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_uint64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_sint32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_sint64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_fixed32" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_fixed64" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_sfixed32")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_sfixed64")));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_float" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_double" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_bool" )));
- Assert.assertEquals(2, message.getRepeatedFieldCount(f("packed_enum" )));
- Assert.assertEquals(601 , message.getRepeatedField(f("packed_int32" ), 0));
- Assert.assertEquals(602L , message.getRepeatedField(f("packed_int64" ), 0));
- Assert.assertEquals(603 , message.getRepeatedField(f("packed_uint32" ), 0));
- Assert.assertEquals(604L , message.getRepeatedField(f("packed_uint64" ), 0));
- Assert.assertEquals(605 , message.getRepeatedField(f("packed_sint32" ), 0));
- Assert.assertEquals(606L , message.getRepeatedField(f("packed_sint64" ), 0));
- Assert.assertEquals(607 , message.getRepeatedField(f("packed_fixed32" ), 0));
- Assert.assertEquals(608L , message.getRepeatedField(f("packed_fixed64" ), 0));
- Assert.assertEquals(609 , message.getRepeatedField(f("packed_sfixed32"), 0));
- Assert.assertEquals(610L , message.getRepeatedField(f("packed_sfixed64"), 0));
- Assert.assertEquals(611F , message.getRepeatedField(f("packed_float" ), 0));
- Assert.assertEquals(612D , message.getRepeatedField(f("packed_double" ), 0));
- Assert.assertEquals(true , message.getRepeatedField(f("packed_bool" ), 0));
- Assert.assertEquals(foreignBar, message.getRepeatedField(f("packed_enum" ),0));
- Assert.assertEquals(701 , message.getRepeatedField(f("packed_int32" ), 1));
- Assert.assertEquals(702L , message.getRepeatedField(f("packed_int64" ), 1));
- Assert.assertEquals(703 , message.getRepeatedField(f("packed_uint32" ), 1));
- Assert.assertEquals(704L , message.getRepeatedField(f("packed_uint64" ), 1));
- Assert.assertEquals(705 , message.getRepeatedField(f("packed_sint32" ), 1));
- Assert.assertEquals(706L , message.getRepeatedField(f("packed_sint64" ), 1));
- Assert.assertEquals(707 , message.getRepeatedField(f("packed_fixed32" ), 1));
- Assert.assertEquals(708L , message.getRepeatedField(f("packed_fixed64" ), 1));
- Assert.assertEquals(709 , message.getRepeatedField(f("packed_sfixed32"), 1));
- Assert.assertEquals(710L , message.getRepeatedField(f("packed_sfixed64"), 1));
- Assert.assertEquals(711F , message.getRepeatedField(f("packed_float" ), 1));
- Assert.assertEquals(712D , message.getRepeatedField(f("packed_double" ), 1));
- Assert.assertEquals(false, message.getRepeatedField(f("packed_bool" ), 1));
- Assert.assertEquals(foreignBaz, message.getRepeatedField(f("packed_enum" ),1));
- }
-
- /**
- * Verifies that the reflection setters for the given.Builder object throw a
- * NullPointerException if they are passed a null value. Uses Assert to throw an
- * appropriate assertion failure, if the condition is not verified.
- */
- public void assertReflectionSettersRejectNull(Message.Builder builder)
- throws Exception {
- try {
- builder.setField(f("optional_string"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setField(f("optional_bytes"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setField(f("optional_nested_enum"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setField(f("optional_nested_message"),
- (TestAllTypes.NestedMessage) null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.setField(f("optional_nested_message"),
- (TestAllTypes.NestedMessage.Builder) null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- try {
- builder.addRepeatedField(f("repeated_string"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedField(f("repeated_bytes"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedField(f("repeated_nested_enum"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- try {
- builder.addRepeatedField(f("repeated_nested_message"), null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- }
-
- /**
- * Verifies that the reflection repeated setters for the given Builder object throw a
- * NullPointerException if they are passed a null value. Uses Assert to throw an appropriate
- * assertion failure, if the condition is not verified.
- */
- public void assertReflectionRepeatedSettersRejectNull(Message.Builder builder)
- throws Exception {
- builder.addRepeatedField(f("repeated_string"), "one");
- try {
- builder.setRepeatedField(f("repeated_string"), 0, null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- builder.addRepeatedField(f("repeated_bytes"), toBytes("one"));
- try {
- builder.setRepeatedField(f("repeated_bytes"), 0, null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- builder.addRepeatedField(f("repeated_nested_enum"), nestedBaz);
- try {
- builder.setRepeatedField(f("repeated_nested_enum"), 0, null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
-
- builder.addRepeatedField(
- f("repeated_nested_message"),
- TestAllTypes.NestedMessage.newBuilder().setBb(218).build());
- try {
- builder.setRepeatedField(f("repeated_nested_message"), 0, null);
- Assert.fail("Exception was not thrown");
- } catch (NullPointerException e) {
- // We expect this exception.
- }
- }
- }
-
- /**
- * @param filePath The path relative to
- * {@link #getTestDataDir}.
- */
- public static String readTextFromFile(String filePath) {
- return readBytesFromFile(filePath).toStringUtf8();
- }
-
- private static File getTestDataDir() {
- // Search each parent directory looking for "src/google/protobuf".
- File ancestor = new File(".");
- try {
- ancestor = ancestor.getCanonicalFile();
- } catch (IOException e) {
- throw new RuntimeException(
- "Couldn't get canonical name of working directory.", e);
- }
- while (ancestor != null && ancestor.exists()) {
- if (new File(ancestor, "src/google/protobuf").exists()) {
- return new File(ancestor, "src/google/protobuf/testdata");
- }
- ancestor = ancestor.getParentFile();
- }
-
- throw new RuntimeException(
- "Could not find golden files. This test must be run from within the " +
- "protobuf source package so that it can read test data files from the " +
- "C++ source tree: " + new File(".").getAbsolutePath());
- }
-
- /**
- * @param filename The path relative to
- * {@link #getTestDataDir}.
- */
- public static ByteString readBytesFromFile(String filename) {
- File fullPath = new File(getTestDataDir(), filename);
- try {
- RandomAccessFile file = new RandomAccessFile(fullPath, "r");
- byte[] content = new byte[(int) file.length()];
- file.readFully(content);
- return ByteString.copyFrom(content);
- } catch (IOException e) {
- // Throw a RuntimeException here so that we can call this function from
- // static initializers.
- throw new IllegalArgumentException(
- "Couldn't read file: " + fullPath.getPath(), e);
- }
- }
-
- /**
- * Get the bytes of the "golden message". This is a serialized TestAllTypes
- * with all fields set as they would be by
- * {@link #setAllFields(TestAllTypes.Builder)}, but it is loaded from a file
- * on disk rather than generated dynamically. The file is actually generated
- * by C++ code, so testing against it verifies compatibility with C++.
- */
- public static ByteString getGoldenMessage() {
- if (goldenMessage == null) {
- goldenMessage = readBytesFromFile("golden_message");
- }
- return goldenMessage;
- }
- private static ByteString goldenMessage = null;
-
- /**
- * Get the bytes of the "golden packed fields message". This is a serialized
- * TestPackedTypes with all fields set as they would be by
- * {@link #setPackedFields(TestPackedTypes.Builder)}, but it is loaded from a
- * file on disk rather than generated dynamically. The file is actually
- * generated by C++ code, so testing against it verifies compatibility with
- * C++.
- */
- public static ByteString getGoldenPackedFieldsMessage() {
- if (goldenPackedFieldsMessage == null) {
- goldenPackedFieldsMessage =
- readBytesFromFile("golden_packed_fields_message");
- }
- return goldenPackedFieldsMessage;
- }
- private static ByteString goldenPackedFieldsMessage = null;
-
- public static abstract class HackMessage extends GeneratedMessage {
- public interface MyInterface extends BuilderParent {
- }
- }
- /**
- * Mock implementation of {@link GeneratedMessage.BuilderParent} for testing.
- *
- * @author jonp@google.com (Jon Perlow)
- */
- public static class MockBuilderParent
- implements HackMessage.MyInterface {
-
- private int invalidations;
-
- //@Override (Java 1.6 override semantics, but we must support 1.5)
- public void markDirty() {
- invalidations++;
- }
-
- public int getInvalidationCount() {
- return invalidations;
- }
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java
deleted file mode 100644
index edcc890..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TextFormatTest.java
+++ /dev/null
@@ -1,536 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import protobuf_unittest.UnittestMset.TestMessageSet;
-import protobuf_unittest.UnittestMset.TestMessageSetExtension1;
-import protobuf_unittest.UnittestMset.TestMessageSetExtension2;
-import protobuf_unittest.UnittestProto.OneString;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage;
-import protobuf_unittest.UnittestProto.TestEmptyMessage;
-
-import junit.framework.TestCase;
-
-import java.io.StringReader;
-
-/**
- * Test case for {@link TextFormat}.
- *
- * TODO(wenboz): ExtensionTest and rest of text_format_unittest.cc.
- *
- * @author wenboz@google.com (Wenbo Zhu)
- */
-public class TextFormatTest extends TestCase {
-
- // A basic string with different escapable characters for testing.
- private final static String kEscapeTestString =
- "\"A string with ' characters \n and \r newlines and \t tabs and \001 "
- + "slashes \\";
-
- // A representation of the above string with all the characters escaped.
- private final static String kEscapeTestStringEscaped =
- "\\\"A string with \\' characters \\n and \\r newlines "
- + "and \\t tabs and \\001 slashes \\\\";
-
- private static String allFieldsSetText = TestUtil.readTextFromFile(
- "text_format_unittest_data.txt");
- private static String allExtensionsSetText = TestUtil.readTextFromFile(
- "text_format_unittest_extensions_data.txt");
-
- private static String exoticText =
- "repeated_int32: -1\n" +
- "repeated_int32: -2147483648\n" +
- "repeated_int64: -1\n" +
- "repeated_int64: -9223372036854775808\n" +
- "repeated_uint32: 4294967295\n" +
- "repeated_uint32: 2147483648\n" +
- "repeated_uint64: 18446744073709551615\n" +
- "repeated_uint64: 9223372036854775808\n" +
- "repeated_double: 123.0\n" +
- "repeated_double: 123.5\n" +
- "repeated_double: 0.125\n" +
- "repeated_double: .125\n" +
- "repeated_double: -.125\n" +
- "repeated_double: 1.23E17\n" +
- "repeated_double: 1.23E+17\n" +
- "repeated_double: -1.23e-17\n" +
- "repeated_double: .23e+17\n" +
- "repeated_double: -.23E17\n" +
- "repeated_double: 1.235E22\n" +
- "repeated_double: 1.235E-18\n" +
- "repeated_double: 123.456789\n" +
- "repeated_double: Infinity\n" +
- "repeated_double: -Infinity\n" +
- "repeated_double: NaN\n" +
- "repeated_string: \"\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"" +
- "\\341\\210\\264\"\n" +
- "repeated_bytes: \"\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"\\376\"\n";
-
- private static String canonicalExoticText =
- exoticText.replace(": .", ": 0.").replace(": -.", ": -0.") // short-form double
- .replace("23e", "23E").replace("E+", "E").replace("0.23E17", "2.3E16");
-
- private String messageSetText =
- "[protobuf_unittest.TestMessageSetExtension1] {\n" +
- " i: 123\n" +
- "}\n" +
- "[protobuf_unittest.TestMessageSetExtension2] {\n" +
- " str: \"foo\"\n" +
- "}\n";
-
- /** Print TestAllTypes and compare with golden file. */
- public void testPrintMessage() throws Exception {
- String javaText = TextFormat.printToString(TestUtil.getAllSet());
-
- // Java likes to add a trailing ".0" to floats and doubles. C printf
- // (with %g format) does not. Our golden files are used for both
- // C++ and Java TextFormat classes, so we need to conform.
- javaText = javaText.replace(".0\n", "\n");
-
- assertEquals(allFieldsSetText, javaText);
- }
-
- /** Print TestAllTypes as Builder and compare with golden file. */
- public void testPrintMessageBuilder() throws Exception {
- String javaText = TextFormat.printToString(TestUtil.getAllSetBuilder());
-
- // Java likes to add a trailing ".0" to floats and doubles. C printf
- // (with %g format) does not. Our golden files are used for both
- // C++ and Java TextFormat classes, so we need to conform.
- javaText = javaText.replace(".0\n", "\n");
-
- assertEquals(allFieldsSetText, javaText);
- }
-
- /** Print TestAllExtensions and compare with golden file. */
- public void testPrintExtensions() throws Exception {
- String javaText = TextFormat.printToString(TestUtil.getAllExtensionsSet());
-
- // Java likes to add a trailing ".0" to floats and doubles. C printf
- // (with %g format) does not. Our golden files are used for both
- // C++ and Java TextFormat classes, so we need to conform.
- javaText = javaText.replace(".0\n", "\n");
-
- assertEquals(allExtensionsSetText, javaText);
- }
-
- // Creates an example unknown field set.
- private UnknownFieldSet makeUnknownFieldSet() {
- return UnknownFieldSet.newBuilder()
- .addField(5,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(1)
- .addFixed32(2)
- .addFixed64(3)
- .addLengthDelimited(ByteString.copyFromUtf8("4"))
- .addGroup(
- UnknownFieldSet.newBuilder()
- .addField(10,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(5)
- .build())
- .build())
- .build())
- .addField(8,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(1)
- .addVarint(2)
- .addVarint(3)
- .build())
- .addField(15,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(0xABCDEF1234567890L)
- .addFixed32(0xABCD1234)
- .addFixed64(0xABCDEF1234567890L)
- .build())
- .build();
- }
-
- public void testPrintUnknownFields() throws Exception {
- // Test printing of unknown fields in a message.
-
- TestEmptyMessage message =
- TestEmptyMessage.newBuilder()
- .setUnknownFields(makeUnknownFieldSet())
- .build();
-
- assertEquals(
- "5: 1\n" +
- "5: 0x00000002\n" +
- "5: 0x0000000000000003\n" +
- "5: \"4\"\n" +
- "5 {\n" +
- " 10: 5\n" +
- "}\n" +
- "8: 1\n" +
- "8: 2\n" +
- "8: 3\n" +
- "15: 12379813812177893520\n" +
- "15: 0xabcd1234\n" +
- "15: 0xabcdef1234567890\n",
- TextFormat.printToString(message));
- }
-
- public void testPrintField() throws Exception {
- final FieldDescriptor dataField =
- OneString.getDescriptor().findFieldByName("data");
- assertEquals(
- "data: \"test data\"\n",
- TextFormat.printFieldToString(dataField, "test data"));
-
- final FieldDescriptor optionalField =
- TestAllTypes.getDescriptor().findFieldByName("optional_nested_message");
- final Object value = NestedMessage.newBuilder().setBb(42).build();
-
- assertEquals(
- "optional_nested_message {\n bb: 42\n}\n",
- TextFormat.printFieldToString(optionalField, value));
- }
-
- /**
- * Helper to construct a ByteString from a String containing only 8-bit
- * characters. The characters are converted directly to bytes, *not*
- * encoded using UTF-8.
- */
- private ByteString bytes(String str) throws Exception {
- return ByteString.copyFrom(str.getBytes("ISO-8859-1"));
- }
-
- /**
- * Helper to construct a ByteString 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 ByteString bytes(int... bytesAsInts) {
- byte[] bytes = new byte[bytesAsInts.length];
- for (int i = 0; i < bytesAsInts.length; i++) {
- bytes[i] = (byte) bytesAsInts[i];
- }
- return ByteString.copyFrom(bytes);
- }
-
- public void testPrintExotic() throws Exception {
- Message message = TestAllTypes.newBuilder()
- // Signed vs. unsigned numbers.
- .addRepeatedInt32 (-1)
- .addRepeatedUint32(-1)
- .addRepeatedInt64 (-1)
- .addRepeatedUint64(-1)
-
- .addRepeatedInt32 (1 << 31)
- .addRepeatedUint32(1 << 31)
- .addRepeatedInt64 (1l << 63)
- .addRepeatedUint64(1l << 63)
-
- // Floats of various precisions and exponents.
- .addRepeatedDouble(123)
- .addRepeatedDouble(123.5)
- .addRepeatedDouble(0.125)
- .addRepeatedDouble(.125)
- .addRepeatedDouble(-.125)
- .addRepeatedDouble(123e15)
- .addRepeatedDouble(123e15)
- .addRepeatedDouble(-1.23e-17)
- .addRepeatedDouble(.23e17)
- .addRepeatedDouble(-23e15)
- .addRepeatedDouble(123.5e20)
- .addRepeatedDouble(123.5e-20)
- .addRepeatedDouble(123.456789)
- .addRepeatedDouble(Double.POSITIVE_INFINITY)
- .addRepeatedDouble(Double.NEGATIVE_INFINITY)
- .addRepeatedDouble(Double.NaN)
-
- // Strings and bytes that needing escaping.
- .addRepeatedString("\0\001\007\b\f\n\r\t\013\\\'\"\u1234")
- .addRepeatedBytes(bytes("\0\001\007\b\f\n\r\t\013\\\'\"\u00fe"))
- .build();
-
- assertEquals(canonicalExoticText, message.toString());
- }
-
- public void testPrintMessageSet() throws Exception {
- TestMessageSet messageSet =
- TestMessageSet.newBuilder()
- .setExtension(
- TestMessageSetExtension1.messageSetExtension,
- TestMessageSetExtension1.newBuilder().setI(123).build())
- .setExtension(
- TestMessageSetExtension2.messageSetExtension,
- TestMessageSetExtension2.newBuilder().setStr("foo").build())
- .build();
-
- assertEquals(messageSetText, messageSet.toString());
- }
-
- // =================================================================
-
- public void testParse() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge(allFieldsSetText, builder);
- TestUtil.assertAllFieldsSet(builder.build());
- }
-
- public void testParseReader() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge(new StringReader(allFieldsSetText), builder);
- TestUtil.assertAllFieldsSet(builder.build());
- }
-
- public void testParseExtensions() throws Exception {
- TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();
- TextFormat.merge(allExtensionsSetText,
- TestUtil.getExtensionRegistry(),
- builder);
- TestUtil.assertAllExtensionsSet(builder.build());
- }
-
- public void testParseCompatibility() throws Exception {
- String original = "repeated_float: inf\n" +
- "repeated_float: -inf\n" +
- "repeated_float: nan\n" +
- "repeated_float: inff\n" +
- "repeated_float: -inff\n" +
- "repeated_float: nanf\n" +
- "repeated_float: 1.0f\n" +
- "repeated_float: infinityf\n" +
- "repeated_float: -Infinityf\n" +
- "repeated_double: infinity\n" +
- "repeated_double: -infinity\n" +
- "repeated_double: nan\n";
- String canonical = "repeated_float: Infinity\n" +
- "repeated_float: -Infinity\n" +
- "repeated_float: NaN\n" +
- "repeated_float: Infinity\n" +
- "repeated_float: -Infinity\n" +
- "repeated_float: NaN\n" +
- "repeated_float: 1.0\n" +
- "repeated_float: Infinity\n" +
- "repeated_float: -Infinity\n" +
- "repeated_double: Infinity\n" +
- "repeated_double: -Infinity\n" +
- "repeated_double: NaN\n";
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge(original, builder);
- assertEquals(canonical, builder.build().toString());
- }
-
- public void testParseExotic() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge(exoticText, builder);
-
- // Too lazy to check things individually. Don't try to debug this
- // if testPrintExotic() is failing.
- assertEquals(canonicalExoticText, builder.build().toString());
- }
-
- public void testParseMessageSet() throws Exception {
- ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
- extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
- extensionRegistry.add(TestMessageSetExtension2.messageSetExtension);
-
- TestMessageSet.Builder builder = TestMessageSet.newBuilder();
- TextFormat.merge(messageSetText, extensionRegistry, builder);
- TestMessageSet messageSet = builder.build();
-
- assertTrue(messageSet.hasExtension(
- TestMessageSetExtension1.messageSetExtension));
- assertEquals(123, messageSet.getExtension(
- TestMessageSetExtension1.messageSetExtension).getI());
- assertTrue(messageSet.hasExtension(
- TestMessageSetExtension2.messageSetExtension));
- assertEquals("foo", messageSet.getExtension(
- TestMessageSetExtension2.messageSetExtension).getStr());
- }
-
- public void testParseNumericEnum() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge("optional_nested_enum: 2", builder);
- assertEquals(TestAllTypes.NestedEnum.BAR, builder.getOptionalNestedEnum());
- }
-
- public void testParseAngleBrackets() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge("OptionalGroup: < a: 1 >", builder);
- assertTrue(builder.hasOptionalGroup());
- assertEquals(1, builder.getOptionalGroup().getA());
- }
-
- public void testParseComment() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge(
- "# this is a comment\n" +
- "optional_int32: 1 # another comment\n" +
- "optional_int64: 2\n" +
- "# EOF comment", builder);
- assertEquals(1, builder.getOptionalInt32());
- assertEquals(2, builder.getOptionalInt64());
- }
-
- // =================================================================
-
- public void testParseString() throws Exception {
- final String zh = "\u9999\u6e2f\u4e0a\u6d77\ud84f\udf80\u8c50\u9280\u884c";
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge("optional_string: \"" + zh + "\"", builder);
- assertEquals(zh, builder.getOptionalString());
- }
-
- public void testParseLongString() throws Exception {
- String longText =
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890" +
- "123456789012345678901234567890123456789012345678901234567890";
-
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge("optional_string: \"" + longText + "\"", builder);
- assertEquals(longText, builder.getOptionalString());
- }
-
- public void testParseBoolean() throws Exception {
- String goodText =
- "repeated_bool: t repeated_bool : 0\n" +
- "repeated_bool :f repeated_bool:1";
- String goodTextCanonical =
- "repeated_bool: true\n" +
- "repeated_bool: false\n" +
- "repeated_bool: false\n" +
- "repeated_bool: true\n";
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge(goodText, builder);
- assertEquals(goodTextCanonical, builder.build().toString());
-
- try {
- TestAllTypes.Builder badBuilder = TestAllTypes.newBuilder();
- TextFormat.merge("optional_bool:2", badBuilder);
- fail("Should have thrown an exception.");
- } catch (TextFormat.ParseException e) {
- // success
- }
- try {
- TestAllTypes.Builder badBuilder = TestAllTypes.newBuilder();
- TextFormat.merge("optional_bool: foo", badBuilder);
- fail("Should have thrown an exception.");
- } catch (TextFormat.ParseException e) {
- // success
- }
- }
-
- public void testParseAdjacentStringLiterals() throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- TextFormat.merge("optional_string: \"foo\" 'corge' \"grault\"", builder);
- assertEquals("foocorgegrault", builder.getOptionalString());
- }
-
- public void testPrintFieldValue() throws Exception {
- assertPrintFieldValue("\"Hello\"", "Hello", "repeated_string");
- assertPrintFieldValue("123.0", 123f, "repeated_float");
- assertPrintFieldValue("123.0", 123d, "repeated_double");
- assertPrintFieldValue("123", 123, "repeated_int32");
- assertPrintFieldValue("123", 123L, "repeated_int64");
- assertPrintFieldValue("true", true, "repeated_bool");
- assertPrintFieldValue("4294967295", 0xFFFFFFFF, "repeated_uint32");
- assertPrintFieldValue("18446744073709551615", 0xFFFFFFFFFFFFFFFFL,
- "repeated_uint64");
- assertPrintFieldValue("\"\\001\\002\\003\"",
- ByteString.copyFrom(new byte[] {1, 2, 3}), "repeated_bytes");
- }
-
- private void assertPrintFieldValue(String expect, Object value,
- String fieldName) throws Exception {
- TestAllTypes.Builder builder = TestAllTypes.newBuilder();
- StringBuilder sb = new StringBuilder();
- TextFormat.printFieldValue(
- TestAllTypes.getDescriptor().findFieldByName(fieldName),
- value, sb);
- assertEquals(expect, sb.toString());
- }
-
- public void testShortDebugString() {
- assertEquals("optional_nested_message { bb: 42 } repeated_int32: 1"
- + " repeated_uint32: 2",
- TextFormat.shortDebugString(TestAllTypes.newBuilder()
- .addRepeatedInt32(1)
- .addRepeatedUint32(2)
- .setOptionalNestedMessage(
- NestedMessage.newBuilder().setBb(42).build())
- .build()));
- }
-
- public void testShortDebugString_unknown() {
- assertEquals("5: 1 5: 0x00000002 5: 0x0000000000000003 5: \"4\" 5 { 10: 5 }"
- + " 8: 1 8: 2 8: 3 15: 12379813812177893520 15: 0xabcd1234 15:"
- + " 0xabcdef1234567890",
- TextFormat.shortDebugString(makeUnknownFieldSet()));
- }
-
- public void testPrintToUnicodeString() {
- assertEquals(
- "optional_string: \"abc\u3042efg\"\n" +
- "optional_bytes: \"\\343\\201\\202\"\n" +
- "repeated_string: \"\u3093XYZ\"\n",
- TextFormat.printToUnicodeString(TestAllTypes.newBuilder()
- .setOptionalString("abc\u3042efg")
- .setOptionalBytes(bytes(0xe3, 0x81, 0x82))
- .addRepeatedString("\u3093XYZ")
- .build()));
- }
-
- public void testPrintToUnicodeString_unknown() {
- assertEquals(
- "1: \"\\343\\201\\202\"\n",
- TextFormat.printToUnicodeString(UnknownFieldSet.newBuilder()
- .addField(1,
- UnknownFieldSet.Field.newBuilder()
- .addLengthDelimited(bytes(0xe3, 0x81, 0x82)).build())
- .build()));
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java
deleted file mode 100644
index b9bfb69..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnknownFieldSetTest.java
+++ /dev/null
@@ -1,438 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import protobuf_unittest.UnittestProto;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestEmptyMessage;
-import protobuf_unittest.UnittestProto.TestEmptyMessageWithExtensions;
-
-import junit.framework.TestCase;
-
-import java.util.Arrays;
-import java.util.Map;
-
-/**
- * Tests related to unknown field handling.
- *
- * @author kenton@google.com (Kenton Varda)
- */
-public class UnknownFieldSetTest extends TestCase {
- public void setUp() throws Exception {
- descriptor = TestAllTypes.getDescriptor();
- allFields = TestUtil.getAllSet();
- allFieldsData = allFields.toByteString();
- emptyMessage = TestEmptyMessage.parseFrom(allFieldsData);
- unknownFields = emptyMessage.getUnknownFields();
- }
-
- UnknownFieldSet.Field getField(String name) {
- Descriptors.FieldDescriptor field = descriptor.findFieldByName(name);
- assertNotNull(field);
- return unknownFields.getField(field.getNumber());
- }
-
- // Constructs a protocol buffer which contains fields with all the same
- // numbers as allFieldsData except that each field is some other wire
- // type.
- ByteString getBizarroData() throws Exception {
- UnknownFieldSet.Builder bizarroFields = UnknownFieldSet.newBuilder();
-
- UnknownFieldSet.Field varintField =
- UnknownFieldSet.Field.newBuilder().addVarint(1).build();
- UnknownFieldSet.Field fixed32Field =
- UnknownFieldSet.Field.newBuilder().addFixed32(1).build();
-
- for (Map.Entry<Integer, UnknownFieldSet.Field> entry :
- unknownFields.asMap().entrySet()) {
- if (entry.getValue().getVarintList().isEmpty()) {
- // Original field is not a varint, so use a varint.
- bizarroFields.addField(entry.getKey(), varintField);
- } else {
- // Original field *is* a varint, so use something else.
- bizarroFields.addField(entry.getKey(), fixed32Field);
- }
- }
-
- return bizarroFields.build().toByteString();
- }
-
- Descriptors.Descriptor descriptor;
- TestAllTypes allFields;
- ByteString allFieldsData;
-
- // An empty message that has been parsed from allFieldsData. So, it has
- // unknown fields of every type.
- TestEmptyMessage emptyMessage;
- UnknownFieldSet unknownFields;
-
- // =================================================================
-
- public void testVarint() throws Exception {
- UnknownFieldSet.Field field = getField("optional_int32");
- assertEquals(1, field.getVarintList().size());
- assertEquals(allFields.getOptionalInt32(),
- (long) field.getVarintList().get(0));
- }
-
- public void testFixed32() throws Exception {
- UnknownFieldSet.Field field = getField("optional_fixed32");
- assertEquals(1, field.getFixed32List().size());
- assertEquals(allFields.getOptionalFixed32(),
- (int) field.getFixed32List().get(0));
- }
-
- public void testFixed64() throws Exception {
- UnknownFieldSet.Field field = getField("optional_fixed64");
- assertEquals(1, field.getFixed64List().size());
- assertEquals(allFields.getOptionalFixed64(),
- (long) field.getFixed64List().get(0));
- }
-
- public void testLengthDelimited() throws Exception {
- UnknownFieldSet.Field field = getField("optional_bytes");
- assertEquals(1, field.getLengthDelimitedList().size());
- assertEquals(allFields.getOptionalBytes(),
- field.getLengthDelimitedList().get(0));
- }
-
- public void testGroup() throws Exception {
- Descriptors.FieldDescriptor nestedFieldDescriptor =
- TestAllTypes.OptionalGroup.getDescriptor().findFieldByName("a");
- assertNotNull(nestedFieldDescriptor);
-
- UnknownFieldSet.Field field = getField("optionalgroup");
- assertEquals(1, field.getGroupList().size());
-
- UnknownFieldSet group = field.getGroupList().get(0);
- assertEquals(1, group.asMap().size());
- assertTrue(group.hasField(nestedFieldDescriptor.getNumber()));
-
- UnknownFieldSet.Field nestedField =
- group.getField(nestedFieldDescriptor.getNumber());
- assertEquals(1, nestedField.getVarintList().size());
- assertEquals(allFields.getOptionalGroup().getA(),
- (long) nestedField.getVarintList().get(0));
- }
-
- public void testSerialize() throws Exception {
- // Check that serializing the UnknownFieldSet produces the original data
- // again.
- ByteString data = emptyMessage.toByteString();
- assertEquals(allFieldsData, data);
- }
-
- public void testCopyFrom() throws Exception {
- TestEmptyMessage message =
- TestEmptyMessage.newBuilder().mergeFrom(emptyMessage).build();
-
- assertEquals(emptyMessage.toString(), message.toString());
- }
-
- public void testMergeFrom() throws Exception {
- TestEmptyMessage source =
- TestEmptyMessage.newBuilder()
- .setUnknownFields(
- UnknownFieldSet.newBuilder()
- .addField(2,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(2).build())
- .addField(3,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(4).build())
- .build())
- .build();
- TestEmptyMessage destination =
- TestEmptyMessage.newBuilder()
- .setUnknownFields(
- UnknownFieldSet.newBuilder()
- .addField(1,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(1).build())
- .addField(3,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(3).build())
- .build())
- .mergeFrom(source)
- .build();
-
- assertEquals(
- "1: 1\n" +
- "2: 2\n" +
- "3: 3\n" +
- "3: 4\n",
- destination.toString());
- }
-
- public void testClear() throws Exception {
- UnknownFieldSet fields =
- UnknownFieldSet.newBuilder().mergeFrom(unknownFields).clear().build();
- assertTrue(fields.asMap().isEmpty());
- }
-
- public void testClearMessage() throws Exception {
- TestEmptyMessage message =
- TestEmptyMessage.newBuilder().mergeFrom(emptyMessage).clear().build();
- assertEquals(0, message.getSerializedSize());
- }
-
- public void testParseKnownAndUnknown() throws Exception {
- // Test mixing known and unknown fields when parsing.
-
- UnknownFieldSet fields =
- UnknownFieldSet.newBuilder(unknownFields)
- .addField(123456,
- UnknownFieldSet.Field.newBuilder().addVarint(654321).build())
- .build();
-
- ByteString data = fields.toByteString();
- TestAllTypes destination = TestAllTypes.parseFrom(data);
-
- TestUtil.assertAllFieldsSet(destination);
- assertEquals(1, destination.getUnknownFields().asMap().size());
-
- UnknownFieldSet.Field field =
- destination.getUnknownFields().getField(123456);
- assertEquals(1, field.getVarintList().size());
- assertEquals(654321, (long) field.getVarintList().get(0));
- }
-
- public void testWrongTypeTreatedAsUnknown() throws Exception {
- // Test that fields of the wrong wire type are treated like unknown fields
- // when parsing.
-
- ByteString bizarroData = getBizarroData();
- TestAllTypes allTypesMessage = TestAllTypes.parseFrom(bizarroData);
- TestEmptyMessage emptyMessage = TestEmptyMessage.parseFrom(bizarroData);
-
- // All fields should have been interpreted as unknown, so the debug strings
- // should be the same.
- assertEquals(emptyMessage.toString(), allTypesMessage.toString());
- }
-
- public void testUnknownExtensions() throws Exception {
- // Make sure fields are properly parsed to the UnknownFieldSet even when
- // they are declared as extension numbers.
-
- TestEmptyMessageWithExtensions message =
- TestEmptyMessageWithExtensions.parseFrom(allFieldsData);
-
- assertEquals(unknownFields.asMap().size(),
- message.getUnknownFields().asMap().size());
- assertEquals(allFieldsData, message.toByteString());
- }
-
- public void testWrongExtensionTypeTreatedAsUnknown() throws Exception {
- // Test that fields of the wrong wire type are treated like unknown fields
- // when parsing extensions.
-
- ByteString bizarroData = getBizarroData();
- TestAllExtensions allExtensionsMessage =
- TestAllExtensions.parseFrom(bizarroData);
- TestEmptyMessage emptyMessage = TestEmptyMessage.parseFrom(bizarroData);
-
- // All fields should have been interpreted as unknown, so the debug strings
- // should be the same.
- assertEquals(emptyMessage.toString(),
- allExtensionsMessage.toString());
- }
-
- public void testParseUnknownEnumValue() throws Exception {
- Descriptors.FieldDescriptor singularField =
- TestAllTypes.getDescriptor().findFieldByName("optional_nested_enum");
- Descriptors.FieldDescriptor repeatedField =
- TestAllTypes.getDescriptor().findFieldByName("repeated_nested_enum");
- assertNotNull(singularField);
- assertNotNull(repeatedField);
-
- ByteString data =
- UnknownFieldSet.newBuilder()
- .addField(singularField.getNumber(),
- UnknownFieldSet.Field.newBuilder()
- .addVarint(TestAllTypes.NestedEnum.BAR.getNumber())
- .addVarint(5) // not valid
- .build())
- .addField(repeatedField.getNumber(),
- UnknownFieldSet.Field.newBuilder()
- .addVarint(TestAllTypes.NestedEnum.FOO.getNumber())
- .addVarint(4) // not valid
- .addVarint(TestAllTypes.NestedEnum.BAZ.getNumber())
- .addVarint(6) // not valid
- .build())
- .build()
- .toByteString();
-
- {
- TestAllTypes message = TestAllTypes.parseFrom(data);
- assertEquals(TestAllTypes.NestedEnum.BAR,
- message.getOptionalNestedEnum());
- assertEquals(
- Arrays.asList(TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAZ),
- message.getRepeatedNestedEnumList());
- assertEquals(Arrays.asList(5L),
- message.getUnknownFields()
- .getField(singularField.getNumber())
- .getVarintList());
- assertEquals(Arrays.asList(4L, 6L),
- message.getUnknownFields()
- .getField(repeatedField.getNumber())
- .getVarintList());
- }
-
- {
- TestAllExtensions message =
- TestAllExtensions.parseFrom(data, TestUtil.getExtensionRegistry());
- assertEquals(TestAllTypes.NestedEnum.BAR,
- message.getExtension(UnittestProto.optionalNestedEnumExtension));
- assertEquals(
- Arrays.asList(TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAZ),
- message.getExtension(UnittestProto.repeatedNestedEnumExtension));
- assertEquals(Arrays.asList(5L),
- message.getUnknownFields()
- .getField(singularField.getNumber())
- .getVarintList());
- assertEquals(Arrays.asList(4L, 6L),
- message.getUnknownFields()
- .getField(repeatedField.getNumber())
- .getVarintList());
- }
- }
-
- public void testLargeVarint() throws Exception {
- ByteString data =
- UnknownFieldSet.newBuilder()
- .addField(1,
- UnknownFieldSet.Field.newBuilder()
- .addVarint(0x7FFFFFFFFFFFFFFFL)
- .build())
- .build()
- .toByteString();
- UnknownFieldSet parsed = UnknownFieldSet.parseFrom(data);
- UnknownFieldSet.Field field = parsed.getField(1);
- assertEquals(1, field.getVarintList().size());
- assertEquals(0x7FFFFFFFFFFFFFFFL, (long)field.getVarintList().get(0));
- }
-
- public void testEqualsAndHashCode() {
- UnknownFieldSet.Field fixed32Field =
- UnknownFieldSet.Field.newBuilder()
- .addFixed32(1)
- .build();
- UnknownFieldSet.Field fixed64Field =
- UnknownFieldSet.Field.newBuilder()
- .addFixed64(1)
- .build();
- UnknownFieldSet.Field varIntField =
- UnknownFieldSet.Field.newBuilder()
- .addVarint(1)
- .build();
- UnknownFieldSet.Field lengthDelimitedField =
- UnknownFieldSet.Field.newBuilder()
- .addLengthDelimited(ByteString.EMPTY)
- .build();
- UnknownFieldSet.Field groupField =
- UnknownFieldSet.Field.newBuilder()
- .addGroup(unknownFields)
- .build();
-
- UnknownFieldSet a =
- UnknownFieldSet.newBuilder()
- .addField(1, fixed32Field)
- .build();
- UnknownFieldSet b =
- UnknownFieldSet.newBuilder()
- .addField(1, fixed64Field)
- .build();
- UnknownFieldSet c =
- UnknownFieldSet.newBuilder()
- .addField(1, varIntField)
- .build();
- UnknownFieldSet d =
- UnknownFieldSet.newBuilder()
- .addField(1, lengthDelimitedField)
- .build();
- UnknownFieldSet e =
- UnknownFieldSet.newBuilder()
- .addField(1, groupField)
- .build();
-
- checkEqualsIsConsistent(a);
- checkEqualsIsConsistent(b);
- checkEqualsIsConsistent(c);
- checkEqualsIsConsistent(d);
- checkEqualsIsConsistent(e);
-
- checkNotEqual(a, b);
- checkNotEqual(a, c);
- checkNotEqual(a, d);
- checkNotEqual(a, e);
- checkNotEqual(b, c);
- checkNotEqual(b, d);
- checkNotEqual(b, e);
- checkNotEqual(c, d);
- checkNotEqual(c, e);
- checkNotEqual(d, e);
- }
-
- /**
- * Asserts that the given field sets are not equal and have different
- * hash codes.
- *
- * @warning It's valid for non-equal objects to have the same hash code, so
- * this test is stricter than it needs to be. However, this should happen
- * relatively rarely.
- */
- private void checkNotEqual(UnknownFieldSet s1, UnknownFieldSet s2) {
- String equalsError = String.format("%s should not be equal to %s", s1, s2);
- assertFalse(equalsError, s1.equals(s2));
- assertFalse(equalsError, s2.equals(s1));
-
- assertFalse(
- String.format("%s should have a different hash code from %s", s1, s2),
- s1.hashCode() == s2.hashCode());
- }
-
- /**
- * Asserts that the given field sets are equal and have identical hash codes.
- */
- private void checkEqualsIsConsistent(UnknownFieldSet set) {
- // Object should be equal to itself.
- assertEquals(set, set);
-
- // Object should be equal to a copy of itself.
- UnknownFieldSet copy = UnknownFieldSet.newBuilder(set).build();
- assertEquals(set, copy);
- assertEquals(copy, set);
- assertEquals(set.hashCode(), copy.hashCode());
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java
deleted file mode 100644
index cb75d74..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/UnmodifiableLazyStringListTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import junit.framework.TestCase;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-
-/**
- * Tests for {@link UnmodifiableLazyStringList}.
- *
- * @author jonp@google.com (Jon Perlow)
- */
-public class UnmodifiableLazyStringListTest extends TestCase {
-
- private static String STRING_A = "A";
- private static String STRING_B = "B";
- private static String STRING_C = "C";
-
- private static ByteString BYTE_STRING_A = ByteString.copyFromUtf8("A");
- private static ByteString BYTE_STRING_B = ByteString.copyFromUtf8("B");
- private static ByteString BYTE_STRING_C = ByteString.copyFromUtf8("C");
-
- public void testReadOnlyMethods() {
- LazyStringArrayList rawList = createSampleList();
- UnmodifiableLazyStringList list = new UnmodifiableLazyStringList(rawList);
- assertEquals(3, list.size());
- assertSame(STRING_A, list.get(0));
- assertSame(STRING_B, list.get(1));
- assertSame(STRING_C, list.get(2));
- assertEquals(BYTE_STRING_A, list.getByteString(0));
- assertEquals(BYTE_STRING_B, list.getByteString(1));
- assertEquals(BYTE_STRING_C, list.getByteString(2));
- }
-
- public void testModifyMethods() {
- LazyStringArrayList rawList = createSampleList();
- UnmodifiableLazyStringList list = new UnmodifiableLazyStringList(rawList);
-
- try {
- list.remove(0);
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- assertEquals(3, list.size());
-
- try {
- list.add(STRING_B);
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- assertEquals(3, list.size());
-
- try {
- list.set(1, STRING_B);
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- }
-
- public void testIterator() {
- LazyStringArrayList rawList = createSampleList();
- UnmodifiableLazyStringList list = new UnmodifiableLazyStringList(rawList);
-
- Iterator<String> iter = list.iterator();
- int count = 0;
- while (iter.hasNext()) {
- iter.next();
- count++;
- try {
- iter.remove();
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- }
- assertEquals(3, count);
-
- }
-
- public void testListIterator() {
- LazyStringArrayList rawList = createSampleList();
- UnmodifiableLazyStringList list = new UnmodifiableLazyStringList(rawList);
-
- ListIterator<String> iter = list.listIterator();
- int count = 0;
- while (iter.hasNext()) {
- iter.next();
- count++;
- try {
- iter.remove();
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- try {
- iter.set("bar");
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- try {
- iter.add("bar");
- fail();
- } catch (UnsupportedOperationException e) {
- // expected
- }
- }
- assertEquals(3, count);
-
- }
-
- private LazyStringArrayList createSampleList() {
- LazyStringArrayList rawList = new LazyStringArrayList();
- rawList.add(STRING_A);
- rawList.add(STRING_B);
- rawList.add(STRING_C);
- return rawList;
- }
-}
diff --git a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java b/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java
deleted file mode 100644
index 7452872..0000000
--- a/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/WireFormatTest.java
+++ /dev/null
@@ -1,465 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package com.google.protobuf.test;
-import com.google.protobuf.*;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.List;
-
-import protobuf_unittest.UnittestProto;
-import protobuf_unittest.UnittestProto.TestAllExtensions;
-import protobuf_unittest.UnittestProto.TestAllTypes;
-import protobuf_unittest.UnittestProto.TestFieldOrderings;
-import protobuf_unittest.UnittestProto.TestPackedExtensions;
-import protobuf_unittest.UnittestProto.TestPackedTypes;
-import protobuf_unittest.UnittestMset.TestMessageSet;
-import protobuf_unittest.UnittestMset.RawMessageSet;
-import protobuf_unittest.UnittestMset.TestMessageSetExtension1;
-import protobuf_unittest.UnittestMset.TestMessageSetExtension2;
-
-/**
- * Tests related to parsing and serialization.
- *
- * @author kenton@google.com (Kenton Varda)
- */
-public class WireFormatTest extends TestCase {
- public void testSerialization() throws Exception {
- TestAllTypes message = TestUtil.getAllSet();
-
- ByteString rawBytes = message.toByteString();
- assertEquals(rawBytes.size(), message.getSerializedSize());
-
- TestAllTypes message2 = TestAllTypes.parseFrom(rawBytes);
-
- TestUtil.assertAllFieldsSet(message2);
- }
-
- public void testSerializationPacked() throws Exception {
- TestPackedTypes message = TestUtil.getPackedSet();
-
- ByteString rawBytes = message.toByteString();
- assertEquals(rawBytes.size(), message.getSerializedSize());
-
- TestPackedTypes message2 = TestPackedTypes.parseFrom(rawBytes);
-
- TestUtil.assertPackedFieldsSet(message2);
- }
-
- public void testSerializeExtensions() throws Exception {
- // TestAllTypes and TestAllExtensions should have compatible wire formats,
- // so if we serialize a TestAllExtensions then parse it as TestAllTypes
- // it should work.
-
- TestAllExtensions message = TestUtil.getAllExtensionsSet();
- ByteString rawBytes = message.toByteString();
- assertEquals(rawBytes.size(), message.getSerializedSize());
-
- TestAllTypes message2 = TestAllTypes.parseFrom(rawBytes);
-
- TestUtil.assertAllFieldsSet(message2);
- }
-
- public void testSerializePackedExtensions() throws Exception {
- // TestPackedTypes and TestPackedExtensions should have compatible wire
- // formats; check that they serialize to the same string.
- TestPackedExtensions message = TestUtil.getPackedExtensionsSet();
- ByteString rawBytes = message.toByteString();
-
- TestPackedTypes message2 = TestUtil.getPackedSet();
- ByteString rawBytes2 = message2.toByteString();
-
- assertEquals(rawBytes, rawBytes2);
- }
-
- public void testSerializationPackedWithoutGetSerializedSize()
- throws Exception {
- // Write directly to an OutputStream, without invoking getSerializedSize()
- // This used to be a bug where the size of a packed field was incorrect,
- // since getSerializedSize() was never invoked.
- TestPackedTypes message = TestUtil.getPackedSet();
-
- // Directly construct a CodedOutputStream around the actual OutputStream,
- // in case writeTo(OutputStream output) invokes getSerializedSize();
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- CodedOutputStream codedOutput = CodedOutputStream.newInstance(outputStream);
-
- message.writeTo(codedOutput);
-
- codedOutput.flush();
-
- TestPackedTypes message2 = TestPackedTypes.parseFrom(
- outputStream.toByteArray());
-
- TestUtil.assertPackedFieldsSet(message2);
- }
-
- public void testParseExtensions() throws Exception {
- // TestAllTypes and TestAllExtensions should have compatible wire formats,
- // so if we serialize a TestAllTypes then parse it as TestAllExtensions
- // it should work.
-
- TestAllTypes message = TestUtil.getAllSet();
- ByteString rawBytes = message.toByteString();
-
- ExtensionRegistry registry = TestUtil.getExtensionRegistry();
-
- TestAllExtensions message2 =
- TestAllExtensions.parseFrom(rawBytes, registry);
-
- TestUtil.assertAllExtensionsSet(message2);
- }
-
- public void testParsePackedExtensions() throws Exception {
- // Ensure that packed extensions can be properly parsed.
- TestPackedExtensions message = TestUtil.getPackedExtensionsSet();
- ByteString rawBytes = message.toByteString();
-
- ExtensionRegistry registry = TestUtil.getExtensionRegistry();
-
- TestPackedExtensions message2 =
- TestPackedExtensions.parseFrom(rawBytes, registry);
-
- TestUtil.assertPackedExtensionsSet(message2);
- }
-
- public void testExtensionsSerializedSize() throws Exception {
- assertEquals(TestUtil.getAllSet().getSerializedSize(),
- TestUtil.getAllExtensionsSet().getSerializedSize());
- }
-
- public void testSerializeDelimited() throws Exception {
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- TestUtil.getAllSet().writeDelimitedTo(output);
- output.write(12);
- TestUtil.getPackedSet().writeDelimitedTo(output);
- output.write(34);
-
- ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
-
- TestUtil.assertAllFieldsSet(TestAllTypes.parseDelimitedFrom(input));
- assertEquals(12, input.read());
- TestUtil.assertPackedFieldsSet(TestPackedTypes.parseDelimitedFrom(input));
- assertEquals(34, input.read());
- assertEquals(-1, input.read());
-
- // We're at EOF, so parsing again should return null.
- assertTrue(TestAllTypes.parseDelimitedFrom(input) == null);
- }
-
- private void assertFieldsInOrder(ByteString data) throws Exception {
- CodedInputStream input = data.newCodedInput();
- int previousTag = 0;
-
- while (true) {
- int tag = input.readTag();
- if (tag == 0) {
- break;
- }
-
- assertTrue(tag > previousTag);
- previousTag = tag;
- input.skipField(tag);
- }
- }
-
- public void testInterleavedFieldsAndExtensions() throws Exception {
- // Tests that fields are written in order even when extension ranges
- // are interleaved with field numbers.
- ByteString data =
- TestFieldOrderings.newBuilder()
- .setMyInt(1)
- .setMyString("foo")
- .setMyFloat(1.0F)
- .setExtension(UnittestProto.myExtensionInt, 23)
- .setExtension(UnittestProto.myExtensionString, "bar")
- .build().toByteString();
- assertFieldsInOrder(data);
-
- Descriptors.Descriptor descriptor = TestFieldOrderings.getDescriptor();
- ByteString dynamic_data =
- DynamicMessage.newBuilder(TestFieldOrderings.getDescriptor())
- .setField(descriptor.findFieldByName("my_int"), 1L)
- .setField(descriptor.findFieldByName("my_string"), "foo")
- .setField(descriptor.findFieldByName("my_float"), 1.0F)
- .setField(UnittestProto.myExtensionInt.getDescriptor(), 23)
- .setField(UnittestProto.myExtensionString.getDescriptor(), "bar")
- .build().toByteString();
- assertFieldsInOrder(dynamic_data);
- }
-
- private ExtensionRegistry getTestFieldOrderingsRegistry() {
- ExtensionRegistry result = ExtensionRegistry.newInstance();
- result.add(UnittestProto.myExtensionInt);
- result.add(UnittestProto.myExtensionString);
- return result;
- }
-
- public void testParseMultipleExtensionRanges() throws Exception {
- // Make sure we can parse a message that contains multiple extensions
- // ranges.
- TestFieldOrderings source =
- TestFieldOrderings.newBuilder()
- .setMyInt(1)
- .setMyString("foo")
- .setMyFloat(1.0F)
- .setExtension(UnittestProto.myExtensionInt, 23)
- .setExtension(UnittestProto.myExtensionString, "bar")
- .build();
- TestFieldOrderings dest =
- TestFieldOrderings.parseFrom(source.toByteString(),
- getTestFieldOrderingsRegistry());
- assertEquals(source, dest);
- }
-
- public void testParseMultipleExtensionRangesDynamic() throws Exception {
- // Same as above except with DynamicMessage.
- Descriptors.Descriptor descriptor = TestFieldOrderings.getDescriptor();
- DynamicMessage source =
- DynamicMessage.newBuilder(TestFieldOrderings.getDescriptor())
- .setField(descriptor.findFieldByName("my_int"), 1L)
- .setField(descriptor.findFieldByName("my_string"), "foo")
- .setField(descriptor.findFieldByName("my_float"), 1.0F)
- .setField(UnittestProto.myExtensionInt.getDescriptor(), 23)
- .setField(UnittestProto.myExtensionString.getDescriptor(), "bar")
- .build();
- DynamicMessage dest =
- DynamicMessage.parseFrom(descriptor, source.toByteString(),
- getTestFieldOrderingsRegistry());
- assertEquals(source, dest);
- }
-
- private static final int UNKNOWN_TYPE_ID = 1550055;
- private static final int TYPE_ID_1 =
- TestMessageSetExtension1.getDescriptor().getExtensions().get(0).getNumber();
- private static final int TYPE_ID_2 =
- TestMessageSetExtension2.getDescriptor().getExtensions().get(0).getNumber();
-
- public void testSerializeMessageSetEagerly() throws Exception {
- testSerializeMessageSetWithFlag(true);
- }
-
- public void testSerializeMessageSetNotEagerly() throws Exception {
- testSerializeMessageSetWithFlag(false);
- }
-
- private void testSerializeMessageSetWithFlag(boolean eagerParsing)
- throws Exception {
- ExtensionRegistryLite.setEagerlyParseMessageSets(eagerParsing);
- // Set up a TestMessageSet with two known messages and an unknown one.
- TestMessageSet messageSet =
- TestMessageSet.newBuilder()
- .setExtension(
- TestMessageSetExtension1.messageSetExtension,
- TestMessageSetExtension1.newBuilder().setI(123).build())
- .setExtension(
- TestMessageSetExtension2.messageSetExtension,
- TestMessageSetExtension2.newBuilder().setStr("foo").build())
- .setUnknownFields(
- UnknownFieldSet.newBuilder()
- .addField(UNKNOWN_TYPE_ID,
- UnknownFieldSet.Field.newBuilder()
- .addLengthDelimited(ByteString.copyFromUtf8("bar"))
- .build())
- .build())
- .build();
-
- ByteString data = messageSet.toByteString();
-
- // Parse back using RawMessageSet and check the contents.
- RawMessageSet raw = RawMessageSet.parseFrom(data);
-
- assertTrue(raw.getUnknownFields().asMap().isEmpty());
-
- assertEquals(3, raw.getItemCount());
- assertEquals(TYPE_ID_1, raw.getItem(0).getTypeId());
- assertEquals(TYPE_ID_2, raw.getItem(1).getTypeId());
- assertEquals(UNKNOWN_TYPE_ID, raw.getItem(2).getTypeId());
-
- TestMessageSetExtension1 message1 =
- TestMessageSetExtension1.parseFrom(
- raw.getItem(0).getMessage().toByteArray());
- assertEquals(123, message1.getI());
-
- TestMessageSetExtension2 message2 =
- TestMessageSetExtension2.parseFrom(
- raw.getItem(1).getMessage().toByteArray());
- assertEquals("foo", message2.getStr());
-
- assertEquals("bar", raw.getItem(2).getMessage().toStringUtf8());
- }
-
- public void testParseMessageSetEagerly() throws Exception {
- testParseMessageSetWithFlag(true);
- }
-
- public void testParseMessageSetNotEagerly()throws Exception {
- testParseMessageSetWithFlag(false);
- }
-
- private void testParseMessageSetWithFlag(boolean eagerParsing)
- throws Exception {
- ExtensionRegistryLite.setEagerlyParseMessageSets(eagerParsing);
- ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
- extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
- extensionRegistry.add(TestMessageSetExtension2.messageSetExtension);
-
- // Set up a RawMessageSet with two known messages and an unknown one.
- RawMessageSet raw =
- RawMessageSet.newBuilder()
- .addItem(
- RawMessageSet.Item.newBuilder()
- .setTypeId(TYPE_ID_1)
- .setMessage(
- TestMessageSetExtension1.newBuilder()
- .setI(123)
- .build().toByteString())
- .build())
- .addItem(
- RawMessageSet.Item.newBuilder()
- .setTypeId(TYPE_ID_2)
- .setMessage(
- TestMessageSetExtension2.newBuilder()
- .setStr("foo")
- .build().toByteString())
- .build())
- .addItem(
- RawMessageSet.Item.newBuilder()
- .setTypeId(UNKNOWN_TYPE_ID)
- .setMessage(ByteString.copyFromUtf8("bar"))
- .build())
- .build();
-
- ByteString data = raw.toByteString();
-
- // Parse as a TestMessageSet and check the contents.
- TestMessageSet messageSet =
- TestMessageSet.parseFrom(data, extensionRegistry);
-
- assertEquals(123, messageSet.getExtension(
- TestMessageSetExtension1.messageSetExtension).getI());
- assertEquals("foo", messageSet.getExtension(
- TestMessageSetExtension2.messageSetExtension).getStr());
-
- // Check for unknown field with type LENGTH_DELIMITED,
- // number UNKNOWN_TYPE_ID, and contents "bar".
- UnknownFieldSet unknownFields = messageSet.getUnknownFields();
- assertEquals(1, unknownFields.asMap().size());
- assertTrue(unknownFields.hasField(UNKNOWN_TYPE_ID));
-
- UnknownFieldSet.Field field = unknownFields.getField(UNKNOWN_TYPE_ID);
- assertEquals(1, field.getLengthDelimitedList().size());
- assertEquals("bar", field.getLengthDelimitedList().get(0).toStringUtf8());
- }
-
- public void testParseMessageSetExtensionEagerly() throws Exception {
- testParseMessageSetExtensionWithFlag(true);
- }
-
- public void testParseMessageSetExtensionNotEagerly() throws Exception {
- testParseMessageSetExtensionWithFlag(false);
- }
-
- private void testParseMessageSetExtensionWithFlag(boolean eagerParsing)
- throws Exception {
- ExtensionRegistryLite.setEagerlyParseMessageSets(eagerParsing);
- ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
- extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
-
- // Set up a RawMessageSet with a known messages.
- int TYPE_ID_1 =
- TestMessageSetExtension1
- .getDescriptor().getExtensions().get(0).getNumber();
- RawMessageSet raw =
- RawMessageSet.newBuilder()
- .addItem(
- RawMessageSet.Item.newBuilder()
- .setTypeId(TYPE_ID_1)
- .setMessage(
- TestMessageSetExtension1.newBuilder()
- .setI(123)
- .build().toByteString())
- .build())
- .build();
-
- ByteString data = raw.toByteString();
-
- // Parse as a TestMessageSet and check the contents.
- TestMessageSet messageSet =
- TestMessageSet.parseFrom(data, extensionRegistry);
- assertEquals(123, messageSet.getExtension(
- TestMessageSetExtension1.messageSetExtension).getI());
- }
-
- public void testMergeLazyMessageSetExtensionEagerly() throws Exception {
- testMergeLazyMessageSetExtensionWithFlag(true);
- }
-
- public void testMergeLazyMessageSetExtensionNotEagerly() throws Exception {
- testMergeLazyMessageSetExtensionWithFlag(false);
- }
-
- private void testMergeLazyMessageSetExtensionWithFlag(boolean eagerParsing)
- throws Exception {
- ExtensionRegistryLite.setEagerlyParseMessageSets(eagerParsing);
- ExtensionRegistry extensionRegistry = ExtensionRegistry.newInstance();
- extensionRegistry.add(TestMessageSetExtension1.messageSetExtension);
-
- // Set up a RawMessageSet with a known messages.
- int TYPE_ID_1 =
- TestMessageSetExtension1
- .getDescriptor().getExtensions().get(0).getNumber();
- RawMessageSet raw =
- RawMessageSet.newBuilder()
- .addItem(
- RawMessageSet.Item.newBuilder()
- .setTypeId(TYPE_ID_1)
- .setMessage(
- TestMessageSetExtension1.newBuilder()
- .setI(123)
- .build().toByteString())
- .build())
- .build();
-
- ByteString data = raw.toByteString();
-
- // Parse as a TestMessageSet and store value into lazy field
- TestMessageSet messageSet =
- TestMessageSet.parseFrom(data, extensionRegistry);
- // Merge lazy field check the contents.
- messageSet =
- messageSet.toBuilder().mergeFrom(data, extensionRegistry).build();
- assertEquals(123, messageSet.getExtension(
- TestMessageSetExtension1.messageSetExtension).getI());
- }
-}
diff --git a/java/core/BUILD b/java/core/BUILD
index fa074c0..4d8895a 100644
--- a/java/core/BUILD
+++ b/java/core/BUILD
@@ -1,5 +1,8 @@
-load("@rules_java//java:defs.bzl", "java_library")
-load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
+load("@bazel_skylib//rules:build_test.bzl", "build_test")
+load("@rules_java//java:defs.bzl", "java_library", "java_proto_library", "java_lite_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
+load("//:internal.bzl", "conformance_test")
+load("//java/internal:testing.bzl", "junit_tests")
LITE_SRCS = [
# Keep in sync with `//java/lite:pom.xml`.
@@ -95,13 +98,20 @@
# Should be used as `//java/lite`.
java_library(
name = "lite",
- srcs = LITE_SRCS,
+ srcs = LITE_SRCS + [
+ "//:gen_well_known_protos_javalite"
+ ],
visibility = [
"//java/lite:__pkg__",
],
)
java_library(
+ name = "lite_runtime_only",
+ srcs = LITE_SRCS,
+)
+
+java_library(
name = "core",
srcs = glob(
[
@@ -113,10 +123,10 @@
],
visibility = ["//visibility:public"],
exports = [
- "//java/lite",
+ ":lite_runtime_only",
],
deps = [
- "//java/lite",
+ ":lite_runtime_only",
],
)
@@ -126,3 +136,191 @@
runtime = ":core",
visibility = ["//visibility:public"],
)
+
+proto_library(
+ name = "java_test_protos",
+ srcs = glob(["src/test/proto/**/*.proto"]),
+ strip_import_prefix = "src/test/proto",
+ deps = [
+ "//:any_proto",
+ "//:descriptor_proto",
+ "//:generic_test_protos",
+ "//:wrappers_proto",
+ ],
+)
+
+java_proto_library(
+ name = "generic_test_protos_java_proto",
+ visibility = [
+ "//java:__subpackages__",
+ ],
+ deps = ["//:generic_test_protos"],
+)
+
+java_proto_library(
+ name = "java_test_protos_java_proto",
+ deps = [":java_test_protos"],
+)
+
+java_library(
+ name = "test_util",
+ srcs = [
+ "src/test/java/com/google/protobuf/TestUtil.java",
+ "src/test/java/com/google/protobuf/TestUtilLite.java"
+ ],
+ deps = [
+ ":core",
+ ":generic_test_protos_java_proto",
+ ":java_test_protos_java_proto",
+ "//external:guava",
+ "//external:junit",
+ ],
+)
+
+test_suite(
+ name = "tests",
+ tests = [
+ "core_build_test",
+ "conformance_test",
+ "core_tests",
+ ],
+)
+
+build_test(
+ name = "core_build_test",
+ targets = [
+ ":core",
+ ],
+)
+
+conformance_test(
+ name = "conformance_test",
+ testee = "//:conformance_java",
+ failure_list = "//:conformance/failure_list_java.txt",
+ text_format_failure_list = "//:conformance/text_format_failure_list_java.txt",
+)
+
+junit_tests(
+ name = "core_tests",
+ srcs = glob(["src/test/java/**/*.java"], exclude = [
+ "src/test/java/com/google/protobuf/TestUtil.java",
+ "src/test/java/com/google/protobuf/TestUtilLite.java",
+ ]),
+ data = ["//:testdata"],
+ size = "large",
+ deps = [
+ ":core",
+ ":generic_test_protos_java_proto",
+ ":java_test_protos_java_proto",
+ ":test_util",
+ "//external:easymock",
+ "//external:easymock_classextension",
+ "//external:junit",
+ "//external:truth",
+ ]
+)
+
+java_lite_proto_library(
+ name = "generic_test_protos_java_proto_lite",
+ visibility = [
+ "//java/lite:__pkg__",
+ ],
+ deps = ["//:generic_test_protos"],
+)
+
+java_lite_proto_library(
+ name = "java_test_protos_java_proto_lite",
+ visibility = [
+ "//java/lite:__pkg__",
+ ],
+ deps = [":java_test_protos"],
+)
+
+genrule(
+ name = "rewrite_javalite_test_util",
+ srcs = [
+ "//java/lite:lite.awk",
+ "src/test/java/com/google/protobuf/TestUtil.java"
+ ],
+ outs = ["TestUtil.java"],
+ cmd = "awk -f $(location //java/lite:lite.awk) $(location src/test/java/com/google/protobuf/TestUtil.java) > $@"
+)
+
+java_library(
+ name = "test_util_lite",
+ srcs = [
+ ":rewrite_javalite_test_util",
+ "src/test/java/com/google/protobuf/TestUtilLite.java"
+ ],
+ visibility = [
+ "//java/lite:__pkg__",
+ ],
+ deps = [
+ ":generic_test_protos_java_proto_lite",
+ ":java_test_protos_java_proto_lite",
+ ":lite_runtime_only",
+ "//external:guava",
+ "//external:junit",
+ ],
+)
+
+LITE_TEST_EXCLUSIONS = [
+ # Keep in sync with //java/lite:pom.xml id=copy-test-source-files execution.
+ "src/test/java/com/google/protobuf/AbstractMessageTest.java",
+ "src/test/java/com/google/protobuf/AbstractProto2SchemaTest.java",
+ "src/test/java/com/google/protobuf/AnyTest.java",
+ "src/test/java/com/google/protobuf/CodedInputStreamTest.java",
+ "src/test/java/com/google/protobuf/DeprecatedFieldTest.java",
+ "src/test/java/com/google/protobuf/DescriptorsTest.java",
+ "src/test/java/com/google/protobuf/DiscardUnknownFieldsTest.java",
+ "src/test/java/com/google/protobuf/DynamicMessageTest.java",
+ "src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java",
+ "src/test/java/com/google/protobuf/FieldPresenceTest.java",
+ "src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java",
+ "src/test/java/com/google/protobuf/GeneratedMessageTest.java",
+ "src/test/java/com/google/protobuf/LazyFieldTest.java",
+ "src/test/java/com/google/protobuf/LazyStringEndToEndTest.java",
+ "src/test/java/com/google/protobuf/MapForProto2Test.java",
+ "src/test/java/com/google/protobuf/MapTest.java",
+ "src/test/java/com/google/protobuf/MessageTest.java",
+ "src/test/java/com/google/protobuf/NestedBuildersTest.java",
+ "src/test/java/com/google/protobuf/PackedFieldTest.java",
+ "src/test/java/com/google/protobuf/ParserTest.java",
+ "src/test/java/com/google/protobuf/ParseExceptionsTest.java",
+ "src/test/java/com/google/protobuf/Proto2ExtensionLookupSchemaTest.java",
+ "src/test/java/com/google/protobuf/Proto2SchemaTest.java",
+ "src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java",
+ "src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java",
+ "src/test/java/com/google/protobuf/ServiceTest.java",
+ "src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java",
+ "src/test/java/com/google/protobuf/TestBadIdentifiers.java",
+ "src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java",
+ "src/test/java/com/google/protobuf/TextFormatParseLocationTest.java",
+ "src/test/java/com/google/protobuf/TextFormatTest.java",
+ "src/test/java/com/google/protobuf/TestUtil.java",
+ "src/test/java/com/google/protobuf/TestUtilLite.java",
+ "src/test/java/com/google/protobuf/TypeRegistryTest.java",
+ "src/test/java/com/google/protobuf/UnknownEnumValueTest.java",
+ "src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java",
+ "src/test/java/com/google/protobuf/UnknownFieldSetTest.java",
+ "src/test/java/com/google/protobuf/WellKnownTypesTest.java",
+ "src/test/java/com/google/protobuf/WireFormatTest.java",
+]
+
+junit_tests(
+ name = "lite_tests",
+ srcs = glob(["src/test/java/**/*.java"], exclude = LITE_TEST_EXCLUSIONS),
+ data = ["//:testdata"],
+ test_prefix = "Lite",
+ size = "large",
+ deps = [
+ ":lite",
+ ":generic_test_protos_java_proto_lite",
+ ":java_test_protos_java_proto_lite",
+ ":test_util_lite",
+ "//external:easymock",
+ "//external:easymock_classextension",
+ "//external:junit",
+ "//external:truth",
+ ]
+)
diff --git a/java/core/src/main/java/com/google/protobuf/Descriptors.java b/java/core/src/main/java/com/google/protobuf/Descriptors.java
index 51597fa..e56a18e 100644
--- a/java/core/src/main/java/com/google/protobuf/Descriptors.java
+++ b/java/core/src/main/java/com/google/protobuf/Descriptors.java
@@ -724,12 +724,12 @@
/** Determines if the given field number is an extension. */
public boolean isExtensionNumber(final int number) {
- for (final DescriptorProto.ExtensionRange range : proto.getExtensionRangeList()) {
- if (range.getStart() <= number && number < range.getEnd()) {
- return true;
- }
+ int index = Arrays.binarySearch(extensionRangeLowerBounds, number);
+ if (index < 0) {
+ index = ~index - 1;
}
- return false;
+ // extensionRangeLowerBounds[index] is the biggest value <= number
+ return index >= 0 && number < extensionRangeUpperBounds[index];
}
/** Determines if the given field number is reserved. */
@@ -831,6 +831,9 @@
private final OneofDescriptor[] oneofs;
private final int realOneofCount;
+ private final int[] extensionRangeLowerBounds;
+ private final int[] extensionRangeUpperBounds;
+
// Used to create a placeholder when the type cannot be found.
Descriptor(final String fullname) throws DescriptorValidationException {
String name = fullname;
@@ -859,6 +862,9 @@
// Create a placeholder FileDescriptor to hold this message.
this.file = new FileDescriptor(packageName, this);
+
+ extensionRangeLowerBounds = new int[] {1};
+ extensionRangeUpperBounds = new int[] {536870912};
}
private Descriptor(
@@ -922,6 +928,20 @@
this.realOneofCount = this.oneofs.length - syntheticOneofCount;
file.pool.addSymbol(this);
+
+ // NOTE: The defined extension ranges are guaranteed to be disjoint.
+ extensionRangeLowerBounds = new int[proto.getExtensionRangeCount()];
+ extensionRangeUpperBounds = new int[proto.getExtensionRangeCount()];
+ int i = 0;
+ for (final DescriptorProto.ExtensionRange range : proto.getExtensionRangeList()) {
+ extensionRangeLowerBounds[i] = range.getStart();
+ extensionRangeUpperBounds[i] = range.getEnd();
+ i++;
+ }
+ // Since the ranges are disjoint, sorting these independently must still produce the correct
+ // order.
+ Arrays.sort(extensionRangeLowerBounds);
+ Arrays.sort(extensionRangeUpperBounds);
}
/** Look up and cross-link all field types, etc. */
diff --git a/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java b/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
index 74d42c6..b98b332 100644
--- a/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
+++ b/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
@@ -804,4 +804,8 @@
.build();
assertEquals(8, msg.getExtension(NestedExtension.MyNestedExtension.default_).intValue());
}
+
+ public void testDefaultDescriptorExtensionRange() throws Exception {
+ assertTrue(new Descriptor("default").isExtensionNumber(1));
+ }
}
diff --git a/java/internal/BUILD b/java/internal/BUILD
new file mode 100644
index 0000000..4f542ec
--- /dev/null
+++ b/java/internal/BUILD
@@ -0,0 +1 @@
+package(default_visibility = ["//java:__subpackages__"])
\ No newline at end of file
diff --git a/java/internal/testing.bzl b/java/internal/testing.bzl
new file mode 100644
index 0000000..76e1e45
--- /dev/null
+++ b/java/internal/testing.bzl
@@ -0,0 +1,72 @@
+"""
+Generates a side-car JUnit suite test runner class for each
+input src.
+"""
+_template = """import org.junit.runners.Suite;
+import org.junit.runner.RunWith;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({%s})
+public class %s {}
+"""
+
+def _as_classname(fname, pkg):
+ path_name = [x.path for x in fname.files.to_list()][0]
+ file_name = path_name.split("/")[-1]
+ return ".".join([pkg, file_name.split(".")[0]]) + ".class"
+
+def _gen_suite_impl(ctx):
+ classes = ",".join(
+ [_as_classname(x, ctx.attr.package_name) for x in ctx.attr.srcs],
+ )
+ ctx.actions.write(output = ctx.outputs.out, content = _template % (
+ classes,
+ ctx.attr.outname,
+ ))
+
+_gen_suite = rule(
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ "package_name": attr.string(),
+ "outname": attr.string(),
+ },
+ outputs = {"out": "%{name}.java"},
+ implementation = _gen_suite_impl,
+)
+
+def junit_tests(name, srcs, data = [], deps = [], package_name = "com.google.protobuf", test_prefix = None, **kwargs):
+ testlib_name = "%s_lib" % name
+ native.java_library(
+ name = testlib_name,
+ srcs = srcs,
+ deps = deps,
+ resources = data,
+ data = data,
+ )
+ test_names = []
+ prefix = name.replace("-", "_") + "TestSuite"
+ for src in srcs:
+ test_name = src.rsplit("/", 1)[1].split(".")[0]
+ if not test_name.endswith("Test") or test_name.startswith("Abstract"):
+ continue
+ if test_prefix:
+ test_name = "%s%s" % (test_prefix, test_name)
+ test_names = test_names + [test_name]
+ suite_name = prefix + '_' + test_name
+ _gen_suite(
+ name = suite_name,
+ srcs = [src],
+ package_name = package_name,
+ outname = suite_name,
+ )
+ native.java_test(
+ name = test_name,
+ test_class = suite_name,
+ srcs = [src] + [":" + suite_name],
+ deps = deps + [":%s" % testlib_name],
+ **kwargs
+ )
+ native.test_suite(
+ name = name,
+ tests = test_names,
+ )
diff --git a/java/kotlin-lite/generate-sources-build.xml b/java/kotlin-lite/generate-sources-build.xml
new file mode 100644
index 0000000..ab9cfea
--- /dev/null
+++ b/java/kotlin-lite/generate-sources-build.xml
@@ -0,0 +1,19 @@
+<project name="generate-sources">
+ <echo message="Running protoc ..."/>
+ <mkdir dir="${generated.sources.dir}"/>
+ <exec executable="${protoc}">
+ <arg value="--kotlin_out=lite:${generated.sources.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/source_context.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/struct.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/timestamp.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/type.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/wrappers.proto"/>
+ </exec>
+</project>
+
diff --git a/java/kotlin-lite/generate-test-sources-build.xml b/java/kotlin-lite/generate-test-sources-build.xml
new file mode 100644
index 0000000..c5f60b8
--- /dev/null
+++ b/java/kotlin-lite/generate-test-sources-build.xml
@@ -0,0 +1,34 @@
+<project name="generate-test-sources">
+ <mkdir dir="${generated.testsources.dir}"/>
+ <exec executable="${protoc}">
+ <arg value="--java_out=lite:${generated.testsources.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="--proto_path=${protobuf.basedir}/java/kotlin/${test.proto.dir}"/>
+ <arg value="--experimental_allow_proto3_optional"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto2.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto3.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/example_extensible_message.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/multiple_files_proto3.proto"/>
+ </exec>
+ <exec executable="${protoc}">
+ <arg value="--kotlin_out=lite:${generated.testsources.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="--proto_path=${protobuf.basedir}/java/kotlin/${test.proto.dir}"/>
+ <arg value="--experimental_allow_proto3_optional"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto2.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/evil_names_proto3.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/example_extensible_message.proto"/>
+ <arg value="${protobuf.basedir}/java/kotlin/${test.proto.dir}/com/google/protobuf/multiple_files_proto3.proto"/>
+ </exec>
+</project>
diff --git a/java/kotlin-lite/lite.awk b/java/kotlin-lite/lite.awk
new file mode 100644
index 0000000..b22d965
--- /dev/null
+++ b/java/kotlin-lite/lite.awk
@@ -0,0 +1,25 @@
+# Remove code enclosed by "BEGIN FULL-RUNTIME" and "END FULL-RUNTIME" to
+# create the lite-only version of a test file.
+
+BEGIN {
+ in_full_runtime = 0;
+}
+
+/BEGIN FULL-RUNTIME/ {
+ in_full_runtime = 1;
+ next;
+}
+
+/END FULL-RUNTIME/ {
+ in_full_runtime = 0;
+ next;
+}
+
+in_full_runtime {
+ # Skip full runtime code path.
+ next;
+}
+
+{
+ print;
+}
diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml
new file mode 100644
index 0000000..80b4c4f
--- /dev/null
+++ b/java/kotlin-lite/pom.xml
@@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-parent</artifactId>
+ <version>3.15.6</version>
+ </parent>
+
+ <artifactId>protobuf-kotlin-lite</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Protocol Buffers [Lite]</name>
+ <description>
+ Lite version of Protocol Buffers library. This version is optimized for code size, but does
+ not guarantee API/ABI stability.
+ </description>
+
+ <properties>
+ <kotlin.version>1.4.31</kotlin.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>protobuf-javalite</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava-testlib</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.truth</groupId>
+ <artifactId>truth</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <!-- Include core protos in the bundle as resources -->
+ <resources>
+ <resource>
+ <directory>${protobuf.source.dir}</directory>
+ <includes>
+ <include>google/protobuf/any.proto</include>
+ <include>google/protobuf/api.proto</include>
+ <include>google/protobuf/duration.proto</include>
+ <include>google/protobuf/empty.proto</include>
+ <include>google/protobuf/field_mask.proto</include>
+ <include>google/protobuf/source_context.proto</include>
+ <include>google/protobuf/struct.proto</include>
+ <include>google/protobuf/timestamp.proto</include>
+ <include>google/protobuf/type.proto</include>
+ <include>google/protobuf/wrappers.proto</include>
+ </includes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>${protobuf.source.dir}</directory>
+ <includes>
+ <include>google/protobuf/testdata/golden_message_oneof_implemented</include>
+ <include>google/protobuf/testdata/golden_packed_fields_message</include>
+ </includes>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>copy-kotlin-source-files</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${generated.sources.dir}/com/google/protobuf</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/../kotlin/src/main/kotlin/com/google/protobuf</directory>
+ <includes>
+ <include>DslList.kt</include>
+ <include>DslMap.kt</include>
+ <include>DslProxy.kt</include>
+ <include>ExtendableMessageLiteExtensions.kt</include>
+ <include>ExtensionList.kt</include>
+ <include>OnlyForUseByGeneratedProtoCode.kt</include>
+ <include>ProtoDslMarker.kt</include>
+ <include>UnmodifiableCollections.kt</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-test-source-files</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${generated.testsources.dir}/com/google/protobuf</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/../core/src/test/java/com/google/protobuf</directory>
+ <includes>
+ <include>TestUtilLite.java</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>${basedir}/../kotlin/src/test/kotlin/com/google/protobuf</directory>
+ <excludes>
+ <exclude>ExtendableMessageExtensionsTest.kt</exclude>
+ <exclude>Proto2Test.kt</exclude>
+ <exclude>ProtoUtil.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Use Antrun plugin to generate sources with protoc -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!-- Generate core protos -->
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="generate-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <!-- Generate the test protos -->
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="generate-test-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>process-lite-sources</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="process-lite-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-generated-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${generated.sources.dir}</source>
+ </sources>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>add-generated-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${generated.testsources.dir}</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-maven-plugin</artifactId>
+ <version>${kotlin.version}</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <goals> <goal>compile</goal> </goals>
+ <configuration>
+ <sourceDirs>
+ <sourceDir>${generated.sources.dir}</sourceDir>
+ <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
+ </sourceDirs>
+ </configuration>
+ </execution>
+ <execution>
+ <id>test-compile</id>
+ <goals> <goal>test-compile</goal> </goals>
+ <configuration>
+ <sourceDirs>
+ <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
+ <sourceDir>${generated.testsources.dir}</sourceDir>
+ </sourceDirs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- OSGI bundle configuration -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>com.google.protobuf</Automatic-Module-Name> <!-- Java9+ Jigsaw module name -->
+ <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
+ <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
+ <Export-Package>com.google.protobuf;version=${project.version}</Export-Package>
+ <Import-Package>sun.misc;resolution:=optional,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/java/kotlin-lite/process-lite-sources-build.xml b/java/kotlin-lite/process-lite-sources-build.xml
new file mode 100644
index 0000000..d49cf3a
--- /dev/null
+++ b/java/kotlin-lite/process-lite-sources-build.xml
@@ -0,0 +1,7 @@
+<project name="process-lite-sources">
+ <exec executable="awk" output="${generated.testsources.dir}/com/google/protobuf/TestUtil.java">
+ <arg value="-f" />
+ <arg value="${basedir}/lite.awk" />
+ <arg value="${basedir}/../core/src/test/java/com/google/protobuf/TestUtil.java" />
+ </exec>
+</project>
diff --git a/java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt b/java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt
new file mode 100644
index 0000000..18933d1
--- /dev/null
+++ b/java/kotlin-lite/src/test/kotlin/com/google/protobuf/ExtendableMessageLiteExtensionsTest.kt
@@ -0,0 +1,60 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.truth.Truth.assertThat
+import example_extensible_message.ExampleExtensibleMessage
+import example_extensible_message.ExampleExtensibleMessageOuterClass as TestProto
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class ExtendableMessageLiteExtensionsTest {
+ @Test
+ fun setOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ builder[TestProto.int32Extension] = 5
+ assertThat(builder.build().getExtension(TestProto.int32Extension)).isEqualTo(5)
+ }
+
+ @Test
+ fun getOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ assertThat(builder[TestProto.int32Extension]).isEqualTo(6)
+ }
+
+ @Test
+ fun getOnMessage() {
+ val message = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ .build()
+ assertThat(message[TestProto.int32Extension]).isEqualTo(6)
+ }
+
+ @Test
+ fun containsPositiveOnMessage() {
+ val message = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ .build()
+ assertThat(TestProto.int32Extension in message).isTrue()
+ }
+
+ @Test
+ fun containsPositiveOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ assertThat(TestProto.int32Extension in builder).isTrue()
+ }
+
+ @Test
+ fun containsNegativeOnMessage() {
+ val message = ExampleExtensibleMessage.newBuilder().build()
+ assertThat(TestProto.int32Extension in message).isFalse()
+ }
+
+ @Test
+ fun containsNegativeOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ assertThat(TestProto.int32Extension in builder).isFalse()
+ }
+}
diff --git a/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt b/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt
new file mode 100644
index 0000000..8726bbf
--- /dev/null
+++ b/java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt
@@ -0,0 +1,993 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.truth.Truth.assertThat
+import com.google.protobuf.TestAllTypesLiteKt
+import com.google.protobuf.TestAllTypesLiteKt.nestedMessage
+import com.google.protobuf.TestUtilLite
+import com.google.protobuf.TestUtilLite.toBytes
+import com.google.protobuf.UnittestImportLite.ImportEnumLite
+import com.google.protobuf.UnittestImportLite.ImportMessageLite
+import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite
+import com.google.protobuf.UnittestLite
+import com.google.protobuf.UnittestLite.ForeignEnumLite
+import com.google.protobuf.UnittestLite.TestAllTypesLite
+import com.google.protobuf.UnittestLite.TestAllTypesLite.NestedEnum
+import com.google.protobuf.UnittestLite.TestEmptyMessageLite
+import com.google.protobuf.UnittestLite.TestEmptyMessageWithExtensionsLite
+import com.google.protobuf.copy
+import com.google.protobuf.foreignMessageLite
+import evil_names_proto2.EvilNamesProto2OuterClass.EvilNamesProto2
+import evil_names_proto2.EvilNamesProto2OuterClass.HardKeywordsAllTypes
+import evil_names_proto2.EvilNamesProto2OuterClass.Interface
+import evil_names_proto2.HardKeywordsAllTypesKt
+import evil_names_proto2.evilNamesProto2
+import evil_names_proto2.hardKeywordsAllTypes
+import evil_names_proto2.interface_
+import com.google.protobuf.optionalGroupExtensionLite
+import com.google.protobuf.repeatedGroupExtensionLite
+import com.google.protobuf.testAllExtensionsLite
+import com.google.protobuf.testAllTypesLite
+import com.google.protobuf.testEmptyMessageLite
+import com.google.protobuf.testEmptyMessageWithExtensionsLite
+import protobuf_unittest.MapLiteUnittest.MapEnumLite
+import protobuf_unittest.MapLiteUnittest.TestMapLite
+import protobuf_unittest.testMapLite
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class Proto2LiteTest {
+ @Test
+ fun testSetters() {
+ assertThat(
+ testAllTypesLite {
+ optionalInt32 = 101
+ optionalInt64 = 102
+ optionalUint32 = 103
+ optionalUint64 = 104
+ optionalSint32 = 105
+ optionalSint64 = 106
+ optionalFixed32 = 107
+ optionalFixed64 = 108
+ optionalSfixed32 = 109
+ optionalSfixed64 = 110
+ optionalFloat = 111.0f
+ optionalDouble = 112.0
+ optionalBool = true
+ optionalString = "115"
+ optionalBytes = toBytes("116")
+ optionalGroup =
+ TestAllTypesLiteKt.optionalGroup { a = 117 }
+ optionalNestedMessage = nestedMessage { bb = 118 }
+ optionalForeignMessage =
+ foreignMessageLite { c = 119 }
+ optionalImportMessage =
+ ImportMessageLite.newBuilder().setD(120).build()
+ optionalPublicImportMessage =
+ PublicImportMessageLite.newBuilder().setE(126).build()
+ optionalLazyMessage = nestedMessage { bb = 127 }
+ optionalNestedEnum = NestedEnum.BAZ
+ optionalForeignEnum = ForeignEnumLite.FOREIGN_LITE_BAZ
+ optionalImportEnum = ImportEnumLite.IMPORT_LITE_BAZ
+ optionalStringPiece = "124"
+ optionalCord = "125"
+ repeatedInt32.add(201)
+ repeatedInt64.add(202)
+ repeatedUint32.add(203)
+ repeatedUint64.add(204)
+ repeatedSint32.add(205)
+ repeatedSint64.add(206)
+ repeatedFixed32.add(207)
+ repeatedFixed64.add(208)
+ repeatedSfixed32.add(209)
+ repeatedSfixed64.add(210)
+ repeatedFloat.add(211f)
+ repeatedDouble.add(212.0)
+ repeatedBool.add(true)
+ repeatedString.add("215")
+ repeatedBytes.add(toBytes("216"))
+ repeatedGroup.add(TestAllTypesLiteKt.repeatedGroup { a = 217 })
+ repeatedNestedMessage.add(nestedMessage { bb = 218 })
+ repeatedForeignMessage.add(
+ foreignMessageLite { c = 219 }
+ )
+ repeatedImportMessage.add(
+ ImportMessageLite.newBuilder().setD(220).build()
+ )
+ repeatedLazyMessage.add(nestedMessage { bb = 227 })
+ repeatedNestedEnum.add(NestedEnum.BAR)
+ repeatedForeignEnum.add(ForeignEnumLite.FOREIGN_LITE_BAR)
+ repeatedImportEnum.add(ImportEnumLite.IMPORT_LITE_BAR)
+ repeatedStringPiece.add("224")
+ repeatedCord.add("225")
+ repeatedInt32 += 301
+ repeatedInt64 += 302
+ repeatedUint32 += 303
+ repeatedUint64 += 304
+ repeatedSint32 += 305
+ repeatedSint64 += 306
+ repeatedFixed32 += 307
+ repeatedFixed64 += 308
+ repeatedSfixed32 += 309
+ repeatedSfixed64 += 310
+ repeatedFloat += 311f
+ repeatedDouble += 312.0
+ repeatedBool += false
+ repeatedString += "315"
+ repeatedBytes += toBytes("316")
+ repeatedGroup += TestAllTypesLiteKt.repeatedGroup { a = 317 }
+ repeatedNestedMessage += nestedMessage { bb = 318 }
+ repeatedForeignMessage +=
+ foreignMessageLite { c = 319 }
+ repeatedImportMessage +=
+ ImportMessageLite.newBuilder().setD(320).build()
+ repeatedLazyMessage +=
+ TestAllTypesLiteKt.nestedMessage { bb = 327 }
+ repeatedNestedEnum += NestedEnum.BAZ
+ repeatedForeignEnum += ForeignEnumLite.FOREIGN_LITE_BAZ
+ repeatedImportEnum += ImportEnumLite.IMPORT_LITE_BAZ
+ repeatedStringPiece += "324"
+ repeatedCord += "325"
+ defaultInt32 = 401
+ defaultInt64 = 402
+ defaultUint32 = 403
+ defaultUint64 = 404
+ defaultSint32 = 405
+ defaultSint64 = 406
+ defaultFixed32 = 407
+ defaultFixed64 = 408
+ defaultSfixed32 = 409
+ defaultSfixed64 = 410
+ defaultFloat = 411f
+ defaultDouble = 412.0
+ defaultBool = false
+ defaultString = "415"
+ defaultBytes = toBytes("416")
+ defaultNestedEnum = NestedEnum.FOO
+ defaultForeignEnum = ForeignEnumLite.FOREIGN_LITE_FOO
+ defaultImportEnum = ImportEnumLite.IMPORT_LITE_FOO
+ defaultStringPiece = "424"
+ defaultCord = "425"
+ oneofUint32 = 601
+ oneofNestedMessage =
+ TestAllTypesLiteKt.nestedMessage { bb = 602 }
+ oneofString = "603"
+ oneofBytes = toBytes("604")
+ }
+ ).isEqualTo(
+ TestUtilLite.getAllLiteSetBuilder().build()
+ )
+ }
+
+ @Test
+ fun testGetters() {
+ testAllTypesLite {
+ optionalInt32 = 101
+ assertThat(optionalInt32).isEqualTo(101)
+ optionalString = "115"
+ assertThat(optionalString).isEqualTo("115")
+ optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
+ assertThat(optionalGroup).isEqualTo(TestAllTypesLiteKt.optionalGroup { a = 117 })
+ optionalNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ assertThat(optionalNestedMessage).isEqualTo(TestAllTypesLiteKt.nestedMessage { bb = 118 })
+ optionalNestedEnum = NestedEnum.BAZ
+ assertThat(optionalNestedEnum).isEqualTo(NestedEnum.BAZ)
+ defaultInt32 = 401
+ assertThat(defaultInt32).isEqualTo(401)
+ oneofUint32 = 601
+ assertThat(oneofUint32).isEqualTo(601)
+ }
+ }
+
+ @Test
+ fun testDefaultGetters() {
+ testAllTypesLite {
+ assertThat(defaultInt32).isEqualTo(41)
+ assertThat(defaultString).isEqualTo("hello")
+ assertThat(defaultNestedEnum).isEqualTo(NestedEnum.BAR)
+ assertThat(defaultStringPiece).isEqualTo("abc")
+ }
+ }
+
+ @Test
+ fun testRepeatedGettersAndSetters() {
+ testAllTypesLite {
+ repeatedInt32.addAll(listOf(1, 2))
+ assertThat(repeatedInt32).isEqualTo(listOf(1, 2))
+ repeatedInt32 += listOf(3, 4)
+ assertThat(repeatedInt32).isEqualTo(listOf(1, 2, 3, 4))
+ repeatedInt32[0] = 5
+ assertThat(repeatedInt32).isEqualTo(listOf(5, 2, 3, 4))
+
+ repeatedString.addAll(listOf("1", "2"))
+ assertThat(repeatedString).isEqualTo(listOf("1", "2"))
+ repeatedString += listOf("3", "4")
+ assertThat(repeatedString).isEqualTo(listOf("1", "2", "3", "4"))
+ repeatedString[0] = "5"
+ assertThat(repeatedString).isEqualTo(listOf("5", "2", "3", "4"))
+
+ repeatedGroup.addAll(
+ listOf(
+ TestAllTypesLiteKt.repeatedGroup { a = 1 },
+ TestAllTypesLiteKt.repeatedGroup { a = 2 }
+ )
+ )
+ assertThat(repeatedGroup).isEqualTo(
+ listOf(
+ TestAllTypesLiteKt.repeatedGroup { a = 1 },
+ TestAllTypesLiteKt.repeatedGroup { a = 2 }
+ )
+ )
+ repeatedGroup +=
+ listOf(
+ TestAllTypesLiteKt.repeatedGroup { a = 3 },
+ TestAllTypesLiteKt.repeatedGroup { a = 4 }
+ )
+ assertThat(repeatedGroup).isEqualTo(
+ listOf(
+ TestAllTypesLiteKt.repeatedGroup { a = 1 },
+ TestAllTypesLiteKt.repeatedGroup { a = 2 },
+ TestAllTypesLiteKt.repeatedGroup { a = 3 },
+ TestAllTypesLiteKt.repeatedGroup { a = 4 }
+ )
+ )
+ repeatedGroup[0] = TestAllTypesLiteKt.repeatedGroup { a = 5 }
+ assertThat(repeatedGroup).isEqualTo(
+ listOf(
+ TestAllTypesLiteKt.repeatedGroup { a = 5 },
+ TestAllTypesLiteKt.repeatedGroup { a = 2 },
+ TestAllTypesLiteKt.repeatedGroup { a = 3 },
+ TestAllTypesLiteKt.repeatedGroup { a = 4 }
+ )
+ )
+
+ repeatedNestedMessage.addAll(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 }
+ )
+ )
+ repeatedNestedMessage += listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+ repeatedNestedMessage[0] = nestedMessage { bb = 5 }
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 5 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+
+ repeatedNestedEnum.addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ assertThat(repeatedNestedEnum).isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ repeatedNestedEnum += listOf(NestedEnum.BAZ, NestedEnum.FOO)
+ assertThat(repeatedNestedEnum).isEqualTo(
+ listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ repeatedNestedEnum[0] = NestedEnum.BAR
+ assertThat(repeatedNestedEnum).isEqualTo(
+ listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ }
+ }
+
+ @Test
+ fun testHazzers() {
+ testAllTypesLite {
+ optionalInt32 = 101
+ assertThat(hasOptionalInt32()).isTrue()
+ assertThat(hasOptionalString()).isFalse()
+ optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
+ assertThat(hasOptionalGroup()).isTrue()
+ assertThat(hasOptionalNestedMessage()).isFalse()
+ optionalNestedEnum = NestedEnum.BAZ
+ assertThat(hasOptionalNestedEnum()).isTrue()
+ assertThat(hasDefaultInt32()).isFalse()
+ oneofUint32 = 601
+ assertThat(hasOneofUint32()).isTrue()
+ }
+
+ testAllTypesLite {
+ assertThat(hasOptionalInt32()).isFalse()
+ optionalString = "115"
+ assertThat(hasOptionalString()).isTrue()
+ assertThat(hasOptionalGroup()).isFalse()
+ optionalNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ assertThat(hasOptionalNestedMessage()).isTrue()
+ assertThat(hasOptionalNestedEnum()).isFalse()
+ defaultInt32 = 401
+ assertThat(hasDefaultInt32()).isTrue()
+ assertThat(hasOneofUint32()).isFalse()
+ }
+ }
+
+ @Test
+ fun testClears() {
+ testAllTypesLite {
+ optionalInt32 = 101
+ clearOptionalInt32()
+ assertThat(hasOptionalInt32()).isFalse()
+
+ optionalString = "115"
+ clearOptionalString()
+ assertThat(hasOptionalString()).isFalse()
+
+ optionalGroup = TestAllTypesLiteKt.optionalGroup { a = 117 }
+ clearOptionalGroup()
+ assertThat(hasOptionalGroup()).isFalse()
+
+ optionalNestedMessage = TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ clearOptionalNestedMessage()
+ assertThat(hasOptionalNestedMessage()).isFalse()
+
+ optionalNestedEnum = NestedEnum.BAZ
+ clearOptionalNestedEnum()
+ assertThat(hasOptionalNestedEnum()).isFalse()
+
+ defaultInt32 = 401
+ clearDefaultInt32()
+ assertThat(hasDefaultInt32()).isFalse()
+
+ oneofUint32 = 601
+ clearOneofUint32()
+ assertThat(hasOneofUint32()).isFalse()
+ }
+ }
+
+ @Test
+ fun testCopy() {
+ val message = testAllTypesLite {
+ optionalInt32 = 101
+ optionalString = "115"
+ }
+ val modifiedMessage = message.copy {
+ optionalInt32 = 201
+ }
+
+ assertThat(message).isEqualTo(
+ TestAllTypesLite.newBuilder()
+ .setOptionalInt32(101)
+ .setOptionalString("115")
+ .build()
+ )
+ assertThat(modifiedMessage).isEqualTo(
+ TestAllTypesLite.newBuilder()
+ .setOptionalInt32(201)
+ .setOptionalString("115")
+ .build()
+ )
+ }
+
+ @Test
+ fun testOneof() {
+ val message = testAllTypesLite {
+ oneofString = "foo"
+ assertThat(oneofFieldCase)
+ .isEqualTo(TestAllTypesLite.OneofFieldCase.ONEOF_STRING)
+ assertThat(oneofString).isEqualTo("foo")
+ clearOneofField()
+ assertThat(hasOneofUint32()).isFalse()
+ assertThat(oneofFieldCase)
+ .isEqualTo(TestAllTypesLite.OneofFieldCase.ONEOFFIELD_NOT_SET)
+ oneofUint32 = 5
+ }
+
+ assertThat(message.getOneofFieldCase())
+ .isEqualTo(TestAllTypesLite.OneofFieldCase.ONEOF_UINT32)
+ assertThat(message.getOneofUint32()).isEqualTo(5)
+ }
+
+ @Test
+ fun testExtensionsSet() {
+ assertThat(
+ testAllExtensionsLite {
+ this[UnittestLite.optionalInt32ExtensionLite] = 101
+ this[UnittestLite.optionalInt64ExtensionLite] = 102L
+ this[UnittestLite.optionalUint32ExtensionLite] = 103
+ this[UnittestLite.optionalUint64ExtensionLite] = 104L
+ this[UnittestLite.optionalSint32ExtensionLite] = 105
+ this[UnittestLite.optionalSint64ExtensionLite] = 106L
+ this[UnittestLite.optionalFixed32ExtensionLite] = 107
+ this[UnittestLite.optionalFixed64ExtensionLite] = 108L
+ this[UnittestLite.optionalSfixed32ExtensionLite] = 109
+ this[UnittestLite.optionalSfixed64ExtensionLite] = 110L
+ this[UnittestLite.optionalFloatExtensionLite] = 111F
+ this[UnittestLite.optionalDoubleExtensionLite] = 112.0
+ this[UnittestLite.optionalBoolExtensionLite] = true
+ this[UnittestLite.optionalStringExtensionLite] = "115"
+ this[UnittestLite.optionalBytesExtensionLite] = toBytes("116")
+ this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
+ this[UnittestLite.optionalNestedMessageExtensionLite] =
+ TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ this[UnittestLite.optionalForeignMessageExtensionLite] = foreignMessageLite { c = 119 }
+ this[UnittestLite.optionalImportMessageExtensionLite] =
+ ImportMessageLite.newBuilder().setD(120).build()
+ this[UnittestLite.optionalPublicImportMessageExtensionLite] =
+ PublicImportMessageLite.newBuilder().setE(126).build()
+ this[UnittestLite.optionalLazyMessageExtensionLite] =
+ TestAllTypesLiteKt.nestedMessage { bb = 127 }
+ this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
+ this[UnittestLite.optionalForeignEnumExtensionLite] = ForeignEnumLite.FOREIGN_LITE_BAZ
+ this[UnittestLite.optionalImportEnumExtensionLite] = ImportEnumLite.IMPORT_LITE_BAZ
+ this[UnittestLite.optionalStringPieceExtensionLite] = "124"
+ this[UnittestLite.optionalCordExtensionLite] = "125"
+ this[UnittestLite.repeatedInt32ExtensionLite].add(201)
+ this[UnittestLite.repeatedInt64ExtensionLite].add(202L)
+ this[UnittestLite.repeatedUint32ExtensionLite].add(203)
+ this[UnittestLite.repeatedUint64ExtensionLite].add(204L)
+ this[UnittestLite.repeatedSint32ExtensionLite].add(205)
+ this[UnittestLite.repeatedSint64ExtensionLite].add(206L)
+ this[UnittestLite.repeatedFixed32ExtensionLite].add(207)
+ this[UnittestLite.repeatedFixed64ExtensionLite].add(208L)
+ this[UnittestLite.repeatedSfixed32ExtensionLite].add(209)
+ this[UnittestLite.repeatedSfixed64ExtensionLite].add(210L)
+ this[UnittestLite.repeatedFloatExtensionLite].add(211F)
+ this[UnittestLite.repeatedDoubleExtensionLite].add(212.0)
+ this[UnittestLite.repeatedBoolExtensionLite].add(true)
+ this[UnittestLite.repeatedStringExtensionLite].add("215")
+ this[UnittestLite.repeatedBytesExtensionLite].add(toBytes("216"))
+ this[UnittestLite.repeatedGroupExtensionLite].add(repeatedGroupExtensionLite { a = 217 })
+ this[UnittestLite.repeatedNestedMessageExtensionLite].add(
+ TestAllTypesLiteKt.nestedMessage { bb = 218 }
+ )
+ this[UnittestLite.repeatedForeignMessageExtensionLite].add(foreignMessageLite { c = 219 })
+ this[UnittestLite.repeatedImportMessageExtensionLite].add(
+ ImportMessageLite.newBuilder().setD(220).build()
+ )
+ this[UnittestLite.repeatedLazyMessageExtensionLite].add(
+ TestAllTypesLiteKt.nestedMessage { bb = 227 }
+ )
+ this[UnittestLite.repeatedNestedEnumExtensionLite].add(NestedEnum.BAR)
+ this[UnittestLite.repeatedForeignEnumExtensionLite].add(ForeignEnumLite.FOREIGN_LITE_BAR)
+ this[UnittestLite.repeatedImportEnumExtensionLite].add(ImportEnumLite.IMPORT_LITE_BAR)
+ this[UnittestLite.repeatedStringPieceExtensionLite].add("224")
+ this[UnittestLite.repeatedCordExtensionLite].add("225")
+ this[UnittestLite.repeatedInt32ExtensionLite].add(301)
+ this[UnittestLite.repeatedInt64ExtensionLite].add(302L)
+ this[UnittestLite.repeatedUint32ExtensionLite].add(303)
+ this[UnittestLite.repeatedUint64ExtensionLite].add(304L)
+ this[UnittestLite.repeatedSint32ExtensionLite].add(305)
+ this[UnittestLite.repeatedSint64ExtensionLite].add(306L)
+ this[UnittestLite.repeatedFixed32ExtensionLite].add(307)
+ this[UnittestLite.repeatedFixed64ExtensionLite].add(308L)
+ this[UnittestLite.repeatedSfixed32ExtensionLite].add(309)
+ this[UnittestLite.repeatedSfixed64ExtensionLite].add(310L)
+ this[UnittestLite.repeatedFloatExtensionLite].add(311F)
+ this[UnittestLite.repeatedDoubleExtensionLite].add(312.0)
+ this[UnittestLite.repeatedBoolExtensionLite].add(false)
+ this[UnittestLite.repeatedStringExtensionLite].add("315")
+ this[UnittestLite.repeatedBytesExtensionLite].add(toBytes("316"))
+ this[UnittestLite.repeatedGroupExtensionLite].add(repeatedGroupExtensionLite { a = 317 })
+ this[UnittestLite.repeatedNestedMessageExtensionLite].add(
+ TestAllTypesLiteKt.nestedMessage { bb = 318 }
+ )
+ this[UnittestLite.repeatedForeignMessageExtensionLite].add(foreignMessageLite { c = 319 })
+ this[UnittestLite.repeatedImportMessageExtensionLite].add(
+ ImportMessageLite.newBuilder().setD(320).build()
+ )
+ this[UnittestLite.repeatedLazyMessageExtensionLite].add(
+ TestAllTypesLiteKt.nestedMessage { bb = 327 }
+ )
+ this[UnittestLite.repeatedNestedEnumExtensionLite].add(NestedEnum.BAZ)
+ this[UnittestLite.repeatedForeignEnumExtensionLite].add(ForeignEnumLite.FOREIGN_LITE_BAZ)
+ this[UnittestLite.repeatedImportEnumExtensionLite].add(ImportEnumLite.IMPORT_LITE_BAZ)
+ this[UnittestLite.repeatedStringPieceExtensionLite].add("324")
+ this[UnittestLite.repeatedCordExtensionLite].add("325")
+ this[UnittestLite.defaultInt32ExtensionLite] = 401
+ this[UnittestLite.defaultInt64ExtensionLite] = 402L
+ this[UnittestLite.defaultUint32ExtensionLite] = 403
+ this[UnittestLite.defaultUint64ExtensionLite] = 404L
+ this[UnittestLite.defaultSint32ExtensionLite] = 405
+ this[UnittestLite.defaultSint64ExtensionLite] = 406L
+ this[UnittestLite.defaultFixed32ExtensionLite] = 407
+ this[UnittestLite.defaultFixed64ExtensionLite] = 408L
+ this[UnittestLite.defaultSfixed32ExtensionLite] = 409
+ this[UnittestLite.defaultSfixed64ExtensionLite] = 410L
+ this[UnittestLite.defaultFloatExtensionLite] = 411F
+ this[UnittestLite.defaultDoubleExtensionLite] = 412.0
+ this[UnittestLite.defaultBoolExtensionLite] = false
+ this[UnittestLite.defaultStringExtensionLite] = "415"
+ this[UnittestLite.defaultBytesExtensionLite] = toBytes("416")
+ this[UnittestLite.defaultNestedEnumExtensionLite] = NestedEnum.FOO
+ this[UnittestLite.defaultForeignEnumExtensionLite] = ForeignEnumLite.FOREIGN_LITE_FOO
+ this[UnittestLite.defaultImportEnumExtensionLite] = ImportEnumLite.IMPORT_LITE_FOO
+ this[UnittestLite.defaultStringPieceExtensionLite] = "424"
+ this[UnittestLite.defaultCordExtensionLite] = "425"
+ this[UnittestLite.oneofUint32ExtensionLite] = 601
+ this[UnittestLite.oneofNestedMessageExtensionLite] =
+ TestAllTypesLiteKt.nestedMessage { bb = 602 }
+ this[UnittestLite.oneofStringExtensionLite] = "603"
+ this[UnittestLite.oneofBytesExtensionLite] = toBytes("604")
+ }
+ ).isEqualTo(
+ TestUtilLite.getAllLiteExtensionsSet()
+ )
+ }
+
+ @Test
+ fun testExtensionGetters() {
+ testAllExtensionsLite {
+ this[UnittestLite.optionalInt32ExtensionLite] = 101
+ assertThat(this[UnittestLite.optionalInt32ExtensionLite]).isEqualTo(101)
+ this[UnittestLite.optionalStringExtensionLite] = "115"
+ assertThat(this[UnittestLite.optionalStringExtensionLite]).isEqualTo("115")
+ this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
+ assertThat(this[UnittestLite.optionalGroupExtensionLite])
+ .isEqualTo(optionalGroupExtensionLite { a = 117 })
+ this[UnittestLite.optionalNestedMessageExtensionLite] =
+ TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ assertThat(this[UnittestLite.optionalNestedMessageExtensionLite])
+ .isEqualTo(TestAllTypesLiteKt.nestedMessage { bb = 118 })
+ this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
+ assertThat(this[UnittestLite.optionalNestedEnumExtensionLite]).isEqualTo(NestedEnum.BAZ)
+ this[UnittestLite.defaultInt32ExtensionLite] = 401
+ assertThat(this[UnittestLite.defaultInt32ExtensionLite]).isEqualTo(401)
+ this[UnittestLite.oneofUint32ExtensionLite] = 601
+ assertThat(this[UnittestLite.oneofUint32ExtensionLite]).isEqualTo(601)
+ }
+ }
+
+ @Test
+ fun testRepeatedExtensionGettersAndSetters() {
+ testAllExtensionsLite {
+ this[UnittestLite.repeatedInt32ExtensionLite].addAll(listOf(1, 2))
+ assertThat(this[UnittestLite.repeatedInt32ExtensionLite]).isEqualTo(listOf(1, 2))
+ this[UnittestLite.repeatedInt32ExtensionLite].addAll(listOf(3, 4))
+ assertThat(this[UnittestLite.repeatedInt32ExtensionLite]).isEqualTo(listOf(1, 2, 3, 4))
+ this[UnittestLite.repeatedInt32ExtensionLite][0] = 5
+ assertThat(this[UnittestLite.repeatedInt32ExtensionLite]).isEqualTo(listOf(5, 2, 3, 4))
+
+ this[UnittestLite.repeatedStringExtensionLite].addAll(listOf("1", "2"))
+ assertThat(this[UnittestLite.repeatedStringExtensionLite]).isEqualTo(listOf("1", "2"))
+ this[UnittestLite.repeatedStringExtensionLite].addAll(listOf("3", "4"))
+ assertThat(this[UnittestLite.repeatedStringExtensionLite])
+ .isEqualTo(listOf("1", "2", "3", "4"))
+ this[UnittestLite.repeatedStringExtensionLite][0] = "5"
+ assertThat(this[UnittestLite.repeatedStringExtensionLite])
+ .isEqualTo(listOf("5", "2", "3", "4"))
+
+ this[UnittestLite.repeatedGroupExtensionLite].addAll(
+ listOf(
+ repeatedGroupExtensionLite { a = 1 },
+ repeatedGroupExtensionLite { a = 2 }
+ )
+ )
+ assertThat(this[UnittestLite.repeatedGroupExtensionLite]).isEqualTo(
+ listOf(
+ repeatedGroupExtensionLite { a = 1 },
+ repeatedGroupExtensionLite { a = 2 }
+ )
+ )
+ this[UnittestLite.repeatedGroupExtensionLite].addAll(
+ listOf(
+ repeatedGroupExtensionLite { a = 3 },
+ repeatedGroupExtensionLite { a = 4 }
+ )
+ )
+ assertThat(this[UnittestLite.repeatedGroupExtensionLite]).isEqualTo(
+ listOf(
+ repeatedGroupExtensionLite { a = 1 },
+ repeatedGroupExtensionLite { a = 2 },
+ repeatedGroupExtensionLite { a = 3 },
+ repeatedGroupExtensionLite { a = 4 }
+ )
+ )
+ this[UnittestLite.repeatedGroupExtensionLite][0] = repeatedGroupExtensionLite { a = 5 }
+ assertThat(this[UnittestLite.repeatedGroupExtensionLite]).isEqualTo(
+ listOf(
+ repeatedGroupExtensionLite { a = 5 },
+ repeatedGroupExtensionLite { a = 2 },
+ repeatedGroupExtensionLite { a = 3 },
+ repeatedGroupExtensionLite { a = 4 }
+ )
+ )
+
+ this[UnittestLite.repeatedNestedMessageExtensionLite].addAll(
+ listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 })
+ )
+ assertThat(this[UnittestLite.repeatedNestedMessageExtensionLite]).isEqualTo(
+ listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 })
+ )
+ this[UnittestLite.repeatedNestedMessageExtensionLite].addAll(
+ listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
+ )
+ assertThat(this[UnittestLite.repeatedNestedMessageExtensionLite]).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+ this[UnittestLite.repeatedNestedMessageExtensionLite][0] = nestedMessage { bb = 5 }
+ assertThat(this[UnittestLite.repeatedNestedMessageExtensionLite]).isEqualTo(
+ listOf(
+ nestedMessage { bb = 5 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+
+ this[UnittestLite.repeatedNestedEnumExtensionLite]
+ .addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ assertThat(this[UnittestLite.repeatedNestedEnumExtensionLite])
+ .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ this[UnittestLite.repeatedNestedEnumExtensionLite].addAll(listOf(NestedEnum.BAZ, NestedEnum.FOO))
+ assertThat(this[UnittestLite.repeatedNestedEnumExtensionLite]).isEqualTo(
+ listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ this[UnittestLite.repeatedNestedEnumExtensionLite][0] = NestedEnum.BAR
+ assertThat(this[UnittestLite.repeatedNestedEnumExtensionLite]).isEqualTo(
+ listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ }
+ }
+
+ @Test
+ fun testExtensionContains() {
+ testAllExtensionsLite {
+ this[UnittestLite.optionalInt32ExtensionLite] = 101
+ assertThat(contains(UnittestLite.optionalInt32ExtensionLite)).isTrue()
+ assertThat(contains(UnittestLite.optionalStringExtensionLite)).isFalse()
+ this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
+ assertThat(contains(UnittestLite.optionalGroupExtensionLite)).isTrue()
+ assertThat(contains(UnittestLite.optionalNestedMessageExtensionLite)).isFalse()
+ this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
+ assertThat(contains(UnittestLite.optionalNestedEnumExtensionLite)).isTrue()
+ assertThat(contains(UnittestLite.defaultInt32ExtensionLite)).isFalse()
+ this[UnittestLite.oneofUint32ExtensionLite] = 601
+ assertThat(contains(UnittestLite.oneofUint32ExtensionLite)).isTrue()
+ }
+
+ testAllExtensionsLite {
+ assertThat(contains(UnittestLite.optionalInt32ExtensionLite)).isFalse()
+ this[UnittestLite.optionalStringExtensionLite] = "115"
+ assertThat(contains(UnittestLite.optionalStringExtensionLite)).isTrue()
+ assertThat(contains(UnittestLite.optionalGroupExtensionLite)).isFalse()
+ this[UnittestLite.optionalNestedMessageExtensionLite] =
+ TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ assertThat(contains(UnittestLite.optionalNestedMessageExtensionLite)).isTrue()
+ assertThat(contains(UnittestLite.optionalNestedEnumExtensionLite)).isFalse()
+ this[UnittestLite.defaultInt32ExtensionLite] = 401
+ assertThat(contains(UnittestLite.defaultInt32ExtensionLite)).isTrue()
+ assertThat(contains(UnittestLite.oneofUint32ExtensionLite)).isFalse()
+ }
+ }
+
+ @Test
+ fun testExtensionClears() {
+ testAllExtensionsLite {
+ this[UnittestLite.optionalInt32ExtensionLite] = 101
+ clear(UnittestLite.optionalInt32ExtensionLite)
+ assertThat(contains(UnittestLite.optionalInt32ExtensionLite)).isFalse()
+
+ this[UnittestLite.optionalStringExtensionLite] = "115"
+ clear(UnittestLite.optionalStringExtensionLite)
+ assertThat(contains(UnittestLite.optionalStringExtensionLite)).isFalse()
+
+ this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
+ clear(UnittestLite.optionalGroupExtensionLite)
+ assertThat(contains(UnittestLite.optionalGroupExtensionLite)).isFalse()
+
+ this[UnittestLite.optionalNestedMessageExtensionLite] =
+ TestAllTypesLiteKt.nestedMessage { bb = 118 }
+ clear(UnittestLite.optionalNestedMessageExtensionLite)
+ assertThat(contains(UnittestLite.optionalNestedMessageExtensionLite)).isFalse()
+
+ this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
+ clear(UnittestLite.optionalNestedEnumExtensionLite)
+ assertThat(contains(UnittestLite.optionalNestedEnumExtensionLite)).isFalse()
+
+ this[UnittestLite.defaultInt32ExtensionLite] = 401
+ clear(UnittestLite.defaultInt32ExtensionLite)
+ assertThat(contains(UnittestLite.defaultInt32ExtensionLite)).isFalse()
+
+ this[UnittestLite.oneofUint32ExtensionLite] = 601
+ clear(UnittestLite.oneofUint32ExtensionLite)
+ assertThat(contains(UnittestLite.oneofUint32ExtensionLite)).isFalse()
+ }
+ }
+
+ @Test
+ fun testEmptyMessages() {
+ assertThat(
+ testEmptyMessageLite {}
+ ).isEqualTo(
+ TestEmptyMessageLite.newBuilder().build()
+ )
+
+ assertThat(
+ testEmptyMessageWithExtensionsLite {}
+ ).isEqualTo(
+ TestEmptyMessageWithExtensionsLite.newBuilder().build()
+ )
+ }
+
+ @Test
+ fun testMapSetters() {
+ assertThat(
+ testMapLite {
+ mapInt32Int32[1] = 2
+ mapInt64Int64[1L] = 2L
+ mapUint32Uint32[1] = 2
+ mapUint64Uint64[1L] = 2L
+ mapSint32Sint32[1] = 2
+ mapSint64Sint64[1L] = 2L
+ mapFixed32Fixed32[1] = 2
+ mapFixed64Fixed64[1L] = 2L
+ mapSfixed32Sfixed32[1] = 2
+ mapSfixed64Sfixed64[1L] = 2L
+ mapInt32Float[1] = 2F
+ mapInt32Double[1] = 2.0
+ mapBoolBool[true] = true
+ mapStringString["1"] = "2"
+ mapInt32Bytes[1] = toBytes("2")
+ mapInt32Enum[1] = MapEnumLite.MAP_ENUM_FOO_LITE
+ mapInt32ForeignMessage[1] = foreignMessageLite { c = 1 }
+ }
+ ).isEqualTo(
+ TestMapLite.newBuilder()
+ .putMapInt32Int32(1, 2)
+ .putMapInt64Int64(1L, 2L)
+ .putMapUint32Uint32(1, 2)
+ .putMapUint64Uint64(1L, 2L)
+ .putMapSint32Sint32(1, 2)
+ .putMapSint64Sint64(1L, 2L)
+ .putMapFixed32Fixed32(1, 2)
+ .putMapFixed64Fixed64(1L, 2L)
+ .putMapSfixed32Sfixed32(1, 2)
+ .putMapSfixed64Sfixed64(1L, 2L)
+ .putMapInt32Float(1, 2F)
+ .putMapInt32Double(1, 2.0)
+ .putMapBoolBool(true, true)
+ .putMapStringString("1", "2")
+ .putMapInt32Bytes(1, toBytes("2"))
+ .putMapInt32Enum(1, MapEnumLite.MAP_ENUM_FOO_LITE)
+ .putMapInt32ForeignMessage(1, foreignMessageLite { c = 1 })
+ .build()
+ )
+ }
+
+ @Test
+ fun testMapGettersAndSetters() {
+ testMapLite {
+ mapInt32Int32.put(1, 2)
+ assertThat(mapInt32Int32).isEqualTo(mapOf(1 to 2))
+ mapInt32Int32[3] = 4
+ assertThat(mapInt32Int32).isEqualTo(mapOf(1 to 2, 3 to 4))
+ mapInt32Int32.putAll(mapOf(5 to 6, 7 to 8))
+ assertThat(mapInt32Int32).isEqualTo(mapOf(1 to 2, 3 to 4, 5 to 6, 7 to 8))
+
+ mapStringString.put("1", "2")
+ assertThat(mapStringString).isEqualTo(mapOf("1" to "2"))
+ mapStringString["3"] = "4"
+ assertThat(mapStringString).isEqualTo(mapOf("1" to "2", "3" to "4"))
+ mapStringString.putAll(mapOf("5" to "6", "7" to "8"))
+ assertThat(mapStringString).isEqualTo(mapOf("1" to "2", "3" to "4", "5" to "6", "7" to "8"))
+
+ mapInt32Enum.put(1, MapEnumLite.MAP_ENUM_FOO_LITE)
+ assertThat(mapInt32Enum).isEqualTo(mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE))
+ mapInt32Enum[2] = MapEnumLite.MAP_ENUM_BAR_LITE
+ assertThat(mapInt32Enum).isEqualTo(
+ mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE)
+ )
+ mapInt32Enum.putAll(
+ mapOf(3 to MapEnumLite.MAP_ENUM_BAZ_LITE, 4 to MapEnumLite.MAP_ENUM_FOO_LITE)
+ )
+ assertThat(mapInt32Enum).isEqualTo(
+ mapOf(
+ 1 to MapEnumLite.MAP_ENUM_FOO_LITE,
+ 2 to MapEnumLite.MAP_ENUM_BAR_LITE,
+ 3 to MapEnumLite.MAP_ENUM_BAZ_LITE,
+ 4 to MapEnumLite.MAP_ENUM_FOO_LITE
+ )
+ )
+
+ mapInt32ForeignMessage.put(1, foreignMessageLite { c = 1 })
+ assertThat(mapInt32ForeignMessage).isEqualTo(mapOf(1 to foreignMessageLite { c = 1 }))
+ mapInt32ForeignMessage[2] = foreignMessageLite { c = 2 }
+ assertThat(mapInt32ForeignMessage).isEqualTo(
+ mapOf(1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 })
+ )
+ mapInt32ForeignMessage.putAll(
+ mapOf(3 to foreignMessageLite { c = 3 }, 4 to foreignMessageLite { c = 4 })
+ )
+ assertThat(mapInt32ForeignMessage).isEqualTo(
+ mapOf(
+ 1 to foreignMessageLite { c = 1 },
+ 2 to foreignMessageLite { c = 2 },
+ 3 to foreignMessageLite { c = 3 },
+ 4 to foreignMessageLite { c = 4 }
+ )
+ )
+ }
+ }
+
+ @Test
+ fun testMapRemove() {
+ testMapLite {
+ mapInt32Int32.putAll(mapOf(1 to 2, 3 to 4))
+ mapInt32Int32.remove(1)
+ assertThat(mapInt32Int32).isEqualTo(mapOf(3 to 4))
+
+ mapStringString.putAll(mapOf("1" to "2", "3" to "4"))
+ mapStringString.remove("1")
+ assertThat(mapStringString).isEqualTo(mapOf("3" to "4"))
+
+ mapInt32Enum.putAll(
+ mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE)
+ )
+ mapInt32Enum.remove(1)
+ assertThat(mapInt32Enum).isEqualTo(mapOf(2 to MapEnumLite.MAP_ENUM_BAR_LITE))
+
+ mapInt32ForeignMessage.putAll(
+ mapOf(1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 })
+ )
+ mapInt32ForeignMessage.remove(1)
+ assertThat(mapInt32ForeignMessage).isEqualTo(mapOf(2 to foreignMessageLite { c = 2 }))
+ }
+ }
+
+ @Test
+ fun testMapClear() {
+ testMapLite {
+ mapInt32Int32.putAll(mapOf(1 to 2, 3 to 4))
+ mapInt32Int32.clear()
+ assertThat(mapInt32Int32.isEmpty()).isTrue()
+
+ mapStringString.putAll(mapOf("1" to "2", "3" to "4"))
+ mapStringString.clear()
+ assertThat(mapStringString.isEmpty()).isTrue()
+
+ mapInt32Enum.putAll(
+ mapOf(1 to MapEnumLite.MAP_ENUM_FOO_LITE, 2 to MapEnumLite.MAP_ENUM_BAR_LITE)
+ )
+ mapInt32Enum.clear()
+ assertThat(mapInt32Enum.isEmpty()).isTrue()
+
+ mapInt32ForeignMessage.putAll(
+ mapOf(1 to foreignMessageLite { c = 1 }, 2 to foreignMessageLite { c = 2 })
+ )
+ mapInt32ForeignMessage.clear()
+ assertThat(mapInt32ForeignMessage.isEmpty()).isTrue()
+ }
+ }
+
+ @Test
+ fun testEvilNames() {
+ assertThat(
+ evilNamesProto2 {
+ initialized = true
+ hasFoo = true
+ bar = "foo"
+ isInitialized = true
+ fooBar = "foo"
+ aLLCAPS += "foo"
+ aLLCAPSMAP[1] = true
+ hasUnderbarPrecedingNumeric1Foo = true
+ hasUnderbarPrecedingNumeric42Bar = true
+ hasUnderbarPrecedingNumeric123Foo42BarBaz = true
+ extension += "foo"
+ class_ += 1
+ int = 1.0
+ long = true
+ boolean = 1L
+ sealed = "foo"
+ interface_ = 1F
+ in_ = 1
+ object_ = "foo"
+ cachedSize_ = "foo"
+ serializedSize_ = true
+ by = "foo"
+ }
+ ).isEqualTo(
+ EvilNamesProto2.newBuilder()
+ .setInitialized(true)
+ .setHasFoo(true)
+ .setBar("foo")
+ .setIsInitialized(true)
+ .setFooBar("foo")
+ .addALLCAPS("foo")
+ .putALLCAPSMAP(1, true)
+ .setHasUnderbarPrecedingNumeric1Foo(true)
+ .setHasUnderbarPrecedingNumeric42Bar(true)
+ .setHasUnderbarPrecedingNumeric123Foo42BarBaz(true)
+ .addExtension("foo")
+ .addClass_(1)
+ .setInt(1.0)
+ .setLong(true)
+ .setBoolean(1L)
+ .setSealed("foo")
+ .setInterface(1F)
+ .setIn(1)
+ .setObject("foo")
+ .setCachedSize_("foo")
+ .setSerializedSize_(true)
+ .setBy("foo")
+ .build()
+ )
+
+ assertThat(interface_ {}).isEqualTo(Interface.newBuilder().build())
+ }
+
+ @Test
+ fun testHardKeywordGettersAndSetters() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ assertThat(as_).isEqualTo(1)
+
+ in_ = "foo"
+ assertThat(in_).isEqualTo("foo")
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO)
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })
+
+ continue_[1] = 1
+ assertThat(continue_[1]).isEqualTo(1)
+
+ else_ += 1
+ assertThat(else_).isEqualTo(listOf(1))
+
+ for_ += "foo"
+ assertThat(for_).isEqualTo(listOf("foo"))
+
+ fun_ += HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO))
+
+ if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }))
+ }
+ }
+
+ @Test
+ fun testHardKeywordHazzers() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ assertThat(hasAs_()).isTrue()
+
+ in_ = "foo"
+ assertThat(hasIn_()).isTrue()
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(hasBreak_()).isTrue()
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(hasDo_()).isTrue()
+ }
+ }
+
+ @Test
+ fun testHardKeywordClears() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ clearAs_()
+ assertThat(hasAs_()).isFalse()
+
+ in_ = "foo"
+ clearIn_()
+ assertThat(hasIn_()).isFalse()
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ clearBreak_()
+ assertThat(hasBreak_()).isFalse()
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ clearDo_()
+ assertThat(hasDo_()).isFalse()
+ }
+ }
+}
diff --git a/java/kotlin/generate-sources-build.xml b/java/kotlin/generate-sources-build.xml
new file mode 100644
index 0000000..6963f37
--- /dev/null
+++ b/java/kotlin/generate-sources-build.xml
@@ -0,0 +1,20 @@
+<project name="generate-sources">
+ <echo message="Running protoc ..."/>
+ <mkdir dir="${generated.sources.dir}"/>
+ <exec executable="${protoc}">
+ <arg value="--kotlin_out=${generated.sources.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/source_context.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/struct.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/timestamp.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/type.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/wrappers.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/compiler/plugin.proto"/>
+ </exec>
+</project>
diff --git a/java/kotlin/generate-test-sources-build.xml b/java/kotlin/generate-test-sources-build.xml
new file mode 100644
index 0000000..dca1a05
--- /dev/null
+++ b/java/kotlin/generate-test-sources-build.xml
@@ -0,0 +1,34 @@
+<project name="generate-test-sources">
+ <mkdir dir="${generated.testsources.dir}"/>
+ <exec executable="${protoc}">
+ <arg value="--java_out=${generated.testsources.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="--proto_path=${test.proto.dir}"/>
+ <arg value="--experimental_allow_proto3_optional"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/map_proto2_unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_import_public_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_lite.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/evil_names_proto2.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/evil_names_proto3.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/example_extensible_message.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/multiple_files_proto3.proto"/>
+ </exec>
+ <exec executable="${protoc}">
+ <arg value="--kotlin_out=${generated.testsources.dir}"/>
+ <arg value="--proto_path=${protobuf.source.dir}"/>
+ <arg value="--proto_path=${test.proto.dir}"/>
+ <arg value="--experimental_allow_proto3_optional"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/map_proto2_unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/evil_names_proto2.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/evil_names_proto3.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/multiple_files_proto3.proto"/>
+ </exec>
+
+</project>
diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml
new file mode 100644
index 0000000..5f28125
--- /dev/null
+++ b/java/kotlin/pom.xml
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.google.protobuf</groupId>
+ <artifactId>protobuf-parent</artifactId>
+ <version>3.15.6</version>
+ </parent>
+
+ <artifactId>protobuf-kotlin</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Protocol Buffers [Core]</name>
+ <description>
+ Core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an
+ efficient yet extensible format.
+ </description>
+
+ <properties>
+ <kotlin.version>1.4.31</kotlin.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>protobuf-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava-testlib</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.truth</groupId>
+ <artifactId>truth</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test</artifactId>
+ <version>${kotlin.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <!-- Include core protos in the bundle as resources -->
+ <resources>
+ <resource>
+ <directory>${protobuf.source.dir}</directory>
+ <includes>
+ <include>google/protobuf/any.proto</include>
+ <include>google/protobuf/api.proto</include>
+ <include>google/protobuf/descriptor.proto</include>
+ <include>google/protobuf/duration.proto</include>
+ <include>google/protobuf/empty.proto</include>
+ <include>google/protobuf/field_mask.proto</include>
+ <include>google/protobuf/source_context.proto</include>
+ <include>google/protobuf/struct.proto</include>
+ <include>google/protobuf/timestamp.proto</include>
+ <include>google/protobuf/type.proto</include>
+ <include>google/protobuf/wrappers.proto</include>
+ <include>google/protobuf/compiler/plugin.proto</include>
+ </includes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>${protobuf.source.dir}</directory>
+ <includes>
+ <include>google/protobuf/testdata/golden_message_oneof_implemented</include>
+ <include>google/protobuf/testdata/golden_packed_fields_message</include>
+ </includes>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>copy-test-source-files</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${generated.testsources.dir}/com/google/protobuf</outputDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/../core/src/test/java/com/google/protobuf</directory>
+ <includes>
+ <include>TestUtil.java</include>
+ <include>TestUtilLite.java</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Use Antrun plugin to generate sources with protoc -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!-- Generate core protos -->
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="generate-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <!-- Generate the test protos -->
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <target>
+ <ant antfile="generate-test-sources-build.xml"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Add the generated sources to the build -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-generated-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${generated.sources.dir}</source>
+ </sources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>add-generated-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${generated.testsources.dir}</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-maven-plugin</artifactId>
+ <version>${kotlin.version}</version>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <goals> <goal>compile</goal> </goals>
+ <configuration>
+ <sourceDirs>
+ <sourceDir>${generated.sources.dir}</sourceDir>
+ <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
+ </sourceDirs>
+ </configuration>
+ </execution>
+ <execution>
+ <id>test-compile</id>
+ <goals> <goal>test-compile</goal> </goals>
+ <configuration>
+ <sourceDirs>
+ <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
+ <sourceDir>${generated.testsources.dir}</sourceDir>
+ </sourceDirs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- OSGI bundle configuration -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>com.google.protobuf</Automatic-Module-Name> <!-- Java9+ Jigsaw module name -->
+ <Bundle-DocURL>https://developers.google.com/protocol-buffers/</Bundle-DocURL>
+ <Bundle-SymbolicName>com.google.protobuf</Bundle-SymbolicName>
+ <Export-Package>com.google.protobuf;version=${project.version}</Export-Package>
+ <Import-Package>sun.misc;resolution:=optional,*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt
new file mode 100644
index 0000000..54a64af
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/DslList.kt
@@ -0,0 +1,27 @@
+package com.google.protobuf.kotlin
+
+/**
+ * A simple wrapper around a [List] with an extra generic parameter that can be used to disambiguate
+ * extension methods.
+ *
+ * <p>This class is used by Kotlin protocol buffer extensions, and its constructor is public only
+ * because generated message code is in a different compilation unit. Others should not use this
+ * class directly in any way.
+ */
+@Suppress("unused") // the unused type parameter
+class DslList<E, P : DslProxy> @OnlyForUseByGeneratedProtoCode constructor(
+ private val delegate: List<E>
+) : List<E> by delegate {
+ override fun iterator(): Iterator<E> = UnmodifiableIterator(delegate.iterator())
+
+ override fun listIterator(): ListIterator<E> = UnmodifiableListIterator(delegate.listIterator())
+
+ override fun listIterator(index: Int): ListIterator<E> =
+ UnmodifiableListIterator(delegate.listIterator(index))
+
+ override fun equals(other: Any?): Boolean = delegate == other
+
+ override fun hashCode(): Int = delegate.hashCode()
+
+ override fun toString(): String = delegate.toString()
+}
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt
new file mode 100644
index 0000000..9949fb4
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/DslMap.kt
@@ -0,0 +1,30 @@
+package com.google.protobuf.kotlin
+
+/**
+ * A simple wrapper around a [Map] with an extra generic parameter that can be used to disambiguate
+ * extension methods.
+ *
+ * <p>This class is used by Kotlin protocol buffer extensions, and its constructor is public only
+ * because generated message code is in a different compilation unit. Others should not use this
+ * class directly in any way.
+ */
+@Suppress("unused") // the unused type parameter
+class DslMap<K, V, P : DslProxy> @OnlyForUseByGeneratedProtoCode constructor(
+ private val delegate: Map<K, V>
+) : Map<K, V> by delegate {
+ // We allocate the wrappers on calls to get, not with lazy {...}, because lazy allocates
+ // a few objects up front, and any kind of query operation on this object should be rare.
+
+ override val entries: Set<Map.Entry<K, V>>
+ get() = UnmodifiableMapEntries(delegate.entries)
+ override val keys: Set<K>
+ get() = UnmodifiableSet(delegate.keys)
+ override val values: Collection<V>
+ get() = UnmodifiableCollection(delegate.values)
+
+ override fun equals(other: Any?): Boolean = delegate == other
+
+ override fun hashCode(): Int = delegate.hashCode()
+
+ override fun toString(): String = delegate.toString()
+}
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt
new file mode 100644
index 0000000..7d14e95
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/DslProxy.kt
@@ -0,0 +1,12 @@
+package com.google.protobuf.kotlin
+
+/**
+ * A type meaningful only for its existence, never intended to be instantiated. For example,
+ * a `DslList<Int, FooProxy>` can be given different extension methods than a
+ * `DslList<Int, BarProxy>`.
+ */
+abstract class DslProxy @OnlyForUseByGeneratedProtoCode protected constructor() {
+ init {
+ throw UnsupportedOperationException("A DslProxy should never be instantiated")
+ }
+}
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt
new file mode 100644
index 0000000..10630a9
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageExtensions.kt
@@ -0,0 +1,26 @@
+package com.google.protobuf.kotlin
+
+import com.google.protobuf.ExtensionLite
+import com.google.protobuf.GeneratedMessageV3
+
+/** Sets the current value of the proto extension in this builder.*/
+operator fun <
+ M : GeneratedMessageV3.ExtendableMessage<M>,
+ B : GeneratedMessageV3.ExtendableBuilder<M, B>,
+ T : Any
+ > B.set(extension: ExtensionLite<M, T>, value: T) {
+ setExtension(extension, value)
+}
+
+/** Gets the current value of the proto extension. */
+operator fun <
+ M : GeneratedMessageV3.ExtendableMessage<M>,
+ MorBT : GeneratedMessageV3.ExtendableMessageOrBuilder<M>,
+ T : Any
+ > MorBT.get(extension: ExtensionLite<M, T>): T = getExtension(extension)
+
+/** Returns true if the specified extension is set on this builder. */
+operator fun <
+ M : GeneratedMessageV3.ExtendableMessage<M>,
+ MorBT : GeneratedMessageV3.ExtendableMessageOrBuilder<M>
+ > MorBT.contains(extension: ExtensionLite<M, *>): Boolean = hasExtension(extension)
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt
new file mode 100644
index 0000000..dd1dc87
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtendableMessageLiteExtensions.kt
@@ -0,0 +1,28 @@
+package com.google.protobuf.kotlin
+
+import com.google.protobuf.ExtensionLite
+import com.google.protobuf.GeneratedMessageLite
+
+/** Gets the value of the proto extension. */
+operator fun <
+ M : GeneratedMessageLite.ExtendableMessage<M, *>,
+ MOrBT : GeneratedMessageLite.ExtendableMessageOrBuilder<M, *>,
+ T : Any
+ > MOrBT.get(extension: ExtensionLite<M, T>): T = getExtension(extension)
+
+/** Sets the current value of the proto extension in this builder. */
+operator fun <
+ M : GeneratedMessageLite.ExtendableMessage<M, B>,
+ B : GeneratedMessageLite.ExtendableBuilder<M, B>,
+ T : Any
+ > B.set(extension: ExtensionLite<M, T>, value: T) {
+ setExtension(extension, value)
+}
+
+/** Returns true if the specified extension is set. */
+operator fun <
+ M : GeneratedMessageLite.ExtendableMessage<M, *>,
+ MorBT : GeneratedMessageLite.ExtendableMessageOrBuilder<M, *>
+ > MorBT.contains(
+ extension: ExtensionLite<M, *>
+): Boolean = hasExtension(extension)
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
new file mode 100644
index 0000000..03764e1
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
@@ -0,0 +1,27 @@
+package com.google.protobuf.kotlin
+
+import com.google.protobuf.ExtensionLite
+import com.google.protobuf.MessageLite
+
+/**
+ * Implementation for ExtensionList and ExtensionListLite. Like [DslList], represents an
+ * unmodifiable view of a repeated proto field -- in this case, an extension field -- but
+ * supports querying the extension.
+ */
+class ExtensionList<E, M : MessageLite> @OnlyForUseByGeneratedProtoCode constructor(
+ val extension: ExtensionLite<M, List<E>>,
+ @JvmField private val delegate: List<E>
+) : List<E> by delegate {
+ override fun iterator(): Iterator<E> = UnmodifiableIterator(delegate.iterator())
+
+ override fun listIterator(): ListIterator<E> = UnmodifiableListIterator(delegate.listIterator())
+
+ override fun listIterator(index: Int): ListIterator<E> =
+ UnmodifiableListIterator(delegate.listIterator(index))
+
+ override fun equals(other: Any?): Boolean = delegate == other
+
+ override fun hashCode(): Int = delegate.hashCode()
+
+ override fun toString(): String = delegate.toString()
+}
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt
new file mode 100644
index 0000000..368912e
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/OnlyForUseByGeneratedProtoCode.kt
@@ -0,0 +1,18 @@
+package com.google.protobuf.kotlin
+
+/**
+ * Opt-in annotation to make it difficult to accidentally use APIs only intended for use by proto
+ * generated code. See https://kotlinlang.org/docs/reference/opt-in-requirements.html for details
+ * on how this API works.
+ */
+@RequiresOptIn(
+ message =
+ """
+ This API is only intended for use by generated protobuf code, the code generator, and their own
+ tests. If this does not describe your code, you should not be using this API.
+ """,
+ level = RequiresOptIn.Level.ERROR
+)
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.ANNOTATION_CLASS)
+annotation class OnlyForUseByGeneratedProtoCode
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt
new file mode 100644
index 0000000..c51ba35
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/ProtoDslMarker.kt
@@ -0,0 +1,10 @@
+package com.google.protobuf.kotlin
+
+/**
+ * Indicates an API that is part of a DSL to generate protocol buffer messages.
+ */
+@DslMarker
+@Target(AnnotationTarget.CLASS)
+@Retention(AnnotationRetention.BINARY)
+@OnlyForUseByGeneratedProtoCode
+annotation class ProtoDslMarker
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt
new file mode 100644
index 0000000..6af93e1
--- /dev/null
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/UnmodifiableCollections.kt
@@ -0,0 +1,39 @@
+package com.google.protobuf.kotlin
+
+/** Wraps an [Iterator] and makes it unmodifiable even from Java. */
+internal class UnmodifiableIterator<E>(delegate: Iterator<E>) : Iterator<E> by delegate
+
+/** Wraps a [ListIterator] and makes it unmodifiable even from Java. */
+internal class UnmodifiableListIterator<E>(
+ delegate: ListIterator<E>
+) : ListIterator<E> by delegate
+
+/** Wraps a [Collection] and makes it unmodifiable even from Java. */
+internal open class UnmodifiableCollection<E>(
+ private val delegate: Collection<E>
+) : Collection<E> by delegate {
+ override fun iterator(): Iterator<E> = UnmodifiableIterator(delegate.iterator())
+}
+
+/** Wraps a [Set] and makes it unmodifiable even from Java. */
+internal class UnmodifiableSet<E>(
+ delegate: Collection<E>
+) : UnmodifiableCollection<E>(delegate), Set<E>
+
+/** Wraps a [Map.Entry] and makes it unmodifiable even from Java. */
+internal class UnmodifiableMapEntry<K, V>(delegate: Map.Entry<K, V>) : Map.Entry<K, V> by delegate
+
+/** Wraps a [Set] of map entries and makes it unmodifiable even from Java. */
+internal class UnmodifiableMapEntries<K, V>(
+ private val delegate: Set<Map.Entry<K, V>>
+) : UnmodifiableCollection<Map.Entry<K, V>>(delegate), Set<Map.Entry<K, V>> {
+
+ // Is this overkill? Probably.
+
+ override fun iterator(): Iterator<Map.Entry<K, V>> {
+ val itr = delegate.iterator()
+ return object : Iterator<Map.Entry<K, V>> by itr {
+ override fun next(): Map.Entry<K, V> = UnmodifiableMapEntry(itr.next())
+ }
+ }
+}
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt
new file mode 100644
index 0000000..e5e6017
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/DslListTest.kt
@@ -0,0 +1,98 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.testing.EqualsTester
+import com.google.common.truth.Truth.assertThat
+import kotlin.test.assertFailsWith
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Tests for [DslList]. */
+@RunWith(JUnit4::class)
+@OptIn(OnlyForUseByGeneratedProtoCode::class)
+class DslListTest {
+ class DummyProxy private constructor() : DslProxy()
+
+ @Test
+ fun matchesList() {
+ assertThat(DslList<Int, DummyProxy>(listOf(1, 2, 3))).containsExactly(1, 2, 3).inOrder()
+ }
+
+ @Test
+ fun reflectsChangesInList() {
+ val mutableList = mutableListOf(1, 2, 3)
+ val dslList = DslList<Int, DummyProxy>(mutableList)
+ mutableList.add(4)
+ assertThat(dslList).containsExactly(1, 2, 3, 4).inOrder()
+ }
+
+ @Test
+ fun dslListIsNotMutable() {
+ val dslList = DslList<Int, DummyProxy>(mutableListOf(1, 2, 3))
+ assertThat(dslList is MutableList<*>).isFalse()
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslListIsNotEvenSecretlyMutable() {
+ val dslList = DslList<Int, DummyProxy>(mutableListOf(1, 2, 3))
+ val dslListAsJavaUtil = dslList as java.util.List<Int>
+ assertFailsWith<UnsupportedOperationException> {
+ dslListAsJavaUtil.add(4)
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslList_IteratorIsNotEvenSecretlyMutable() {
+ val dslList = DslList<Int, DummyProxy>(mutableListOf(1, 2, 3))
+ val iterator = dslList.iterator() as java.util.Iterator<Int>
+ iterator.next()
+
+ assertFailsWith<UnsupportedOperationException> {
+ iterator.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslList_ListIteratorIsNotEvenSecretlyMutable() {
+ val dslList = DslList<Int, DummyProxy>(mutableListOf(1, 2, 3))
+ val iterator = dslList.listIterator() as java.util.ListIterator<Int>
+ iterator.next()
+
+ assertFailsWith<UnsupportedOperationException> {
+ iterator.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslList_ListIteratorIndexIsNotEvenSecretlyMutable() {
+ val dslList = DslList<Int, DummyProxy>(mutableListOf(1, 2, 3))
+ val iterator = dslList.listIterator(1) as java.util.ListIterator<Int>
+ iterator.next()
+
+ assertFailsWith<UnsupportedOperationException> {
+ iterator.remove()
+ }
+ }
+
+ @Test
+ fun expectedToString() {
+ assertThat(DslList<Int, DummyProxy>(listOf(1, 2)).toString()).isEqualTo("[1, 2]")
+ }
+
+ @Test
+ fun equality() {
+ EqualsTester()
+ .addEqualityGroup(DslList<Int, DummyProxy>(listOf(1, 2)), listOf(1, 2))
+ .addEqualityGroup(DslList<Int, DummyProxy>(listOf(2, 2)), listOf(2, 2))
+ .addEqualityGroup(
+ DslList<Int, DummyProxy>(emptyList()),
+ DslList<String, DummyProxy>(emptyList()),
+ emptyList<Int>()
+ )
+ .testEquals()
+ }
+}
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt
new file mode 100644
index 0000000..470e42e
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/DslMapTest.kt
@@ -0,0 +1,164 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.testing.EqualsTester
+import com.google.common.truth.Truth.assertThat
+import kotlin.test.assertFailsWith
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+@OptIn(OnlyForUseByGeneratedProtoCode::class)
+class DslMapTest {
+ class DummyProxy private constructor() : DslProxy()
+
+ @Test
+ fun matchesMap() {
+ assertThat(DslMap<Int, Int, DummyProxy>(mapOf(1 to -1, 2 to -2)))
+ .containsExactly(1, -1, 2, -2)
+ }
+
+ @Test
+ fun reflectsChangesInMap() {
+ val mutableMap = mutableMapOf(1 to -1, 2 to -2)
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMap)
+ mutableMap[3] = -3
+ assertThat(dslMap).containsExactly(1, -1, 2, -2, 3, -3).inOrder()
+ }
+
+ @Test
+ fun dslMapIsNotMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ assertThat(dslMap is MutableMap<*, *>).isFalse()
+ }
+
+ @Test
+ fun dslMapKeysAreNotMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ assertThat(dslMap.keys is MutableSet<*>).isFalse()
+ }
+
+ @Test
+ fun dslMapValuesAreNotMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ assertThat(dslMap.values is MutableSet<*>).isFalse()
+ }
+
+ @Test
+ fun dslMapEntriesAreNotMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ assertThat(dslMap.entries is MutableSet<*>).isFalse()
+ }
+
+ @Test
+ fun dslMapEntryObjectsAreNotMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ assertThat(dslMap.entries.single() is MutableMap.MutableEntry<*, *>).isFalse()
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapIsNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapAsJavaUtilMap = dslMap as java.util.Map<Int, Int>
+ assertFailsWith<UnsupportedOperationException> {
+ dslMapAsJavaUtilMap.put(2, -2)
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapKeysAreNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapKeysAsJavaUtilSet = dslMap.keys as java.util.Set<Int>
+ assertFailsWith<UnsupportedOperationException> {
+ dslMapKeysAsJavaUtilSet.remove(1)
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapKeysIteratorIsNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapKeysAsJavaUtilSet = dslMap.keys as java.util.Set<Int>
+ val itr = dslMapKeysAsJavaUtilSet.iterator()
+ itr.next()
+ assertFailsWith<UnsupportedOperationException> {
+ itr.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapValuesAreNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapValuesAsJavaUtilCollection = dslMap.values as java.util.Collection<Int>
+ assertFailsWith<UnsupportedOperationException> {
+ dslMapValuesAsJavaUtilCollection.remove(1)
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapValuesIteratorIsNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapValuesAsJavaUtilCollection = dslMap.values as java.util.Collection<Int>
+ val itr = dslMapValuesAsJavaUtilCollection.iterator()
+ itr.next()
+ assertFailsWith<UnsupportedOperationException> {
+ itr.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapEntriesAreNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapEntriesAsJavaUtilSet = dslMap.entries as java.util.Set<Map.Entry<Int, Int>>
+ val entry = dslMap.entries.single()
+ assertFailsWith<UnsupportedOperationException> {
+ dslMapEntriesAsJavaUtilSet.remove(entry)
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapEntriesIteratorIsNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapEntriesAsJavaUtilSet = dslMap.entries as java.util.Set<Map.Entry<Int, Int>>
+ val itr = dslMapEntriesAsJavaUtilSet.iterator()
+ itr.next()
+ assertFailsWith<UnsupportedOperationException> {
+ itr.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun dslMapEntryObjectsAreNotEvenSecretlyMutable() {
+ val dslMap = DslMap<Int, Int, DummyProxy>(mutableMapOf(1 to -1))
+ val dslMapEntryAsJavaUtilMapEntry = dslMap.entries.single() as java.util.Map.Entry<Int, Int>
+ assertFailsWith<UnsupportedOperationException> {
+ dslMapEntryAsJavaUtilMapEntry.value = 2
+ }
+ }
+
+ @Test
+ fun expectedToString() {
+ assertThat(DslMap<Int, Int, DummyProxy>(mapOf(1 to 2, 2 to 3)).toString())
+ .isEqualTo("{1=2, 2=3}")
+ }
+
+ @Test
+ fun equality() {
+ EqualsTester()
+ .addEqualityGroup(DslMap<Int, Int, DummyProxy>(mapOf(1 to 2, 2 to 3)), mapOf(1 to 2, 2 to 3))
+ .addEqualityGroup(DslMap<Int, Int, DummyProxy>(mapOf(1 to 3, 2 to 3)), mapOf(1 to 3, 2 to 3))
+ .addEqualityGroup(
+ DslMap<Int, Int, DummyProxy>(emptyMap()),
+ DslMap<String, String, DummyProxy>(emptyMap()),
+ emptyMap<Int, Int>()
+ )
+ .testEquals()
+ }
+}
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt
new file mode 100644
index 0000000..c8816eb
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/ExtendableMessageExtensionsTest.kt
@@ -0,0 +1,60 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.truth.Truth.assertThat
+import example_extensible_message.ExampleExtensibleMessage
+import example_extensible_message.ExampleExtensibleMessageOuterClass as TestProto
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class ExtendableMessageExtensionsTest {
+ @Test
+ fun setOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ builder[TestProto.int32Extension] = 5
+ assertThat(builder.build().getExtension(TestProto.int32Extension)).isEqualTo(5)
+ }
+
+ @Test
+ fun getOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ assertThat(builder[TestProto.int32Extension]).isEqualTo(6)
+ }
+
+ @Test
+ fun getOnMessage() {
+ val message = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ .build()
+ assertThat(message[TestProto.int32Extension]).isEqualTo(6)
+ }
+
+ @Test
+ fun containsPositiveOnMessage() {
+ val message = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ .build()
+ assertThat(TestProto.int32Extension in message).isTrue()
+ }
+
+ @Test
+ fun containsPositiveOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ .setExtension(TestProto.int32Extension, 6)
+ assertThat(TestProto.int32Extension in builder).isTrue()
+ }
+
+ @Test
+ fun containsNegativeOnMessage() {
+ val message = ExampleExtensibleMessage.newBuilder().build()
+ assertThat(TestProto.int32Extension in message).isFalse()
+ }
+
+ @Test
+ fun containsNegativeOnBuilder() {
+ val builder = ExampleExtensibleMessage.newBuilder()
+ assertThat(TestProto.int32Extension in builder).isFalse()
+ }
+}
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt
new file mode 100644
index 0000000..e805e1e
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/ExtensionListTest.kt
@@ -0,0 +1,125 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.testing.EqualsTester
+import com.google.common.truth.Truth.assertThat
+import example_extensible_message.ExampleExtensibleMessage
+import example_extensible_message.ExampleExtensibleMessageOuterClass as TestProto
+import kotlin.test.assertFailsWith
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Tests for [DslList]. */
+@RunWith(JUnit4::class)
+@OptIn(OnlyForUseByGeneratedProtoCode::class)
+class ExtensionListTest {
+ class DummyProxy private constructor() : DslProxy()
+
+ @Test
+ fun matchesList() {
+ assertThat(
+ ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, listOf(1, 2, 3)
+ )
+ ).containsExactly(1, 2, 3).inOrder()
+ }
+
+ @Test
+ fun reflectsChangesInList() {
+ val mutableList = mutableListOf(1, 2, 3)
+ val extensionList = ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, mutableList
+ )
+ mutableList.add(4)
+ assertThat(extensionList).containsExactly(1, 2, 3, 4).inOrder()
+ }
+
+ @Test
+ fun extensionListIsNotMutable() {
+ val extensionList = ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, mutableListOf(1, 2, 3)
+ )
+ assertThat(extensionList is MutableList<*>).isFalse()
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun extensionListIsNotEvenSecretlyMutable() {
+ val extensionList = ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, mutableListOf(1, 2, 3)
+ )
+ val extensionListAsJavaUtil = extensionList as java.util.List<Int>
+ assertFailsWith<UnsupportedOperationException> {
+ extensionListAsJavaUtil.add(4)
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun extensionList_IteratorIsNotEvenSecretlyMutable() {
+ val extensionList = ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, mutableListOf(1, 2, 3)
+ )
+ val iterator = extensionList.iterator() as java.util.Iterator<Int>
+ iterator.next()
+
+ assertFailsWith<UnsupportedOperationException> {
+ iterator.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun extensionList_ListIteratorIsNotEvenSecretlyMutable() {
+ val extensionList = ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, mutableListOf(1, 2, 3)
+ )
+ val iterator = extensionList.listIterator() as java.util.ListIterator<Int>
+ iterator.next()
+
+ assertFailsWith<UnsupportedOperationException> {
+ iterator.remove()
+ }
+ }
+
+ @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN", "UNCHECKED_CAST")
+ @Test
+ fun extensionList_ListIteratorIndexIsNotEvenSecretlyMutable() {
+ val extensionList = ExtensionList<Int, ExampleExtensibleMessage>(
+ TestProto.repeatedExtension, mutableListOf(1, 2, 3)
+ )
+ val iterator = extensionList.listIterator(1) as java.util.ListIterator<Int>
+ iterator.next()
+
+ assertFailsWith<UnsupportedOperationException> {
+ iterator.remove()
+ }
+ }
+
+ @Test
+ fun expectedToString() {
+ assertThat(
+ ExtensionList<Int, ExampleExtensibleMessage>(TestProto.repeatedExtension, listOf(1, 2))
+ .toString()
+ ).isEqualTo("[1, 2]")
+ }
+
+ @Test
+ fun equality() {
+ EqualsTester()
+ .addEqualityGroup(
+ ExtensionList<Int, ExampleExtensibleMessage>(TestProto.repeatedExtension, listOf(1, 2)),
+ ExtensionList<Int, ExampleExtensibleMessage>(TestProto.differentExtension, listOf(1, 2)),
+ listOf(1, 2)
+ )
+ .addEqualityGroup(
+ ExtensionList<Int, ExampleExtensibleMessage>(TestProto.repeatedExtension, listOf(2, 2)),
+ listOf(2, 2)
+ )
+ .addEqualityGroup(
+ ExtensionList<Int, ExampleExtensibleMessage>(TestProto.repeatedExtension, emptyList()),
+ emptyList<Int>()
+ )
+ .testEquals()
+ }
+}
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
new file mode 100644
index 0000000..72b9792
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
@@ -0,0 +1,891 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.truth.Truth.assertThat
+import com.google.protobuf.TestUtil
+import com.google.protobuf.TestUtil.toBytes
+import evil_names_proto2.EvilNamesProto2OuterClass.EvilNamesProto2
+import evil_names_proto2.EvilNamesProto2OuterClass.HardKeywordsAllTypes
+import evil_names_proto2.EvilNamesProto2OuterClass.Interface
+import evil_names_proto2.HardKeywordsAllTypesKt
+import evil_names_proto2.evilNamesProto2
+import evil_names_proto2.hardKeywordsAllTypes
+import evil_names_proto2.interface_
+import com.google.protobuf.test.UnittestImport.ImportEnum
+import com.google.protobuf.test.UnittestImport.ImportMessage
+import com.google.protobuf.test.UnittestImportPublic.PublicImportMessage
+import protobuf_unittest.MapProto2Unittest.Proto2MapEnum
+import protobuf_unittest.MapProto2Unittest.TestEnumMap
+import protobuf_unittest.MapProto2Unittest.TestIntIntMap
+import protobuf_unittest.MapProto2Unittest.TestMaps
+import protobuf_unittest.TestAllTypesKt
+import protobuf_unittest.TestAllTypesKt.nestedMessage
+import protobuf_unittest.UnittestProto
+import protobuf_unittest.UnittestProto.ForeignEnum
+import protobuf_unittest.UnittestProto.TestAllTypes
+import protobuf_unittest.UnittestProto.TestAllTypes.NestedEnum
+import protobuf_unittest.UnittestProto.TestEmptyMessage
+import protobuf_unittest.UnittestProto.TestEmptyMessageWithExtensions
+import protobuf_unittest.copy
+import protobuf_unittest.foreignMessage
+import protobuf_unittest.optionalGroupExtension
+import protobuf_unittest.repeatedGroupExtension
+import protobuf_unittest.testAllExtensions
+import protobuf_unittest.testAllTypes
+import protobuf_unittest.testEmptyMessage
+import protobuf_unittest.testEmptyMessageWithExtensions
+import protobuf_unittest.testEnumMap
+import protobuf_unittest.testIntIntMap
+import protobuf_unittest.testMaps
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class Proto2Test {
+ @Test
+ fun testSetters() {
+ assertThat(
+ testAllTypes {
+ optionalInt32 = 101
+ optionalInt64 = 102
+ optionalUint32 = 103
+ optionalUint64 = 104
+ optionalSint32 = 105
+ optionalSint64 = 106
+ optionalFixed32 = 107
+ optionalFixed64 = 108
+ optionalSfixed32 = 109
+ optionalSfixed64 = 110
+ optionalFloat = 111.0f
+ optionalDouble = 112.0
+ optionalBool = true
+ optionalString = "115"
+ optionalBytes = toBytes("116")
+ optionalGroup =
+ TestAllTypesKt.optionalGroup { a = 117 }
+ optionalNestedMessage = nestedMessage { bb = 118 }
+ optionalForeignMessage = foreignMessage { c = 119 }
+ optionalImportMessage =
+ ImportMessage.newBuilder().setD(120).build()
+ optionalPublicImportMessage =
+ PublicImportMessage.newBuilder().setE(126).build()
+ optionalLazyMessage = nestedMessage { bb = 127 }
+ optionalNestedEnum = NestedEnum.BAZ
+ optionalForeignEnum = ForeignEnum.FOREIGN_BAZ
+ optionalImportEnum = ImportEnum.IMPORT_BAZ
+ optionalStringPiece = "124"
+ optionalCord = "125"
+ repeatedInt32.add(201)
+ repeatedInt64.add(202)
+ repeatedUint32.add(203)
+ repeatedUint64.add(204)
+ repeatedSint32.add(205)
+ repeatedSint64.add(206)
+ repeatedFixed32.add(207)
+ repeatedFixed64.add(208)
+ repeatedSfixed32.add(209)
+ repeatedSfixed64.add(210)
+ repeatedFloat.add(211f)
+ repeatedDouble.add(212.0)
+ repeatedBool.add(true)
+ repeatedString.add("215")
+ repeatedBytes.add(toBytes("216"))
+ repeatedGroup.add(TestAllTypesKt.repeatedGroup { a = 217 })
+ repeatedNestedMessage.add(nestedMessage { bb = 218 })
+ repeatedForeignMessage.add(foreignMessage { c = 219 })
+ repeatedImportMessage.add(
+ ImportMessage.newBuilder().setD(220).build()
+ )
+ repeatedLazyMessage.add(nestedMessage { bb = 227 })
+ repeatedNestedEnum.add(NestedEnum.BAR)
+ repeatedForeignEnum.add(ForeignEnum.FOREIGN_BAR)
+ repeatedImportEnum.add(ImportEnum.IMPORT_BAR)
+ repeatedStringPiece.add("224")
+ repeatedCord.add("225")
+ repeatedInt32 += 301
+ repeatedInt64 += 302
+ repeatedUint32 += 303
+ repeatedUint64 += 304
+ repeatedSint32 += 305
+ repeatedSint64 += 306
+ repeatedFixed32 += 307
+ repeatedFixed64 += 308
+ repeatedSfixed32 += 309
+ repeatedSfixed64 += 310
+ repeatedFloat += 311f
+ repeatedDouble += 312.0
+ repeatedBool += false
+ repeatedString += "315"
+ repeatedBytes += toBytes("316")
+ repeatedGroup += TestAllTypesKt.repeatedGroup { a = 317 }
+ repeatedNestedMessage += nestedMessage { bb = 318 }
+ repeatedForeignMessage += foreignMessage { c = 319 }
+ repeatedImportMessage +=
+ ImportMessage.newBuilder().setD(320).build()
+ repeatedLazyMessage +=
+ TestAllTypesKt.nestedMessage { bb = 327 }
+ repeatedNestedEnum += NestedEnum.BAZ
+ repeatedForeignEnum += ForeignEnum.FOREIGN_BAZ
+ repeatedImportEnum += ImportEnum.IMPORT_BAZ
+ repeatedStringPiece += "324"
+ repeatedCord += "325"
+ defaultInt32 = 401
+ defaultInt64 = 402
+ defaultUint32 = 403
+ defaultUint64 = 404
+ defaultSint32 = 405
+ defaultSint64 = 406
+ defaultFixed32 = 407
+ defaultFixed64 = 408
+ defaultSfixed32 = 409
+ defaultSfixed64 = 410
+ defaultFloat = 411f
+ defaultDouble = 412.0
+ defaultBool = false
+ defaultString = "415"
+ defaultBytes = toBytes("416")
+ defaultNestedEnum = NestedEnum.FOO
+ defaultForeignEnum = ForeignEnum.FOREIGN_FOO
+ defaultImportEnum = ImportEnum.IMPORT_FOO
+ defaultStringPiece = "424"
+ defaultCord = "425"
+ oneofUint32 = 601
+ oneofNestedMessage =
+ TestAllTypesKt.nestedMessage { bb = 602 }
+ oneofString = "603"
+ oneofBytes = toBytes("604")
+ }
+ ).isEqualTo(
+ TestUtil.getAllSetBuilder().build()
+ )
+ }
+
+ @Test
+ fun testGetters() {
+ testAllTypes {
+ optionalInt32 = 101
+ assertThat(optionalInt32).isEqualTo(101)
+ optionalString = "115"
+ assertThat(optionalString).isEqualTo("115")
+ optionalGroup = TestAllTypesKt.optionalGroup { a = 117 }
+ assertThat(optionalGroup).isEqualTo(TestAllTypesKt.optionalGroup { a = 117 })
+ optionalNestedMessage = TestAllTypesKt.nestedMessage { bb = 118 }
+ assertThat(optionalNestedMessage).isEqualTo(TestAllTypesKt.nestedMessage { bb = 118 })
+ optionalNestedEnum = NestedEnum.BAZ
+ assertThat(optionalNestedEnum).isEqualTo(NestedEnum.BAZ)
+ defaultInt32 = 401
+ assertThat(defaultInt32).isEqualTo(401)
+ oneofUint32 = 601
+ assertThat(oneofUint32).isEqualTo(601)
+ }
+ }
+
+ @Test
+ fun testDefaultGetters() {
+ testAllTypes {
+ assertThat(defaultInt32).isEqualTo(41)
+ assertThat(defaultString).isEqualTo("hello")
+ assertThat(defaultNestedEnum).isEqualTo(NestedEnum.BAR)
+ assertThat(defaultStringPiece).isEqualTo("abc")
+ }
+ }
+
+ @Test
+ fun testRepeatedGettersAndSetters() {
+ testAllTypes {
+ repeatedInt32.addAll(listOf(1, 2))
+ assertThat(repeatedInt32).isEqualTo(listOf(1, 2))
+ repeatedInt32 += listOf(3, 4)
+ assertThat(repeatedInt32).isEqualTo(listOf(1, 2, 3, 4))
+ repeatedInt32[0] = 5
+ assertThat(repeatedInt32).isEqualTo(listOf(5, 2, 3, 4))
+
+ repeatedString.addAll(listOf("1", "2"))
+ assertThat(repeatedString).isEqualTo(listOf("1", "2"))
+ repeatedString += listOf("3", "4")
+ assertThat(repeatedString).isEqualTo(listOf("1", "2", "3", "4"))
+ repeatedString[0] = "5"
+ assertThat(repeatedString).isEqualTo(listOf("5", "2", "3", "4"))
+
+ repeatedGroup.addAll(
+ listOf(
+ TestAllTypesKt.repeatedGroup { a = 1 },
+ TestAllTypesKt.repeatedGroup { a = 2 }
+ )
+ )
+ assertThat(repeatedGroup).isEqualTo(
+ listOf(
+ TestAllTypesKt.repeatedGroup { a = 1 },
+ TestAllTypesKt.repeatedGroup { a = 2 }
+ )
+ )
+ repeatedGroup +=
+ listOf(
+ TestAllTypesKt.repeatedGroup { a = 3 },
+ TestAllTypesKt.repeatedGroup { a = 4 }
+ )
+ assertThat(repeatedGroup).isEqualTo(
+ listOf(
+ TestAllTypesKt.repeatedGroup { a = 1 },
+ TestAllTypesKt.repeatedGroup { a = 2 },
+ TestAllTypesKt.repeatedGroup { a = 3 },
+ TestAllTypesKt.repeatedGroup { a = 4 }
+ )
+ )
+ repeatedGroup[0] = TestAllTypesKt.repeatedGroup { a = 5 }
+ assertThat(repeatedGroup).isEqualTo(
+ listOf(
+ TestAllTypesKt.repeatedGroup { a = 5 },
+ TestAllTypesKt.repeatedGroup { a = 2 },
+ TestAllTypesKt.repeatedGroup { a = 3 },
+ TestAllTypesKt.repeatedGroup { a = 4 }
+ )
+ )
+
+ repeatedNestedMessage.addAll(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 }
+ )
+ )
+ repeatedNestedMessage += listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+ repeatedNestedMessage[0] = nestedMessage { bb = 5 }
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 5 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+
+ repeatedNestedEnum.addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ assertThat(repeatedNestedEnum).isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ repeatedNestedEnum += listOf(NestedEnum.BAZ, NestedEnum.FOO)
+ assertThat(repeatedNestedEnum).isEqualTo(
+ listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ repeatedNestedEnum[0] = NestedEnum.BAR
+ assertThat(repeatedNestedEnum).isEqualTo(
+ listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ }
+ }
+
+ @Test
+ fun testHazzers() {
+ testAllTypes {
+ optionalInt32 = 101
+ assertThat(hasOptionalInt32()).isTrue()
+ assertThat(hasOptionalString()).isFalse()
+ optionalGroup = TestAllTypesKt.optionalGroup { a = 117 }
+ assertThat(hasOptionalGroup()).isTrue()
+ assertThat(hasOptionalNestedMessage()).isFalse()
+ optionalNestedEnum = NestedEnum.BAZ
+ assertThat(hasOptionalNestedEnum()).isTrue()
+ assertThat(hasDefaultInt32()).isFalse()
+ oneofUint32 = 601
+ assertThat(hasOneofUint32()).isTrue()
+ }
+
+ testAllTypes {
+ assertThat(hasOptionalInt32()).isFalse()
+ optionalString = "115"
+ assertThat(hasOptionalString()).isTrue()
+ assertThat(hasOptionalGroup()).isFalse()
+ optionalNestedMessage = TestAllTypesKt.nestedMessage { bb = 118 }
+ assertThat(hasOptionalNestedMessage()).isTrue()
+ assertThat(hasOptionalNestedEnum()).isFalse()
+ defaultInt32 = 401
+ assertThat(hasDefaultInt32()).isTrue()
+ assertThat(hasOneofUint32()).isFalse()
+ }
+ }
+
+ @Test
+ fun testClears() {
+ testAllTypes {
+ optionalInt32 = 101
+ clearOptionalInt32()
+ assertThat(hasOptionalInt32()).isFalse()
+
+ optionalString = "115"
+ clearOptionalString()
+ assertThat(hasOptionalString()).isFalse()
+
+ optionalGroup = TestAllTypesKt.optionalGroup { a = 117 }
+ clearOptionalGroup()
+ assertThat(hasOptionalGroup()).isFalse()
+
+ optionalNestedMessage = TestAllTypesKt.nestedMessage { bb = 118 }
+ clearOptionalNestedMessage()
+ assertThat(hasOptionalNestedMessage()).isFalse()
+
+ optionalNestedEnum = NestedEnum.BAZ
+ clearOptionalNestedEnum()
+ assertThat(hasOptionalNestedEnum()).isFalse()
+
+ defaultInt32 = 401
+ clearDefaultInt32()
+ assertThat(hasDefaultInt32()).isFalse()
+
+ oneofUint32 = 601
+ clearOneofUint32()
+ assertThat(hasOneofUint32()).isFalse()
+ }
+ }
+
+ @Test
+ fun testCopy() {
+ val message = testAllTypes {
+ optionalInt32 = 101
+ optionalString = "115"
+ }
+ val modifiedMessage = message.copy {
+ optionalInt32 = 201
+ }
+
+ assertThat(message).isEqualTo(
+ TestAllTypes.newBuilder()
+ .setOptionalInt32(101)
+ .setOptionalString("115")
+ .build()
+ )
+ assertThat(modifiedMessage).isEqualTo(
+ TestAllTypes.newBuilder()
+ .setOptionalInt32(201)
+ .setOptionalString("115")
+ .build()
+ )
+ }
+
+ @Test
+ fun testOneof() {
+ val message = testAllTypes {
+ oneofString = "foo"
+ assertThat(oneofFieldCase)
+ .isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_STRING)
+ assertThat(oneofString).isEqualTo("foo")
+ clearOneofField()
+ assertThat(hasOneofUint32()).isFalse()
+ assertThat(oneofFieldCase)
+ .isEqualTo(TestAllTypes.OneofFieldCase.ONEOFFIELD_NOT_SET)
+ oneofUint32 = 5
+ }
+
+ assertThat(message.getOneofFieldCase())
+ .isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_UINT32)
+ assertThat(message.getOneofUint32()).isEqualTo(5)
+ }
+
+ @Test
+ fun testExtensionsSet() {
+ assertThat(
+ testAllExtensions {
+ this[UnittestProto.optionalInt32Extension] = 101
+ this[UnittestProto.optionalInt64Extension] = 102L
+ this[UnittestProto.optionalUint32Extension] = 103
+ this[UnittestProto.optionalUint64Extension] = 104L
+ this[UnittestProto.optionalSint32Extension] = 105
+ this[UnittestProto.optionalSint64Extension] = 106L
+ this[UnittestProto.optionalFixed32Extension] = 107
+ this[UnittestProto.optionalFixed64Extension] = 108L
+ this[UnittestProto.optionalSfixed32Extension] = 109
+ this[UnittestProto.optionalSfixed64Extension] = 110L
+ this[UnittestProto.optionalFloatExtension] = 111F
+ this[UnittestProto.optionalDoubleExtension] = 112.0
+ this[UnittestProto.optionalBoolExtension] = true
+ this[UnittestProto.optionalStringExtension] = "115"
+ this[UnittestProto.optionalBytesExtension] = toBytes("116")
+ this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
+ this[UnittestProto.optionalNestedMessageExtension] =
+ TestAllTypesKt.nestedMessage { bb = 118 }
+ this[UnittestProto.optionalForeignMessageExtension] = foreignMessage { c = 119 }
+ this[UnittestProto.optionalImportMessageExtension] =
+ ImportMessage.newBuilder().setD(120).build()
+ this[UnittestProto.optionalPublicImportMessageExtension] =
+ PublicImportMessage.newBuilder().setE(126).build()
+ this[UnittestProto.optionalLazyMessageExtension] = TestAllTypesKt.nestedMessage { bb = 127 }
+ this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
+ this[UnittestProto.optionalForeignEnumExtension] = ForeignEnum.FOREIGN_BAZ
+ this[UnittestProto.optionalImportEnumExtension] = ImportEnum.IMPORT_BAZ
+ this[UnittestProto.optionalStringPieceExtension] = "124"
+ this[UnittestProto.optionalCordExtension] = "125"
+ this[UnittestProto.repeatedInt32Extension].add(201)
+ this[UnittestProto.repeatedInt64Extension].add(202L)
+ this[UnittestProto.repeatedUint32Extension].add(203)
+ this[UnittestProto.repeatedUint64Extension].add(204L)
+ this[UnittestProto.repeatedSint32Extension].add(205)
+ this[UnittestProto.repeatedSint64Extension].add(206L)
+ this[UnittestProto.repeatedFixed32Extension].add(207)
+ this[UnittestProto.repeatedFixed64Extension].add(208L)
+ this[UnittestProto.repeatedSfixed32Extension].add(209)
+ this[UnittestProto.repeatedSfixed64Extension].add(210L)
+ this[UnittestProto.repeatedFloatExtension].add(211F)
+ this[UnittestProto.repeatedDoubleExtension].add(212.0)
+ this[UnittestProto.repeatedBoolExtension].add(true)
+ this[UnittestProto.repeatedStringExtension].add("215")
+ this[UnittestProto.repeatedBytesExtension].add(toBytes("216"))
+ this[UnittestProto.repeatedGroupExtension].add(repeatedGroupExtension { a = 217 })
+ this[UnittestProto.repeatedNestedMessageExtension]
+ .add(TestAllTypesKt.nestedMessage { bb = 218 })
+ this[UnittestProto.repeatedForeignMessageExtension].add(foreignMessage { c = 219 })
+ this[UnittestProto.repeatedImportMessageExtension]
+ .add(ImportMessage.newBuilder().setD(220).build())
+ this[UnittestProto.repeatedLazyMessageExtension]
+ .add(TestAllTypesKt.nestedMessage { bb = 227 })
+ this[UnittestProto.repeatedNestedEnumExtension].add(NestedEnum.BAR)
+ this[UnittestProto.repeatedForeignEnumExtension].add(ForeignEnum.FOREIGN_BAR)
+ this[UnittestProto.repeatedImportEnumExtension].add(ImportEnum.IMPORT_BAR)
+ this[UnittestProto.repeatedStringPieceExtension].add("224")
+ this[UnittestProto.repeatedCordExtension].add("225")
+ this[UnittestProto.repeatedInt32Extension].add(301)
+ this[UnittestProto.repeatedInt64Extension].add(302L)
+ this[UnittestProto.repeatedUint32Extension].add(303)
+ this[UnittestProto.repeatedUint64Extension].add(304L)
+ this[UnittestProto.repeatedSint32Extension].add(305)
+ this[UnittestProto.repeatedSint64Extension].add(306L)
+ this[UnittestProto.repeatedFixed32Extension].add(307)
+ this[UnittestProto.repeatedFixed64Extension].add(308L)
+ this[UnittestProto.repeatedSfixed32Extension].add(309)
+ this[UnittestProto.repeatedSfixed64Extension].add(310L)
+ this[UnittestProto.repeatedFloatExtension].add(311F)
+ this[UnittestProto.repeatedDoubleExtension].add(312.0)
+ this[UnittestProto.repeatedBoolExtension].add(false)
+ this[UnittestProto.repeatedStringExtension].add("315")
+ this[UnittestProto.repeatedBytesExtension].add(toBytes("316"))
+ this[UnittestProto.repeatedGroupExtension].add(repeatedGroupExtension { a = 317 })
+ this[UnittestProto.repeatedNestedMessageExtension]
+ .add(TestAllTypesKt.nestedMessage { bb = 318 })
+ this[UnittestProto.repeatedForeignMessageExtension].add(foreignMessage { c = 319 })
+ this[UnittestProto.repeatedImportMessageExtension]
+ .add(ImportMessage.newBuilder().setD(320).build())
+ this[UnittestProto.repeatedLazyMessageExtension]
+ .add(TestAllTypesKt.nestedMessage { bb = 327 })
+ this[UnittestProto.repeatedNestedEnumExtension].add(NestedEnum.BAZ)
+ this[UnittestProto.repeatedForeignEnumExtension].add(ForeignEnum.FOREIGN_BAZ)
+ this[UnittestProto.repeatedImportEnumExtension].add(ImportEnum.IMPORT_BAZ)
+ this[UnittestProto.repeatedStringPieceExtension].add("324")
+ this[UnittestProto.repeatedCordExtension].add("325")
+ this[UnittestProto.defaultInt32Extension] = 401
+ this[UnittestProto.defaultInt64Extension] = 402L
+ this[UnittestProto.defaultUint32Extension] = 403
+ this[UnittestProto.defaultUint64Extension] = 404L
+ this[UnittestProto.defaultSint32Extension] = 405
+ this[UnittestProto.defaultSint64Extension] = 406L
+ this[UnittestProto.defaultFixed32Extension] = 407
+ this[UnittestProto.defaultFixed64Extension] = 408L
+ this[UnittestProto.defaultSfixed32Extension] = 409
+ this[UnittestProto.defaultSfixed64Extension] = 410L
+ this[UnittestProto.defaultFloatExtension] = 411F
+ this[UnittestProto.defaultDoubleExtension] = 412.0
+ this[UnittestProto.defaultBoolExtension] = false
+ this[UnittestProto.defaultStringExtension] = "415"
+ this[UnittestProto.defaultBytesExtension] = toBytes("416")
+ this[UnittestProto.defaultNestedEnumExtension] = NestedEnum.FOO
+ this[UnittestProto.defaultForeignEnumExtension] = ForeignEnum.FOREIGN_FOO
+ this[UnittestProto.defaultImportEnumExtension] = ImportEnum.IMPORT_FOO
+ this[UnittestProto.defaultStringPieceExtension] = "424"
+ this[UnittestProto.defaultCordExtension] = "425"
+ this[UnittestProto.oneofUint32Extension] = 601
+ this[UnittestProto.oneofNestedMessageExtension] = TestAllTypesKt.nestedMessage { bb = 602 }
+ this[UnittestProto.oneofStringExtension] = "603"
+ this[UnittestProto.oneofBytesExtension] = toBytes("604")
+ }
+ ).isEqualTo(
+ TestUtil.getAllExtensionsSet()
+ )
+ }
+
+ @Test
+ fun testExtensionGetters() {
+ testAllExtensions {
+ this[UnittestProto.optionalInt32Extension] = 101
+ assertThat(this[UnittestProto.optionalInt32Extension]).isEqualTo(101)
+ this[UnittestProto.optionalStringExtension] = "115"
+ assertThat(this[UnittestProto.optionalStringExtension]).isEqualTo("115")
+ this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
+ assertThat(this[UnittestProto.optionalGroupExtension])
+ .isEqualTo(optionalGroupExtension { a = 117 })
+ this[UnittestProto.optionalNestedMessageExtension] =
+ TestAllTypesKt.nestedMessage { bb = 118 }
+ assertThat(this[UnittestProto.optionalNestedMessageExtension])
+ .isEqualTo(TestAllTypesKt.nestedMessage { bb = 118 })
+ this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
+ assertThat(this[UnittestProto.optionalNestedEnumExtension]).isEqualTo(NestedEnum.BAZ)
+ this[UnittestProto.defaultInt32Extension] = 401
+ assertThat(this[UnittestProto.defaultInt32Extension]).isEqualTo(401)
+ this[UnittestProto.oneofUint32Extension] = 601
+ assertThat(this[UnittestProto.oneofUint32Extension]).isEqualTo(601)
+ }
+ }
+
+ @Test
+ fun testExtensionContains() {
+ testAllExtensions {
+ this[UnittestProto.optionalInt32Extension] = 101
+ assertThat(contains(UnittestProto.optionalInt32Extension)).isTrue()
+ assertThat(contains(UnittestProto.optionalStringExtension)).isFalse()
+ this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
+ assertThat(contains(UnittestProto.optionalGroupExtension)).isTrue()
+ assertThat(contains(UnittestProto.optionalNestedMessageExtension)).isFalse()
+ this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
+ assertThat(contains(UnittestProto.optionalNestedEnumExtension)).isTrue()
+ assertThat(contains(UnittestProto.defaultInt32Extension)).isFalse()
+ this[UnittestProto.oneofUint32Extension] = 601
+ assertThat(contains(UnittestProto.optionalInt32Extension)).isTrue()
+ }
+
+ testAllExtensions {
+ assertThat(contains(UnittestProto.optionalInt32Extension)).isFalse()
+ this[UnittestProto.optionalStringExtension] = "115"
+ assertThat(contains(UnittestProto.optionalStringExtension)).isTrue()
+ assertThat(contains(UnittestProto.optionalGroupExtension)).isFalse()
+ this[UnittestProto.optionalNestedMessageExtension] =
+ TestAllTypesKt.nestedMessage { bb = 118 }
+ assertThat(contains(UnittestProto.optionalNestedMessageExtension)).isTrue()
+ assertThat(contains(UnittestProto.optionalNestedEnumExtension)).isFalse()
+ this[UnittestProto.defaultInt32Extension] = 401
+ assertThat(contains(UnittestProto.defaultInt32Extension)).isTrue()
+ assertThat(contains(UnittestProto.oneofUint32Extension)).isFalse()
+ }
+ }
+
+ @Test
+ fun testExtensionClears() {
+ testAllExtensions {
+ this[UnittestProto.optionalInt32Extension] = 101
+ clear(UnittestProto.optionalInt32Extension)
+ assertThat(contains(UnittestProto.optionalInt32Extension)).isFalse()
+
+ this[UnittestProto.optionalStringExtension] = "115"
+ clear(UnittestProto.optionalStringExtension)
+ assertThat(contains(UnittestProto.optionalStringExtension)).isFalse()
+
+ this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
+ clear(UnittestProto.optionalGroupExtension)
+ assertThat(contains(UnittestProto.optionalGroupExtension)).isFalse()
+
+ this[UnittestProto.optionalNestedMessageExtension] =
+ TestAllTypesKt.nestedMessage { bb = 118 }
+ clear(UnittestProto.optionalNestedMessageExtension)
+ assertThat(contains(UnittestProto.optionalNestedMessageExtension)).isFalse()
+
+ this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
+ clear(UnittestProto.optionalNestedEnumExtension)
+ assertThat(contains(UnittestProto.optionalNestedEnumExtension)).isFalse()
+
+ this[UnittestProto.defaultInt32Extension] = 401
+ clear(UnittestProto.defaultInt32Extension)
+ assertThat(contains(UnittestProto.oneofUint32Extension)).isFalse()
+ }
+ }
+
+ @Test
+ fun testEmptyMessages() {
+ assertThat(
+ testEmptyMessage {}
+ ).isEqualTo(
+ TestEmptyMessage.newBuilder().build()
+ )
+
+ assertThat(
+ testEmptyMessageWithExtensions {}
+ ).isEqualTo(
+ TestEmptyMessageWithExtensions.newBuilder().build()
+ )
+ }
+
+ @Test
+ fun testMapSetters() {
+ val intMap = testIntIntMap { m[1] = 2 }
+ assertThat(intMap).isEqualTo(
+ TestIntIntMap.newBuilder().putM(1, 2).build()
+ )
+
+ assertThat(
+ testMaps {
+ mInt32[1] = intMap
+ mInt64[1L] = intMap
+ mUint32[1] = intMap
+ mUint64[1L] = intMap
+ mSint32[1] = intMap
+ mSint64[1L] = intMap
+ mFixed32[1] = intMap
+ mFixed64[1L] = intMap
+ mSfixed32[1] = intMap
+ mSfixed64[1] = intMap
+ mBool[true] = intMap
+ mString["1"] = intMap
+ }
+ ).isEqualTo(
+ TestMaps.newBuilder()
+ .putMInt32(1, intMap)
+ .putMInt64(1L, intMap)
+ .putMUint32(1, intMap)
+ .putMUint64(1L, intMap)
+ .putMSint32(1, intMap)
+ .putMSint64(1L, intMap)
+ .putMFixed32(1, intMap)
+ .putMFixed64(1L, intMap)
+ .putMSfixed32(1, intMap)
+ .putMSfixed64(1L, intMap)
+ .putMBool(true, intMap)
+ .putMString("1", intMap)
+ .build()
+ )
+
+ assertThat(
+ testEnumMap {
+ knownMapField[1] = Proto2MapEnum.PROTO2_MAP_ENUM_FOO
+ }
+ ).isEqualTo(
+ TestEnumMap.newBuilder()
+ .putKnownMapField(1, Proto2MapEnum.PROTO2_MAP_ENUM_FOO)
+ .build()
+ )
+ }
+
+ @Test
+ fun testMapGettersAndSetters() {
+ val intMap =
+ testIntIntMap {
+ m.put(1, 2)
+ assertThat(m).isEqualTo(mapOf(1 to 2))
+ m[3] = 4
+ assertThat(m).isEqualTo(mapOf(1 to 2, 3 to 4))
+ m.putAll(mapOf(5 to 6, 7 to 8))
+ assertThat(m).isEqualTo(mapOf(1 to 2, 3 to 4, 5 to 6, 7 to 8))
+ }
+
+ testMaps {
+ mInt32.put(1, intMap)
+ assertThat(mInt32).isEqualTo(mapOf(1 to intMap))
+ mInt32[2] = intMap
+ assertThat(mInt32).isEqualTo(mapOf(1 to intMap, 2 to intMap))
+ mInt32.putAll(mapOf(3 to intMap, 4 to intMap))
+ assertThat(mInt32).isEqualTo(mapOf(1 to intMap, 2 to intMap, 3 to intMap, 4 to intMap))
+
+ mString.put("1", intMap)
+ assertThat(mString).isEqualTo(mapOf("1" to intMap))
+ mString["2"] = intMap
+ assertThat(mString).isEqualTo(mapOf("1" to intMap, "2" to intMap))
+ mString.putAll(mapOf("3" to intMap, "4" to intMap))
+ assertThat(mString).isEqualTo(
+ mapOf("1" to intMap, "2" to intMap, "3" to intMap, "4" to intMap)
+ )
+ }
+
+ testEnumMap {
+ knownMapField.put(1, Proto2MapEnum.PROTO2_MAP_ENUM_FOO)
+ assertThat(knownMapField).isEqualTo(mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO))
+ knownMapField[2] = Proto2MapEnum.PROTO2_MAP_ENUM_BAR
+ assertThat(knownMapField).isEqualTo(
+ mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO, 2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR)
+ )
+ knownMapField.putAll(
+ mapOf(3 to Proto2MapEnum.PROTO2_MAP_ENUM_BAZ, 4 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO)
+ )
+ assertThat(knownMapField).isEqualTo(
+ mapOf(
+ 1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO,
+ 2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR,
+ 3 to Proto2MapEnum.PROTO2_MAP_ENUM_BAZ,
+ 4 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO
+ )
+ )
+ }
+ }
+
+ @Test
+ fun testMapRemove() {
+ val intMap =
+ testIntIntMap {
+ m.putAll(mapOf(1 to 2, 3 to 4))
+ m.remove(1)
+ assertThat(m).isEqualTo(mapOf(3 to 4))
+ }
+
+ testMaps {
+ mInt32.putAll(mapOf(1 to intMap, 2 to intMap))
+ mInt32.remove(1)
+ assertThat(mInt32).isEqualTo(mapOf(2 to intMap))
+
+ mString.putAll(mapOf("1" to intMap, "2" to intMap))
+ mString.remove("1")
+ assertThat(mString).isEqualTo(mapOf("2" to intMap))
+ }
+
+ testEnumMap {
+ knownMapField.putAll(
+ mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO, 2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR)
+ )
+ knownMapField.remove(1)
+ assertThat(knownMapField).isEqualTo(mapOf(2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR))
+ }
+ }
+
+ @Test
+ fun testMapClear() {
+ val intMap =
+ testIntIntMap {
+ m.putAll(mapOf(1 to 2, 3 to 4))
+ m.clear()
+ assertThat(m.isEmpty()).isTrue()
+ }
+
+ testMaps {
+ mInt32.putAll(mapOf(1 to intMap, 2 to intMap))
+ mInt32.clear()
+ assertThat(mInt32.isEmpty()).isTrue()
+
+ mString.putAll(mapOf("1" to intMap, "2" to intMap))
+ mString.clear()
+ assertThat(mString.isEmpty()).isTrue()
+ }
+
+ testEnumMap {
+ knownMapField.putAll(
+ mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO, 2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR)
+ )
+ knownMapField.clear()
+ assertThat(knownMapField.isEmpty()).isTrue()
+ }
+ }
+
+ @Test
+ fun testEvilNames() {
+ assertThat(
+ evilNamesProto2 {
+ initialized = true
+ hasFoo = true
+ bar = "foo"
+ isInitialized = true
+ fooBar = "foo"
+ aLLCAPS += "foo"
+ aLLCAPSMAP[1] = true
+ hasUnderbarPrecedingNumeric1Foo = true
+ hasUnderbarPrecedingNumeric42Bar = true
+ hasUnderbarPrecedingNumeric123Foo42BarBaz = true
+ extension += "foo"
+ class_ += 1
+ int = 1.0
+ long = true
+ boolean = 1L
+ sealed = "foo"
+ interface_ = 1F
+ in_ = 1
+ object_ = "foo"
+ cachedSize_ = "foo"
+ serializedSize_ = true
+ by = "foo"
+ }
+ ).isEqualTo(
+ EvilNamesProto2.newBuilder()
+ .setInitialized(true)
+ .setHasFoo(true)
+ .setBar("foo")
+ .setIsInitialized(true)
+ .setFooBar("foo")
+ .addALLCAPS("foo")
+ .putALLCAPSMAP(1, true)
+ .setHasUnderbarPrecedingNumeric1Foo(true)
+ .setHasUnderbarPrecedingNumeric42Bar(true)
+ .setHasUnderbarPrecedingNumeric123Foo42BarBaz(true)
+ .addExtension("foo")
+ .addClass_(1)
+ .setInt(1.0)
+ .setLong(true)
+ .setBoolean(1L)
+ .setSealed("foo")
+ .setInterface(1F)
+ .setIn(1)
+ .setObject("foo")
+ .setCachedSize_("foo")
+ .setSerializedSize_(true)
+ .setBy("foo")
+ .build()
+ )
+
+ assertThat(interface_ {}).isEqualTo(Interface.newBuilder().build())
+ }
+
+ @Test
+ fun testHardKeywordGettersAndSetters() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ assertThat(as_).isEqualTo(1)
+
+ in_ = "foo"
+ assertThat(in_).isEqualTo("foo")
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO)
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })
+
+ continue_[1] = 1
+ assertThat(continue_[1]).isEqualTo(1)
+
+ else_ += 1
+ assertThat(else_).isEqualTo(listOf(1))
+
+ for_ += "foo"
+ assertThat(for_).isEqualTo(listOf("foo"))
+
+ fun_ += HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO))
+
+ if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }))
+ }
+ }
+
+ @Test
+ fun testHardKeywordHazzers() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ assertThat(hasAs_()).isTrue()
+
+ in_ = "foo"
+ assertThat(hasIn_()).isTrue()
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(hasBreak_()).isTrue()
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(hasDo_()).isTrue()
+ }
+ }
+
+ @Test
+ fun testHardKeywordClears() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ clearAs_()
+ assertThat(hasAs_()).isFalse()
+
+ in_ = "foo"
+ clearIn_()
+ assertThat(hasIn_()).isFalse()
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ clearBreak_()
+ assertThat(hasBreak_()).isFalse()
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ clearDo_()
+ assertThat(hasDo_()).isFalse()
+ }
+ }
+}
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt
new file mode 100644
index 0000000..b3fd336
--- /dev/null
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto3Test.kt
@@ -0,0 +1,340 @@
+package com.google.protobuf.kotlin
+
+import com.google.common.truth.Truth.assertThat
+import evil_names_proto3.EvilNamesProto3OuterClass.EvilNamesProto3
+import evil_names_proto3.EvilNamesProto3OuterClass.HardKeywordsAllTypes
+import evil_names_proto3.EvilNamesProto3OuterClass.Class
+import evil_names_proto3.HardKeywordsAllTypesKt
+import evil_names_proto3.class_
+import evil_names_proto3.evilNamesProto3
+import evil_names_proto3.hardKeywordsAllTypes
+import multiple_files_proto3.MultipleFilesMessageA
+import multiple_files_proto3.MultipleFilesMessageB
+import multiple_files_proto3.multipleFilesMessageA
+import multiple_files_proto3.multipleFilesMessageB
+import proto3_unittest.UnittestProto3
+import proto3_unittest.TestAllTypesKt
+import proto3_unittest.TestAllTypesKt.nestedMessage
+import proto3_unittest.UnittestProto3.TestAllTypes
+import proto3_unittest.UnittestProto3.TestAllTypes.NestedEnum
+import proto3_unittest.UnittestProto3.TestEmptyMessage
+import proto3_unittest.copy
+import proto3_unittest.testAllTypes
+import proto3_unittest.testEmptyMessage
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class Proto3Test {
+ @Test
+ fun testGettersAndSetters() {
+ testAllTypes {
+ optionalInt32 = 101
+ assertThat(optionalInt32).isEqualTo(101)
+ optionalString = "115"
+ assertThat(optionalString).isEqualTo("115")
+ optionalNestedMessage = TestAllTypesKt.nestedMessage { bb = 118 }
+ assertThat(optionalNestedMessage).isEqualTo(TestAllTypesKt.nestedMessage { bb = 118 })
+ optionalNestedEnum = NestedEnum.BAZ
+ assertThat(optionalNestedEnum).isEqualTo(NestedEnum.BAZ)
+ oneofUint32 = 601
+ assertThat(oneofUint32).isEqualTo(601)
+ }
+ }
+
+ @Test
+ fun testRepeatedGettersAndSetters() {
+ testAllTypes {
+ repeatedInt32.addAll(listOf(1, 2))
+ assertThat(repeatedInt32).isEqualTo(listOf(1, 2))
+ repeatedInt32 += listOf(3, 4)
+ assertThat(repeatedInt32).isEqualTo(listOf(1, 2, 3, 4))
+ repeatedInt32[0] = 5
+ assertThat(repeatedInt32).isEqualTo(listOf(5, 2, 3, 4))
+
+ repeatedString.addAll(listOf("1", "2"))
+ assertThat(repeatedString).isEqualTo(listOf("1", "2"))
+ repeatedString += listOf("3", "4")
+ assertThat(repeatedString).isEqualTo(listOf("1", "2", "3", "4"))
+ repeatedString[0] = "5"
+ assertThat(repeatedString).isEqualTo(listOf("5", "2", "3", "4"))
+
+ repeatedNestedMessage.addAll(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 }
+ )
+ )
+ repeatedNestedMessage += listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 1 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+ repeatedNestedMessage[0] = nestedMessage { bb = 5 }
+ assertThat(repeatedNestedMessage).isEqualTo(
+ listOf(
+ nestedMessage { bb = 5 },
+ nestedMessage { bb = 2 },
+ nestedMessage { bb = 3 },
+ nestedMessage { bb = 4 }
+ )
+ )
+
+ repeatedNestedEnum.addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ assertThat(repeatedNestedEnum).isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
+ repeatedNestedEnum += listOf(NestedEnum.BAZ, NestedEnum.FOO)
+ assertThat(repeatedNestedEnum).isEqualTo(
+ listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ repeatedNestedEnum[0] = NestedEnum.BAR
+ assertThat(repeatedNestedEnum).isEqualTo(
+ listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
+ )
+ }
+ }
+
+ @Test
+ fun testClears() {
+ assertThat(
+ testAllTypes {
+ optionalInt32 = 101
+ clearOptionalInt32()
+
+ optionalString = "115"
+ clearOptionalString()
+
+ optionalNestedMessage = TestAllTypesKt.nestedMessage { bb = 118 }
+ clearOptionalNestedMessage()
+
+ optionalNestedEnum = NestedEnum.BAZ
+ clearOptionalNestedEnum()
+
+ oneofUint32 = 601
+ clearOneofUint32()
+ }
+ ).isEqualTo(
+ TestAllTypes.newBuilder().build()
+ )
+ }
+
+ @Test
+ fun testCopy() {
+ val message = testAllTypes {
+ optionalInt32 = 101
+ optionalString = "115"
+ }
+ val modifiedMessage = message.copy {
+ optionalInt32 = 201
+ }
+
+ assertThat(message).isEqualTo(
+ TestAllTypes.newBuilder()
+ .setOptionalInt32(101)
+ .setOptionalString("115")
+ .build()
+ )
+ assertThat(modifiedMessage).isEqualTo(
+ TestAllTypes.newBuilder()
+ .setOptionalInt32(201)
+ .setOptionalString("115")
+ .build()
+ )
+ }
+
+ @Test
+ fun testOneof() {
+ val message = testAllTypes {
+ oneofString = "foo"
+ assertThat(oneofFieldCase)
+ .isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_STRING)
+ assertThat(oneofString).isEqualTo("foo")
+ clearOneofField()
+ assertThat(oneofFieldCase)
+ .isEqualTo(TestAllTypes.OneofFieldCase.ONEOFFIELD_NOT_SET)
+ oneofUint32 = 5
+ }
+
+ assertThat(message.getOneofFieldCase())
+ .isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_UINT32)
+ assertThat(message.getOneofUint32()).isEqualTo(5)
+ }
+
+ @Test
+ fun testEmptyMessages() {
+ assertThat(
+ testEmptyMessage {}
+ ).isEqualTo(
+ TestEmptyMessage.newBuilder().build()
+ )
+ }
+
+ @Test
+ fun testEvilNames() {
+ assertThat(
+ evilNamesProto3 {
+ initialized = true
+ hasFoo = true
+ bar = "foo"
+ isInitialized = true
+ fooBar = "foo"
+ aLLCAPS += "foo"
+ aLLCAPSMAP[1] = true
+ hasUnderbarPrecedingNumeric1Foo = true
+ hasUnderbarPrecedingNumeric42Bar = true
+ hasUnderbarPrecedingNumeric123Foo42BarBaz = true
+ extension += "foo"
+ class_ = "foo"
+ int = 1.0
+ long = true
+ boolean = 1L
+ sealed = "foo"
+ interface_ = 1F
+ in_ = 1
+ object_ = "foo"
+ cachedSize_ = "foo"
+ serializedSize_ = true
+ value = "foo"
+ index = 1L
+ values += "foo"
+ newValues += "foo"
+ builder = true
+ k[1] = 1
+ v["foo"] = "foo"
+ key["foo"] = 1
+ map[1] = "foo"
+ pairs["foo"] = 1
+ LeadingUnderscore = "foo"
+ option = 1
+ }
+ ).isEqualTo(
+ EvilNamesProto3.newBuilder()
+ .setInitialized(true)
+ .setHasFoo(true)
+ .setBar("foo")
+ .setIsInitialized(true)
+ .setFooBar("foo")
+ .addALLCAPS("foo")
+ .putALLCAPSMAP(1, true)
+ .setHasUnderbarPrecedingNumeric1Foo(true)
+ .setHasUnderbarPrecedingNumeric42Bar(true)
+ .setHasUnderbarPrecedingNumeric123Foo42BarBaz(true)
+ .addExtension("foo")
+ .setClass_("foo")
+ .setInt(1.0)
+ .setLong(true)
+ .setBoolean(1L)
+ .setSealed("foo")
+ .setInterface(1F)
+ .setIn(1)
+ .setObject("foo")
+ .setCachedSize_("foo")
+ .setSerializedSize_(true)
+ .setValue("foo")
+ .setIndex(1L)
+ .addValues("foo")
+ .addNewValues("foo")
+ .setBuilder(true)
+ .putK(1, 1)
+ .putV("foo", "foo")
+ .putKey("foo", 1)
+ .putMap(1, "foo")
+ .putPairs("foo", 1)
+ .setLeadingUnderscore("foo")
+ .setOption(1)
+ .build()
+ )
+
+ assertThat(class_ {}).isEqualTo(Class.newBuilder().build())
+ }
+
+ @Test
+ fun testHardKeywordGettersAndSetters() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ assertThat(as_).isEqualTo(1)
+
+ in_ = "foo"
+ assertThat(in_).isEqualTo("foo")
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(break_).isEqualTo(HardKeywordsAllTypes.NestedEnum.FOO)
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(do_).isEqualTo(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 })
+
+ continue_[1] = 1
+ assertThat(continue_[1]).isEqualTo(1)
+
+ else_ += 1
+ assertThat(else_).isEqualTo(listOf(1))
+
+ for_ += "foo"
+ assertThat(for_).isEqualTo(listOf("foo"))
+
+ fun_ += HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(fun_).isEqualTo(listOf(HardKeywordsAllTypes.NestedEnum.FOO))
+
+ if_ += HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(if_).isEqualTo(listOf(HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }))
+ }
+ }
+
+ @Test
+ fun testHardKeywordHazzers() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ assertThat(hasAs_()).isTrue()
+
+ in_ = "foo"
+ assertThat(hasIn_()).isTrue()
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ assertThat(hasBreak_()).isTrue()
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ assertThat(hasDo_()).isTrue()
+ }
+ }
+
+ @Test
+ fun testHardKeywordClears() {
+ hardKeywordsAllTypes {
+ as_ = 1
+ clearAs_()
+ assertThat(hasAs_()).isFalse()
+
+ in_ = "foo"
+ clearIn_()
+ assertThat(hasIn_()).isFalse()
+
+ break_ = HardKeywordsAllTypes.NestedEnum.FOO
+ clearBreak_()
+ assertThat(hasBreak_()).isFalse()
+
+ do_ = HardKeywordsAllTypesKt.nestedMessage { while_ = 1 }
+ clearDo_()
+ assertThat(hasDo_()).isFalse()
+ }
+ }
+
+ @Test
+ fun testMultipleFiles() {
+ assertThat(
+ multipleFilesMessageA {}
+ ).isEqualTo(
+ MultipleFilesMessageA.newBuilder().build()
+ )
+
+ assertThat(
+ multipleFilesMessageB {}
+ ).isEqualTo(
+ MultipleFilesMessageB.newBuilder().build()
+ )
+ }
+}
diff --git a/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto
new file mode 100644
index 0000000..70d813a
--- /dev/null
+++ b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto
@@ -0,0 +1,62 @@
+syntax = "proto2";
+
+package evil_names_proto2;
+
+option java_package = "evil_names_proto2";
+
+message EvilNamesProto2 {
+ optional bool initialized = 1;
+ optional bool has_foo = 2;
+ optional string Bar = 3;
+ optional bool is_initialized = 4;
+
+ oneof camelCase {
+ string fooBar = 5;
+ }
+
+ repeated string ALL_CAPS = 7;
+ map<int32, bool> ALL_CAPS_MAP = 8;
+
+ optional bool has_underbar_preceding_numeric_1foo = 9;
+ optional bool has_underbar_preceding_numeric_42bar = 13;
+ optional bool has_underbar_preceding_numeric_123foo42bar_baz = 14;
+
+ extensions 100 to max;
+
+ repeated string extension = 12;
+ repeated int32 class = 15;
+ optional double int = 16;
+ optional bool long = 17;
+ optional int64 boolean = 18;
+ optional string sealed = 19;
+ optional float interface = 20;
+ optional int32 in = 21;
+ optional string object = 22;
+ optional string cached_size = 23;
+ optional bool serialized_size = 24;
+ optional string by = 25;
+}
+
+message HardKeywordsAllTypes {
+ message NestedMessage {
+ optional int32 while = 1;
+ }
+
+ enum NestedEnum {
+ FOO = 1;
+ BAR = 2;
+ }
+
+ optional int32 as = 1;
+ optional string in = 2;
+ optional NestedEnum break = 3;
+ map<int32, int32> continue = 4;
+ optional NestedMessage do = 5;
+
+ repeated int32 else = 6;
+ repeated string for = 7;
+ repeated NestedEnum fun = 8;
+ repeated NestedMessage if = 9;
+}
+
+message Interface {}
diff --git a/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto
new file mode 100644
index 0000000..1b40e4d
--- /dev/null
+++ b/java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto3.proto
@@ -0,0 +1,76 @@
+syntax = "proto3";
+
+package evil_names_proto3;
+
+option java_package = "evil_names_proto3";
+
+message EvilNamesProto3 {
+ bool initialized = 1;
+ bool has_foo = 2;
+ string Bar = 3;
+ bool is_initialized = 4;
+
+ oneof camelCase {
+ string fooBar = 5;
+ }
+
+ repeated string ALL_CAPS = 7;
+ map<int32, bool> ALL_CAPS_MAP = 8;
+
+ bool has_underbar_preceding_numeric_1foo = 9;
+ bool has_underbar_preceding_numeric_42bar = 10;
+ bool has_underbar_preceding_numeric_123foo42bar_baz = 11;
+
+ repeated string extension = 12;
+
+ string class = 13;
+ double int = 14;
+ bool long = 15;
+ int64 boolean = 16;
+ string sealed = 17;
+ float interface = 18;
+ int32 in = 19;
+ string object = 20;
+ string cached_size = 21;
+ bool serialized_size = 22;
+ string value = 23;
+ int64 index = 24;
+ repeated string values = 25;
+ repeated string new_values = 26;
+ bool builder = 27;
+ map<int32, int32> k = 28;
+ map<string, string> v = 29;
+ map<string, int32> key = 30;
+ map<int32, string> map = 31;
+ map<string, int32> pairs = 32;
+
+ string _leading_underscore = 33;
+ oneof _leading_underscore_oneof {
+ int32 option = 34;
+ }
+}
+
+message HardKeywordsAllTypes {
+ message NestedMessage {
+ optional int32 while = 1;
+ }
+
+ enum NestedEnum {
+ ZERO = 0;
+ FOO = 1;
+ BAR = 2;
+ }
+
+ optional int32 as = 1;
+ optional string in = 2;
+ optional NestedEnum break = 3;
+ map<int32, int32> continue = 4;
+ optional NestedMessage do = 5;
+
+ repeated int32 else = 6;
+ repeated string for = 7;
+ repeated NestedEnum fun = 8;
+ repeated NestedMessage if = 9;
+}
+
+message Class {}
diff --git a/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto b/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto
new file mode 100644
index 0000000..14f18db
--- /dev/null
+++ b/java/kotlin/src/test/proto/com/google/protobuf/example_extensible_message.proto
@@ -0,0 +1,16 @@
+syntax = "proto2";
+
+package example_extensible_message;
+
+option java_package = "example_extensible_message";
+option java_multiple_files = true;
+
+message ExampleExtensibleMessage {
+ extensions 10 to 20;
+}
+
+extend ExampleExtensibleMessage {
+ repeated int32 repeated_extension = 10;
+ repeated int32 different_extension = 11;
+ optional int32 int32_extension = 12;
+}
diff --git a/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto b/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto
new file mode 100644
index 0000000..82211cc
--- /dev/null
+++ b/java/kotlin/src/test/proto/com/google/protobuf/multiple_files_proto3.proto
@@ -0,0 +1,12 @@
+syntax = "proto3";
+
+package multiple_files_proto3;
+
+option java_package = "multiple_files_proto3";
+option java_multiple_files = true;
+
+enum NestedEnum { FOO = 0; }
+
+message MultipleFilesMessageA {}
+
+message MultipleFilesMessageB {}
diff --git a/java/lite/BUILD b/java/lite/BUILD
index 22840ec..639f308 100644
--- a/java/lite/BUILD
+++ b/java/lite/BUILD
@@ -1,4 +1,9 @@
+load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
+load("//:internal.bzl", "conformance_test")
+load("//java/internal:testing.bzl", "junit_tests")
+
+exports_files(["lite.awk"], visibility = ["//java/core:__pkg__"])
alias(
name = "lite",
@@ -12,3 +17,40 @@
runtime = ":lite",
visibility = ["//visibility:public"],
)
+
+test_suite(
+ name = "tests",
+ tests = [
+ "lite_build_test",
+ "conformance_test",
+ "lite_tests",
+ "//java/core:lite_tests",
+ ],
+)
+
+build_test(
+ name = "lite_build_test",
+ targets = [
+ ":lite",
+ ],
+)
+
+conformance_test(
+ name = "conformance_test",
+ testee = "//:conformance_java_lite",
+ failure_list = "//:conformance/failure_list_java_lite.txt",
+ text_format_failure_list = "//:conformance/text_format_failure_list_java_lite.txt",
+)
+
+junit_tests(
+ name = "lite_tests",
+ srcs = glob(["src/test/**/*.java"]),
+ size = "small",
+ deps = [
+ ":lite",
+ "//external:junit",
+ "//java/core:generic_test_protos_java_proto_lite",
+ "//java/core:java_test_protos_java_proto_lite",
+ "//java/core:test_util_lite",
+ ],
+)
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index 821266a..feb8960 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -199,6 +199,7 @@
and exclude only the full runtime exclusive tests so we don't accidentally miss
any test. -->
<excludes>
+ <!-- Keep in sync with //java/core:lite_tests BUILD rule. -->
<exclude>AbstractMessageTest.java</exclude>
<exclude>AbstractProto2SchemaTest.java</exclude>
<exclude>AnyTest.java</exclude>
diff --git a/java/util/BUILD b/java/util/BUILD
index 71f73ba..25853f7 100644
--- a/java/util/BUILD
+++ b/java/util/BUILD
@@ -1,4 +1,6 @@
-load("@rules_java//java:defs.bzl", "java_library")
+load("@rules_java//java:defs.bzl", "java_library", "java_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("//java/internal:testing.bzl", "junit_tests")
java_library(
name = "util",
@@ -14,3 +16,36 @@
"//java/lite",
],
)
+
+proto_library(
+ name = "test_protos",
+ srcs = glob(["src/test/proto/**/*.proto"]),
+ deps = [
+ "//:any_proto",
+ "//:duration_proto",
+ "//:field_mask_proto",
+ "//:struct_proto",
+ "//:timestamp_proto",
+ "//:wrappers_proto",
+ ],
+)
+
+java_proto_library(
+ name = "test_protos_java_proto",
+ deps = [":test_protos"],
+)
+
+junit_tests(
+ name = "tests",
+ srcs = glob(["src/test/java/**/*.java"]),
+ package_name = "com.google.protobuf.util",
+ deps = [
+ ":test_protos_java_proto",
+ ":util",
+ "//external:guava",
+ "//external:junit",
+ "//external:truth",
+ "//java/core",
+ "//java/core:generic_test_protos_java_proto",
+ ],
+)
diff --git a/js/README.md b/js/README.md
index 3635028..2f5490b 100644
--- a/js/README.md
+++ b/js/README.md
@@ -95,7 +95,7 @@
var message = proto.my.package.MyMessage();
-If unfamiliar with Closure or it's compiler, consider reviewing Closure documentation
+If unfamiliar with Closure or its compiler, consider reviewing Closure documentation
https://developers.google.com/closure/library/docs/tutorial
https://developers.google.com/closure/library/docs/closurebuilder
https://developers.google.com/closure/library/docs/depswriter
diff --git a/js/compatibility_tests/v3.1.0/binary/decoder_test.js b/js/compatibility_tests/v3.1.0/binary/decoder_test.js
index 71a3725..01100fd 100644
--- a/js/compatibility_tests/v3.1.0/binary/decoder_test.js
+++ b/js/compatibility_tests/v3.1.0/binary/decoder_test.js
@@ -224,7 +224,6 @@
/**
* Verifies that misuse of the decoder class triggers assertions.
- * @suppress {checkTypes|visibility}
*/
it('testDecodeErrors', function() {
// Reading a value past the end of the stream should trigger an assertion.
diff --git a/kokoro/docs/publish-python.sh b/kokoro/docs/publish-python.sh
index eea1755..457a24f 100755
--- a/kokoro/docs/publish-python.sh
+++ b/kokoro/docs/publish-python.sh
@@ -14,10 +14,10 @@
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -y install unzip
-wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protoc-3.11.2-linux-x86_64.zip
-unzip protoc-3.11.2-linux-x86_64.zip bin/protoc
+wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
+unzip protoc-3.15.8-linux-x86_64.zip bin/protoc
mv bin/protoc ../src/protoc
-python3.6 -m venv venv
+python3 -m venv venv
source venv/bin/activate
python setup.py install
@@ -30,13 +30,13 @@
cd ..
deactivate
-python3.6 -m pip install protobuf==3.11.1 gcp-docuploader
+python3 -m pip install protobuf==3.15.8 gcp-docuploader
# install a json parser
sudo apt-get -y install jq
# create metadata
-python3.6 -m docuploader create-metadata \
+python3 -m docuploader create-metadata \
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
--version=$(python3 setup.py --version) \
--language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
@@ -48,4 +48,4 @@
cat docs.metadata
# upload docs
-python3.6 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
+python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
diff --git a/kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh
new file mode 100755
index 0000000..425cc90
--- /dev/null
+++ b/kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Builds protobuf C++ with aarch64 crosscompiler and runs a basic set of tests under an emulator.
+# NOTE: This script is expected to run under the dockcross/linux-arm64 docker image.
+
+set -ex
+
+mkdir -p cmake/crossbuild_aarch64
+cd cmake/crossbuild_aarch64
+
+# the build commands are expected to run under dockcross docker image
+# where the CC, CXX and other toolchain variables already point to the crosscompiler
+cmake ..
+make -j8
+
+# check that the resulting test binary is indeed an aarch64 ELF
+(file ./tests | grep -q "ELF 64-bit LSB executable, ARM aarch64") || (echo "Test binary in not an aarch64 binary"; exit 1)
+
+# run the basic set of C++ tests under QEMU
+# there are other tests we could run (e.g. ./lite-test), but this is sufficient as a smoketest
+qemu-aarch64 ./tests
diff --git a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh
new file mode 100755
index 0000000..70a0d7c
--- /dev/null
+++ b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+# go to the repo root
+cd $(dirname $0)/../../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# running dockcross image without any arguments generates a wrapper
+# scripts that can be used to run commands under the dockcross image
+# easily.
+# See https://github.com/dockcross/dockcross#usage for details
+docker run $DOCKER_TTY_ARGS --rm dockcross/linux-arm64 >dockcross-linux-arm64.sh
+chmod +x dockcross-linux-arm64.sh
+
+# the wrapper script has CRLF line endings and bash doesn't like that
+# so we change CRLF line endings into LF.
+sed -i 's/\r//g' dockcross-linux-arm64.sh
+
+# The dockcross wrapper script runs arbitrary commands under the selected dockcross
+# image with the following properties which make its use very convenient:
+# * the current working directory is mounted under /work so the container can easily
+# access the current workspace
+# * the processes in the container run under the same UID and GID as the host process so unlike
+# vanilla "docker run" invocations, the workspace doesn't get polluted with files
+# owned by root.
+./dockcross-linux-arm64.sh "$@"
diff --git a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh
new file mode 100755
index 0000000..115478b
--- /dev/null
+++ b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+# go to the repo root
+cd $(dirname $0)/../../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# running dockcross image without any arguments generates a wrapper
+# scripts that can be used to run commands under the dockcross image
+# easily.
+# See https://github.com/dockcross/dockcross#usage for details
+docker run $DOCKER_TTY_ARGS --rm dockcross/manylinux2014-aarch64 >dockcross-manylinux2014-aarch64.sh
+chmod +x dockcross-manylinux2014-aarch64.sh
+
+# the wrapper script has CRLF line endings and bash doesn't like that
+# so we change CRLF line endings into LF.
+sed -i 's/\r//g' dockcross-manylinux2014-aarch64.sh
+
+# The dockcross wrapper script runs arbitrary commands under the selected dockcross
+# image with the following properties which make its use very convenient:
+# * the current working directory is mounted under /work so the container can easily
+# access the current workspace
+# * the processes in the container run under the same UID and GID as the host process so unlike
+# vanilla "docker run" invocations, the workspace doesn't get polluted with files
+# owned by root.
+./dockcross-manylinux2014-aarch64.sh "$@"
diff --git a/kokoro/linux/aarch64/javascript_build_and_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/javascript_build_and_run_tests_with_qemu_aarch64.sh
new file mode 100755
index 0000000..c4eb7d8
--- /dev/null
+++ b/kokoro/linux/aarch64/javascript_build_and_run_tests_with_qemu_aarch64.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -ex
+
+# install the same version of node as in /tests.sh
+NODE_VERSION=node-v12.16.3-linux-arm64
+NODE_TGZ="$NODE_VERSION.tar.gz"
+pushd /tmp
+curl -OL https://nodejs.org/dist/v12.16.3/$NODE_TGZ
+tar zxvf $NODE_TGZ
+export PATH=$PATH:`pwd`/$NODE_VERSION/bin
+popd
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+cd js
+npm install
+npm test
diff --git a/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh b/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
new file mode 100755
index 0000000..77942a4
--- /dev/null
+++ b/kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+#
+# Builds protobuf C++ with aarch64 crosscompiler.
+
+set -ex
+
+./autogen.sh
+CXXFLAGS="-fPIC -g -O2" ./configure --host=aarch64
+make -j8
diff --git a/kokoro/linux/aarch64/python_crosscompile_aarch64.sh b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh
new file mode 100755
index 0000000..db2e776
--- /dev/null
+++ b/kokoro/linux/aarch64/python_crosscompile_aarch64.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Builds protobuf python including the C++ extension with aarch64 crosscompiler.
+# The outputs of this script are laid out so that we can later test them under an aarch64 emulator.
+# NOTE: This script is expected to run under the dockcross/manylinux2014-aarch64 docker image.
+
+set -ex
+
+PYTHON="/opt/python/cp38-cp38/bin/python"
+
+./autogen.sh
+CXXFLAGS="-fPIC -g -O2" ./configure --host=aarch64
+make -j8
+
+# create a simple shell wrapper that runs crosscompiled protoc under qemu
+echo '#!/bin/bash' >protoc_qemu_wrapper.sh
+echo 'exec qemu-aarch64 "../src/protoc" "$@"' >>protoc_qemu_wrapper.sh
+chmod ugo+x protoc_qemu_wrapper.sh
+
+# PROTOC variable is by build_py step that runs under ./python directory
+export PROTOC=../protoc_qemu_wrapper.sh
+
+pushd python
+
+# NOTE: this step will use protoc_qemu_wrapper.sh to generate protobuf files.
+${PYTHON} setup.py build_py
+
+# when crosscompiling for aarch64, --plat-name needs to be set explicitly
+# to end up with correctly named wheel file
+# the value should be manylinuxABC_ARCH and dockcross docker image
+# conveniently provides the value in the AUDITWHEEL_PLAT env
+plat_name_flag="--plat-name=$AUDITWHEEL_PLAT"
+
+# override the value of EXT_SUFFIX to make sure the crosscompiled .so files in the wheel have the correct filename suffix
+export PROTOCOL_BUFFERS_OVERRIDE_EXT_SUFFIX="$(${PYTHON} -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX").replace("-x86_64-linux-gnu.so", "-aarch64-linux-gnu.so"))')"
+
+# Build the python extension inplace to be able to python unittests later
+${PYTHON} setup.py build_ext --cpp_implementation --compile_static_extension --inplace
+
+# Build the binary wheel (to check it with auditwheel)
+${PYTHON} setup.py bdist_wheel --cpp_implementation --compile_static_extension $plat_name_flag
diff --git a/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
new file mode 100755
index 0000000..527fc48
--- /dev/null
+++ b/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -ex
+
+# go to the repo root
+cd $(dirname $0)/../../..
+cd python
+
+PYTHON="/opt/python/cp38-cp38/bin/python"
+${PYTHON} -m pip install --user six pytest auditwheel
+
+# check that we are really using aarch64 python
+(${PYTHON} -c 'import sysconfig; print(sysconfig.get_platform())' | grep -q "linux-aarch64") || (echo "Wrong python platform, needs to be aarch64 python."; exit 1)
+
+# step 1: run all python unittests
+# we've built the python extension previously with --inplace option
+# so we can just discover all the unittests and run them directly under
+# the python/ directory.
+LD_LIBRARY_PATH=../src/.libs PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -m pytest google/protobuf
+
+# step 2: run auditwheel show to check that the wheel is manylinux2014 compatible.
+# auditwheel needs to run on wheel's target platform (or under an emulator)
+${PYTHON} -m auditwheel show dist/protobuf-*-manylinux2014_aarch64.whl
+
+# step 3: smoketest that the wheel can be installed and run a smokecheck
+${PYTHON} -m pip install dist/protobuf-*-manylinux2014_aarch64.whl
+# when python cpp extension is on, simply importing a message type will trigger loading the cpp extension
+PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp ${PYTHON} -c 'import google.protobuf.timestamp_pb2; print("Successfully loaded the python cpp extension!")'
diff --git a/kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh b/kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
new file mode 100755
index 0000000..f613202
--- /dev/null
+++ b/kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# Setup and configure qemu userspace emulator on kokoro worker so that we can seamlessly emulate processes running
+# inside docker containers.
+
+set -ex
+
+# show pre-existing qemu registration
+cat /proc/sys/fs/binfmt_misc/qemu-aarch64
+
+# Kokoro ubuntu1604 workers have already qemu-user and qemu-user-static packages installed, but it's and old version that:
+# * prints warning about some syscalls (e.g "qemu: Unsupported syscall: 278")
+# * doesn't register with binfmt_misc with the persistent ("F") flag we need (see below)
+#
+# To overcome the above limitations, we use the https://github.com/multiarch/qemu-user-static
+# docker image to provide a new enough version of qemu-user-static and register it with
+# the desired binfmt_misc flags. The most important flag we need is "F" (set by "--persistent yes"),
+# which allows the qemu-aarch64-static binary to be loaded eagerly at the time of registration with binfmt_misc.
+# That way, we can emulate aarch64 binaries running inside docker containers transparently, without needing the emulator
+# binary to be accessible from the docker image we're emulating.
+# Note that on newer distributions (such as glinux), simply "apt install qemu-user-static" is sufficient
+# to install qemu-user-static with the right flags.
+docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset --credential yes --persistent yes
+
+# Print current qemu reqistration to make sure everything is setup correctly.
+cat /proc/sys/fs/binfmt_misc/qemu-aarch64
diff --git a/kokoro/linux/aarch64/ruby_build_and_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/ruby_build_and_run_tests_with_qemu_aarch64.sh
new file mode 100755
index 0000000..dc093bc
--- /dev/null
+++ b/kokoro/linux/aarch64/ruby_build_and_run_tests_with_qemu_aarch64.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -ex
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+gem install bundler
+
+cd ruby
+
+bundle
+rake
+rake clobber_package gem
+
+# run all the tests
+rake test
diff --git a/kokoro/linux/aarch64/test_cpp_aarch64.sh b/kokoro/linux/aarch64/test_cpp_aarch64.sh
new file mode 100755
index 0000000..26f95f3
--- /dev/null
+++ b/kokoro/linux/aarch64/test_cpp_aarch64.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+#
+# Crosscompiles protobuf C++ under dockcross docker image and runs the tests under an emulator.
+
+set -e
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+# Initialize any submodules.
+git submodule update --init --recursive
+
+# run the C++ build and test script under dockcross/linux-arm64 image
+kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh kokoro/linux/aarch64/cpp_crosscompile_and_run_tests_with_qemu_aarch64.sh
diff --git a/kokoro/linux/aarch64/test_csharp_aarch64.sh b/kokoro/linux/aarch64/test_csharp_aarch64.sh
new file mode 100755
index 0000000..450bb1e
--- /dev/null
+++ b/kokoro/linux/aarch64/test_csharp_aarch64.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -ex
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# First, build protobuf C# tests under x86_64 docker image
+# Tests are built "dotnet publish" because we want all the dependencies to the copied to the destination directory
+# (we want to avoid references to ~/.nuget that won't be available in the subsequent docker run)
+CSHARP_BUILD_COMMAND="dotnet publish -c Release -f net50 csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj"
+docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "DOTNET_CLI_TELEMETRY_OPTOUT=true" -e "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work mcr.microsoft.com/dotnet/sdk:5.0.202-buster-slim bash -c "$CSHARP_BUILD_COMMAND"
+
+# Use an actual aarch64 docker image to run protobuf C# tests with an emulator. "dotnet vstest" allows
+# running tests from a pre-built project.
+# * mount the protobuf root as /work to be able to access the crosscompiled files
+# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
+# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
+# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
+# we just run map the user's home to a throwaway temporary directory
+CSHARP_TEST_COMMAND="dotnet vstest csharp/src/Google.Protobuf.Test/bin/Release/net50/publish/Google.Protobuf.Test.dll"
+docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "DOTNET_CLI_TELEMETRY_OPTOUT=true" -e "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work mcr.microsoft.com/dotnet/sdk:5.0.202-buster-slim-arm64v8 bash -c "$CSHARP_TEST_COMMAND"
diff --git a/kokoro/linux/aarch64/test_java_aarch64.sh b/kokoro/linux/aarch64/test_java_aarch64.sh
new file mode 100755
index 0000000..72f1c83
--- /dev/null
+++ b/kokoro/linux/aarch64/test_java_aarch64.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -ex
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# crosscompile protoc as we will later need it for the java build.
+# we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible
+# with a wide range of linux distros (including any docker images we will use later to build and test java)
+kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
+
+# the command that will be used to build and test java under an emulator
+# * IsValidUtf8Test and DecodeUtf8Test tests are being skipped because that take very long under an emulator.
+TEST_JAVA_COMMAND="mvn --batch-mode -DskipTests install && mvn --batch-mode -Dtest='**/*Test, !**/*IsValidUtf8Test, !**/*DecodeUtf8Test' -DfailIfNoTests=false surefire:test"
+
+# use an actual aarch64 docker image (with a real aarch64 java and maven) to run build & test protobuf java under an emulator
+# * mount the protobuf root as /work to be able to access the crosscompiled files
+# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
+# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
+# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
+# we just run map the user's home to a throwaway temporary directory
+# * the JAVA_OPTS and MAVEN_CONFIG variables are being set mostly to silence warnings about non-existent home directory
+# and to avoid polluting the workspace.
+docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -e "JAVA_OPTS=-Duser.home=/home/fake-user" -e "MAVEN_CONFIG=/home/fake-user/.m2" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work arm64v8/maven:3.8-openjdk-11 bash -c "cd java && $TEST_JAVA_COMMAND"
diff --git a/kokoro/linux/aarch64/test_javascript_aarch64.sh b/kokoro/linux/aarch64/test_javascript_aarch64.sh
new file mode 100755
index 0000000..3156e6e
--- /dev/null
+++ b/kokoro/linux/aarch64/test_javascript_aarch64.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -ex
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# crosscompile protoc as we will later need it for the javascript build.
+# we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible
+# with a wide range of linux distros (including any docker images we will use later to build and test javascript)
+kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
+
+# use an actual aarch64 docker image (with a real aarch64 nodejs) to run build & test protobuf javascript under an emulator
+# * mount the protobuf root as /work to be able to access the crosscompiled files
+# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
+# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
+# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
+# we just run map the user's home to a throwaway temporary directory
+# Note that the docker image used for running the tests is arm64v8/openjdk, not arm64v8/node
+# This is because some of the node tests require java to be available and adding node
+# binary distribution into a java image is easier than vice versa.
+docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work arm64v8/openjdk:11-jdk-buster kokoro/linux/aarch64/javascript_build_and_run_tests_with_qemu_aarch64.sh
diff --git a/kokoro/linux/aarch64/test_python_aarch64.sh b/kokoro/linux/aarch64/test_python_aarch64.sh
new file mode 100755
index 0000000..1e2d570
--- /dev/null
+++ b/kokoro/linux/aarch64/test_python_aarch64.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -e
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# crosscompile python extension and the binary wheel under dockcross/manylinux2014-aarch64 image
+kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/python_crosscompile_aarch64.sh
+
+# once crosscompilation is done, use an actual aarch64 docker image (with a real aarch64 python) to run all the tests under an emulator
+# * mount the protobuf root as /work to be able to access the crosscompiled files
+# * intentionally use a different image than manylinux2014 so that we don't build and test on the same linux distribution
+# (manylinux_2_24 is debian-based while manylinux2014 is centos-based)
+# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
+# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
+# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
+# we just run map the user's home to a throwaway temporary directory
+docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work quay.io/pypa/manylinux_2_24_aarch64 kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
diff --git a/kokoro/linux/aarch64/test_ruby_aarch64.sh b/kokoro/linux/aarch64/test_ruby_aarch64.sh
new file mode 100755
index 0000000..91ee5f2
--- /dev/null
+++ b/kokoro/linux/aarch64/test_ruby_aarch64.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -ex
+
+# go to the repo root
+cd $(dirname $0)/../../..
+
+if [[ -t 0 ]]; then
+ DOCKER_TTY_ARGS="-it"
+else
+ # The input device on kokoro is not a TTY, so -it does not work.
+ DOCKER_TTY_ARGS=
+fi
+
+# crosscompile protoc as we will later need it for the ruby build.
+# we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible
+# with a wide range of linux distros (including any docker images we will use later to build and test ruby)
+kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh
+
+# use an actual aarch64 docker image (with a real aarch64 ruby) to run build & test protobuf ruby under an emulator
+# * mount the protobuf root as /work to be able to access the crosscompiled files
+# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force
+# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user
+# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity,
+# we just run map the user's home to a throwaway temporary directory
+
+docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work arm64v8/ruby:2.7.3-buster kokoro/linux/aarch64/ruby_build_and_run_tests_with_qemu_aarch64.sh
\ No newline at end of file
diff --git a/kokoro/linux/cpp_aarch64/build.sh b/kokoro/linux/cpp_aarch64/build.sh
new file mode 100755
index 0000000..a43ab1c
--- /dev/null
+++ b/kokoro/linux/cpp_aarch64/build.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "continuous" and "presubmit" jobs.
+
+set -ex
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+kokoro/linux/aarch64/test_cpp_aarch64.sh
diff --git a/kokoro/linux/cpp_aarch64/continuous.cfg b/kokoro/linux/cpp_aarch64/continuous.cfg
new file mode 100644
index 0000000..0f1be4a
--- /dev/null
+++ b/kokoro/linux/cpp_aarch64/continuous.cfg
@@ -0,0 +1,5 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/cpp_aarch64/build.sh"
+timeout_mins: 120
diff --git a/kokoro/linux/cpp_aarch64/presubmit.cfg b/kokoro/linux/cpp_aarch64/presubmit.cfg
new file mode 100644
index 0000000..0f1be4a
--- /dev/null
+++ b/kokoro/linux/cpp_aarch64/presubmit.cfg
@@ -0,0 +1,5 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/cpp_aarch64/build.sh"
+timeout_mins: 120
diff --git a/kokoro/linux/csharp_aarch64/build.sh b/kokoro/linux/csharp_aarch64/build.sh
new file mode 100755
index 0000000..db3fc21
--- /dev/null
+++ b/kokoro/linux/csharp_aarch64/build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "continuous" and "presubmit" jobs.
+
+set -ex
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+# Initialize any submodules.
+git submodule update --init --recursive
+
+kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
+
+kokoro/linux/aarch64/test_csharp_aarch64.sh
diff --git a/kokoro/linux/csharp_aarch64/continuous.cfg b/kokoro/linux/csharp_aarch64/continuous.cfg
new file mode 100644
index 0000000..df28ef3
--- /dev/null
+++ b/kokoro/linux/csharp_aarch64/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/csharp_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/csharp_aarch64/presubmit.cfg b/kokoro/linux/csharp_aarch64/presubmit.cfg
new file mode 100644
index 0000000..df28ef3
--- /dev/null
+++ b/kokoro/linux/csharp_aarch64/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/csharp_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_aarch64/build.sh b/kokoro/linux/java_aarch64/build.sh
new file mode 100755
index 0000000..ed5ad53
--- /dev/null
+++ b/kokoro/linux/java_aarch64/build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "continuous" and "presubmit" jobs.
+
+set -ex
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+# Initialize any submodules.
+git submodule update --init --recursive
+
+kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
+
+kokoro/linux/aarch64/test_java_aarch64.sh
diff --git a/kokoro/linux/java_aarch64/continuous.cfg b/kokoro/linux/java_aarch64/continuous.cfg
new file mode 100644
index 0000000..5db46d4
--- /dev/null
+++ b/kokoro/linux/java_aarch64/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/java_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_aarch64/presubmit.cfg b/kokoro/linux/java_aarch64/presubmit.cfg
new file mode 100644
index 0000000..5db46d4
--- /dev/null
+++ b/kokoro/linux/java_aarch64/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/java_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/java_compatibility/build.sh b/kokoro/linux/java_compatibility/build.sh
deleted file mode 100755
index de88454..0000000
--- a/kokoro/linux/java_compatibility/build.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-#
-# This is the top-level script we give to Kokoro as the entry point for
-# running the "pull request" project:
-#
-# This script selects a specific Dockerfile (for building a Docker image) and
-# a script to run inside that image. Then we delegate to the general
-# build_and_run_docker.sh script.
-
-# Change to repo root
-cd $(dirname $0)/../../..
-
-export DOCKERFILE_DIR=kokoro/linux/64-bit
-export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
-export OUTPUT_DIR=testoutput
-export TEST_SET="java_compatibility"
-./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/java_compatibility/continuous.cfg b/kokoro/linux/java_compatibility/continuous.cfg
deleted file mode 100644
index 4897f5c..0000000
--- a/kokoro/linux/java_compatibility/continuous.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/java_compatibility/build.sh"
-timeout_mins: 1440
diff --git a/kokoro/linux/java_compatibility/presubmit.cfg b/kokoro/linux/java_compatibility/presubmit.cfg
deleted file mode 100644
index 4897f5c..0000000
--- a/kokoro/linux/java_compatibility/presubmit.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/java_compatibility/build.sh"
-timeout_mins: 1440
diff --git a/kokoro/linux/javascript_aarch64/build.sh b/kokoro/linux/javascript_aarch64/build.sh
new file mode 100755
index 0000000..dd9f8af
--- /dev/null
+++ b/kokoro/linux/javascript_aarch64/build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "continuous" and "presubmit" jobs.
+
+set -ex
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+# Initialize any submodules.
+git submodule update --init --recursive
+
+kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
+
+kokoro/linux/aarch64/test_javascript_aarch64.sh
diff --git a/kokoro/linux/javascript_aarch64/continuous.cfg b/kokoro/linux/javascript_aarch64/continuous.cfg
new file mode 100644
index 0000000..947bc75
--- /dev/null
+++ b/kokoro/linux/javascript_aarch64/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javascript_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/javascript_aarch64/presubmit.cfg b/kokoro/linux/javascript_aarch64/presubmit.cfg
new file mode 100644
index 0000000..947bc75
--- /dev/null
+++ b/kokoro/linux/javascript_aarch64/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/javascript_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/python_aarch64/build.sh b/kokoro/linux/python_aarch64/build.sh
new file mode 100755
index 0000000..2c67396
--- /dev/null
+++ b/kokoro/linux/python_aarch64/build.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "continuous" and "presubmit" jobs.
+
+set -ex
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
+
+kokoro/linux/aarch64/test_python_aarch64.sh
diff --git a/kokoro/linux/python_aarch64/continuous.cfg b/kokoro/linux/python_aarch64/continuous.cfg
new file mode 100644
index 0000000..dee4a47
--- /dev/null
+++ b/kokoro/linux/python_aarch64/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/python_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/python_aarch64/presubmit.cfg b/kokoro/linux/python_aarch64/presubmit.cfg
new file mode 100644
index 0000000..dee4a47
--- /dev/null
+++ b/kokoro/linux/python_aarch64/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/python_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/ruby_aarch64/build.sh b/kokoro/linux/ruby_aarch64/build.sh
new file mode 100755
index 0000000..6473e0d
--- /dev/null
+++ b/kokoro/linux/ruby_aarch64/build.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# This is the top-level script we give to Kokoro as the entry point for
+# running the "continuous" and "presubmit" jobs.
+
+set -ex
+
+# Change to repo root
+cd $(dirname $0)/../../..
+
+# Initialize any submodules.
+git submodule update --init --recursive
+
+kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh
+
+kokoro/linux/aarch64/test_ruby_aarch64.sh
diff --git a/kokoro/linux/ruby_aarch64/continuous.cfg b/kokoro/linux/ruby_aarch64/continuous.cfg
new file mode 100644
index 0000000..ae82696
--- /dev/null
+++ b/kokoro/linux/ruby_aarch64/continuous.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/ruby_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/linux/ruby_aarch64/presubmit.cfg b/kokoro/linux/ruby_aarch64/presubmit.cfg
new file mode 100644
index 0000000..ae82696
--- /dev/null
+++ b/kokoro/linux/ruby_aarch64/presubmit.cfg
@@ -0,0 +1,11 @@
+# Config file for running tests in Kokoro
+
+# Location of the build script in repository
+build_file: "protobuf/kokoro/linux/ruby_aarch64/build.sh"
+timeout_mins: 120
+
+action {
+ define_artifacts {
+ regex: "**/sponge_log.xml"
+ }
+}
diff --git a/kokoro/release/python/linux/build_artifacts.sh b/kokoro/release/python/linux/build_artifacts.sh
index b676e0e..fc9e740 100755
--- a/kokoro/release/python/linux/build_artifacts.sh
+++ b/kokoro/release/python/linux/build_artifacts.sh
@@ -69,11 +69,3 @@
build_crosscompiled_aarch64_artifact_version 3.7
build_crosscompiled_aarch64_artifact_version 3.8
build_crosscompiled_aarch64_artifact_version 3.9
-
-# Put the aarch64 manylinux wheels under the "unofficial" subdirectory.
-# Only wheels directly under the artifacts/ directory will be published
-# to PyPI as part of the protobuf release process.
-# TODO(jtattermusch): include aarch64 wheels in the release
-# once they are sufficiently tested.
-mkdir -p $ARTIFACT_DIR/unofficial
-mv $ARTIFACT_DIR/protobuf-*-manylinux*_aarch64.whl $ARTIFACT_DIR/unofficial
diff --git a/maven_install.json b/maven_install.json
new file mode 100644
index 0000000..f934218
--- /dev/null
+++ b/maven_install.json
@@ -0,0 +1,261 @@
+{
+ "dependency_tree": {
+ "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": 1033791982,
+ "conflict_resolution": {
+ "com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.5.1",
+ "junit:junit:4.12": "junit:junit:4.13.1"
+ },
+ "dependencies": [
+ {
+ "coord": "cglib:cglib-nodep:2.2.2",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/cglib/cglib-nodep/2.2.2/cglib-nodep-2.2.2.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/cglib/cglib-nodep/2.2.2/cglib-nodep-2.2.2.jar",
+ "https://repo.maven.apache.org/maven2/cglib/cglib-nodep/2.2.2/cglib-nodep-2.2.2.jar"
+ ],
+ "sha256": "e78c7792e59554ed8a23d18a12e3a0d2f7a244217ecf89621477f63aec074f15",
+ "url": "https://repo1.maven.org/maven2/cglib/cglib-nodep/2.2.2/cglib-nodep-2.2.2.jar"
+ },
+ {
+ "coord": "com.google.auto.value:auto-value-annotations:1.7.4",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.7.4/auto-value-annotations-1.7.4.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.7.4/auto-value-annotations-1.7.4.jar",
+ "https://repo.maven.apache.org/maven2/com/google/auto/value/auto-value-annotations/1.7.4/auto-value-annotations-1.7.4.jar"
+ ],
+ "sha256": "fedd59b0b4986c342f6ab2d182f2a4ee9fceb2c7e2d5bdc4dc764c92394a23d3",
+ "url": "https://repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations/1.7.4/auto-value-annotations-1.7.4.jar"
+ },
+ {
+ "coord": "com.google.code.findbugs:jsr305:3.0.2",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar",
+ "https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"
+ ],
+ "sha256": "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7",
+ "url": "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"
+ },
+ {
+ "coord": "com.google.code.gson:gson:2.8.6",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar",
+ "https://repo.maven.apache.org/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar"
+ ],
+ "sha256": "c8fb4839054d280b3033f800d1f5a97de2f028eb8ba2eb458ad287e536f3f25f",
+ "url": "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar"
+ },
+ {
+ "coord": "com.google.errorprone:error_prone_annotations:2.5.1",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.5.1/error_prone_annotations-2.5.1.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.5.1/error_prone_annotations-2.5.1.jar",
+ "https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.5.1/error_prone_annotations-2.5.1.jar"
+ ],
+ "sha256": "ff80626baaf12a09342befd4e84cba9d50662f5fcd7f7a9b3490a6b7cf87e66c",
+ "url": "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.5.1/error_prone_annotations-2.5.1.jar"
+ },
+ {
+ "coord": "com.google.guava:failureaccess:1.0.1",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar",
+ "https://repo.maven.apache.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar"
+ ],
+ "sha256": "a171ee4c734dd2da837e4b16be9df4661afab72a41adaf31eb84dfdaf936ca26",
+ "url": "https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar"
+ },
+ {
+ "coord": "com.google.guava:guava:30.1.1-jre",
+ "dependencies": [
+ "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
+ "com.google.j2objc:j2objc-annotations:1.3",
+ "com.google.code.findbugs:jsr305:3.0.2",
+ "com.google.guava:failureaccess:1.0.1",
+ "com.google.errorprone:error_prone_annotations:2.5.1",
+ "org.checkerframework:checker-qual:3.9.1"
+ ],
+ "directDependencies": [
+ "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
+ "com.google.j2objc:j2objc-annotations:1.3",
+ "com.google.code.findbugs:jsr305:3.0.2",
+ "com.google.guava:failureaccess:1.0.1",
+ "com.google.errorprone:error_prone_annotations:2.5.1",
+ "org.checkerframework:checker-qual:3.9.1"
+ ],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar",
+ "https://repo.maven.apache.org/maven2/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar"
+ ],
+ "sha256": "44ce229ce26d880bf3afc362bbfcec34d7e6903d195bbb1db9f3b6e0d9834f06",
+ "url": "https://repo1.maven.org/maven2/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar"
+ },
+ {
+ "coord": "com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar",
+ "https://repo.maven.apache.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"
+ ],
+ "sha256": "b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99",
+ "url": "https://repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"
+ },
+ {
+ "coord": "com.google.j2objc:j2objc-annotations:1.3",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar",
+ "https://repo.maven.apache.org/maven2/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar"
+ ],
+ "sha256": "21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b",
+ "url": "https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar"
+ },
+ {
+ "coord": "com.google.truth:truth:1.1.2",
+ "dependencies": [
+ "org.ow2.asm:asm:9.0",
+ "org.hamcrest:hamcrest-core:1.3",
+ "com.google.auto.value:auto-value-annotations:1.7.4",
+ "junit:junit:4.13.1",
+ "com.google.guava:guava:30.1.1-jre",
+ "com.google.errorprone:error_prone_annotations:2.5.1",
+ "org.checkerframework:checker-qual:3.9.1"
+ ],
+ "directDependencies": [
+ "org.ow2.asm:asm:9.0",
+ "com.google.auto.value:auto-value-annotations:1.7.4",
+ "junit:junit:4.13.1",
+ "com.google.guava:guava:30.1.1-jre",
+ "com.google.errorprone:error_prone_annotations:2.5.1",
+ "org.checkerframework:checker-qual:3.9.1"
+ ],
+ "file": "v1/https/repo1.maven.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar",
+ "https://repo.maven.apache.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar"
+ ],
+ "sha256": "a85e03b8b6ae8780f060cfded9500a3d1b5f52808f99a2ea6da9c683313c7518",
+ "url": "https://repo1.maven.org/maven2/com/google/truth/truth/1.1.2/truth-1.1.2.jar"
+ },
+ {
+ "coord": "junit:junit:4.13.1",
+ "dependencies": [
+ "org.hamcrest:hamcrest-core:1.3"
+ ],
+ "directDependencies": [
+ "org.hamcrest:hamcrest-core:1.3"
+ ],
+ "file": "v1/https/repo1.maven.org/maven2/junit/junit/4.13.1/junit-4.13.1.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/junit/junit/4.13.1/junit-4.13.1.jar",
+ "https://repo.maven.apache.org/maven2/junit/junit/4.13.1/junit-4.13.1.jar"
+ ],
+ "sha256": "c30719db974d6452793fe191b3638a5777005485bae145924044530ffa5f6122",
+ "url": "https://repo1.maven.org/maven2/junit/junit/4.13.1/junit-4.13.1.jar"
+ },
+ {
+ "coord": "org.checkerframework:checker-qual:3.9.1",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/org/checkerframework/checker-qual/3.9.1/checker-qual-3.9.1.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/org/checkerframework/checker-qual/3.9.1/checker-qual-3.9.1.jar",
+ "https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.9.1/checker-qual-3.9.1.jar"
+ ],
+ "sha256": "ab0468b1ba35bb2ae45f61a60dc4960bd887660ab8f05113a662a7e675eae776",
+ "url": "https://repo1.maven.org/maven2/org/checkerframework/checker-qual/3.9.1/checker-qual-3.9.1.jar"
+ },
+ {
+ "coord": "org.easymock:easymock:3.2",
+ "dependencies": [
+ "cglib:cglib-nodep:2.2.2",
+ "org.objenesis:objenesis:1.3"
+ ],
+ "directDependencies": [
+ "cglib:cglib-nodep:2.2.2",
+ "org.objenesis:objenesis:1.3"
+ ],
+ "file": "v1/https/repo1.maven.org/maven2/org/easymock/easymock/3.2/easymock-3.2.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/org/easymock/easymock/3.2/easymock-3.2.jar",
+ "https://repo.maven.apache.org/maven2/org/easymock/easymock/3.2/easymock-3.2.jar"
+ ],
+ "sha256": "b3dd1cf5019f942d8cc2afad0aa6aef4b21532446fe90a6b68d567e3389763dd",
+ "url": "https://repo1.maven.org/maven2/org/easymock/easymock/3.2/easymock-3.2.jar"
+ },
+ {
+ "coord": "org.easymock:easymockclassextension:3.2",
+ "dependencies": [
+ "org.easymock:easymock:3.2",
+ "cglib:cglib-nodep:2.2.2",
+ "org.objenesis:objenesis:1.3"
+ ],
+ "directDependencies": [
+ "org.easymock:easymock:3.2"
+ ],
+ "file": "v1/https/repo1.maven.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar",
+ "https://repo.maven.apache.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar"
+ ],
+ "sha256": "e2aeb3ecec87d859b2f3072985d4b15873558bcf6410f422db0c0c5194c76c87",
+ "url": "https://repo1.maven.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar"
+ },
+ {
+ "coord": "org.hamcrest:hamcrest-core:1.3",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar",
+ "https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
+ ],
+ "sha256": "66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9",
+ "url": "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
+ },
+ {
+ "coord": "org.objenesis:objenesis:1.3",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/org/objenesis/objenesis/1.3/objenesis-1.3.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/org/objenesis/objenesis/1.3/objenesis-1.3.jar",
+ "https://repo.maven.apache.org/maven2/org/objenesis/objenesis/1.3/objenesis-1.3.jar"
+ ],
+ "sha256": "dd4ef3d3091063a4fec578cbb2bbe6c1f921c00091ba2993dcd9afd25ff9444a",
+ "url": "https://repo1.maven.org/maven2/org/objenesis/objenesis/1.3/objenesis-1.3.jar"
+ },
+ {
+ "coord": "org.ow2.asm:asm:9.0",
+ "dependencies": [],
+ "directDependencies": [],
+ "file": "v1/https/repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar",
+ "mirror_urls": [
+ "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar",
+ "https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar"
+ ],
+ "sha256": "0df97574914aee92fd349d0cb4e00f3345d45b2c239e0bb50f0a90ead47888e0",
+ "url": "https://repo1.maven.org/maven2/org/ow2/asm/asm/9.0/asm-9.0.jar"
+ }
+ ],
+ "version": "0.1.0"
+ }
+}
diff --git a/php/composer.json b/php/composer.json
index 4c1b5ac..5ea49ed 100644
--- a/php/composer.json
+++ b/php/composer.json
@@ -6,7 +6,7 @@
"homepage": "https://developers.google.com/protocol-buffers/",
"license": "BSD-3-Clause",
"require": {
- "php": ">=5.5.0"
+ "php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": ">=5.0.0"
@@ -19,11 +19,12 @@
},
"autoload-dev": {
"psr-4": {
- "": "tests/generated"
+ "": "tmp"
}
},
"scripts": {
- "test": "tests/generate_protos.sh && vendor/bin/phpunit",
- "aggregate_metadata_test": "tests/generate_protos.sh --aggregate_metadata && vendor/bin/phpunit"
+ "test_c": "./generate_test_protos.sh && ./tests/compile_extension.sh && php -dextension=ext/google/protobuf/modules/protobuf.so vendor/bin/phpunit --bootstrap tests/force_c_ext.php tests",
+ "test": "./generate_test_protos.sh && vendor/bin/phpunit tests",
+ "aggregate_metadata_test": "./generate_test_protos.sh --aggregate_metadata && vendor/bin/phpunit tests"
}
}
diff --git a/php/generate_test_protos.sh b/php/generate_test_protos.sh
new file mode 100755
index 0000000..0aa4bdb
--- /dev/null
+++ b/php/generate_test_protos.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+
+cd `dirname $0`
+
+if [[ -d tmp && -z $(find tests/proto ../src/protoc -newer tmp) ]]; then
+ # Generated protos are already present and up to date, so we can skip protoc.
+ #
+ # Protoc is very fast, but sometimes it is not available (like if we haven't
+ # built it in Docker). Skipping it helps us proceed in this case.
+ echo "Test protos are up-to-date, skipping protoc."
+ exit 0
+fi
+
+rm -rf tmp
+mkdir -p tmp
+
+find tests/proto -type f -name "*.proto"| xargs ../src/protoc --php_out=tmp -I../src -Itests
+
+if [ "$1" = "--aggregate_metadata" ]; then
+ # Overwrite some of the files to use aggregation.
+ AGGREGATED_FILES="tests/proto/test.proto tests/proto/test_include.proto tests/proto/test_import_descriptor_proto.proto"
+ ../src/protoc --php_out=aggregate_metadata=foo#bar:tmp -I../src -Itests $AGGREGATED_FILES
+fi
+
+echo "Generated test protos from tests/proto -> tmp"
diff --git a/php/phpunit.xml b/php/phpunit.xml
deleted file mode 100644
index 8e75835..0000000
--- a/php/phpunit.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="./tests/bootstrap_phpunit.php"
- colors="true">
- <testsuites>
- <testsuite name="protobuf-tests">
- <file>tests/PhpImplementationTest.php</file>
- <file>tests/ArrayTest.php</file>
- <file>tests/EncodeDecodeTest.php</file>
- <file>tests/GeneratedClassTest.php</file>
- <file>tests/GeneratedPhpdocTest.php</file>
- <file>tests/MapFieldTest.php</file>
- <file>tests/WellKnownTest.php</file>
- <file>tests/DescriptorsTest.php</file>
- <file>tests/GeneratedServiceTest.php</file>
- <file>tests/WrapperTypeSettersTest.php</file>
- </testsuite>
- </testsuites>
-</phpunit>
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php
index 64aadf9..e74943c 100644
--- a/php/src/Google/Protobuf/Internal/Message.php
+++ b/php/src/Google/Protobuf/Internal/Message.php
@@ -1188,6 +1188,7 @@
$v->mergeFromJsonArray($value, $ignore_unknown);
$fields[$key] = $v;
}
+ return;
}
if (is_a($this, "Google\Protobuf\Value")) {
if (is_bool($array)) {
@@ -1241,7 +1242,13 @@
if (is_null($field)) {
$field = $this->desc->getFieldByName($key);
if (is_null($field)) {
- continue;
+ if ($ignore_unknown) {
+ continue;
+ } else {
+ throw new GPBDecodeException(
+ $key . ' is unknown.'
+ );
+ }
}
}
if ($field->isMap()) {
diff --git a/php/tests/DescriptorsTest.php b/php/tests/DescriptorsTest.php
index ca7e8f3..4f17a49 100644
--- a/php/tests/DescriptorsTest.php
+++ b/php/tests/DescriptorsTest.php
@@ -1,7 +1,5 @@
<?php
-require_once('generated/Descriptors/TestDescriptorsEnum.php');
-require_once('generated/Descriptors/TestDescriptorsMessage.php');
require_once('test_base.php');
require_once('test_util.php');
diff --git a/php/tests/EncodeDecodeTest.php b/php/tests/EncodeDecodeTest.php
index d471a5a..b7c1ab2 100644
--- a/php/tests/EncodeDecodeTest.php
+++ b/php/tests/EncodeDecodeTest.php
@@ -45,6 +45,20 @@
$this->assertEquals(1, $m->getOptionalInt32());
}
+ public function testDecodeJsonUnknown()
+ {
+ $this->expectException(Exception::class);
+
+ $m = new TestMessage();
+ $m->mergeFromJsonString("{\"unknown\":1}");
+ }
+
+ public function testDecodeJsonIgnoreUnknown()
+ {
+ $m = new TestMessage();
+ $m->mergeFromJsonString("{\"unknown\":1}", true);
+ }
+
public function testDecodeTopLevelBoolValue()
{
$m = new BoolValue();
diff --git a/php/tests/GeneratedClassTest.php b/php/tests/GeneratedClassTest.php
index f2a9fb0..8759391 100644
--- a/php/tests/GeneratedClassTest.php
+++ b/php/tests/GeneratedClassTest.php
@@ -1,7 +1,5 @@
<?php
-require_once('generated/NoNamespaceEnum.php');
-require_once('generated/NoNamespaceMessage.php');
require_once('test_base.php');
require_once('test_util.php');
@@ -759,10 +757,10 @@
public function testMessageWithoutNamespace()
{
$m = new TestMessage();
- $n = new NoNameSpaceMessage();
+ $n = new NoNamespaceMessage();
$m->setOptionalNoNamespaceMessage($n);
$repeatedNoNamespaceMessage = $m->getRepeatedNoNamespaceMessage();
- $repeatedNoNamespaceMessage[] = new NoNameSpaceMessage();
+ $repeatedNoNamespaceMessage[] = new NoNamespaceMessage();
$m->setRepeatedNoNamespaceMessage($repeatedNoNamespaceMessage);
// test nested messages
@@ -775,9 +773,9 @@
public function testEnumWithoutNamespace()
{
$m = new TestMessage();
- $m->setOptionalNoNamespaceEnum(NoNameSpaceEnum::VALUE_A);
+ $m->setOptionalNoNamespaceEnum(NoNamespaceEnum::VALUE_A);
$repeatedNoNamespaceEnum = $m->getRepeatedNoNamespaceEnum();
- $repeatedNoNamespaceEnum[] = NoNameSpaceEnum::VALUE_A;
+ $repeatedNoNamespaceEnum[] = NoNamespaceEnum::VALUE_A;
$m->setRepeatedNoNamespaceEnum($repeatedNoNamespaceEnum);
$this->assertTrue(true);
}
diff --git a/php/tests/GeneratedPhpdocTest.php b/php/tests/GeneratedPhpdocTest.php
index 18963a9..a0b912b 100644
--- a/php/tests/GeneratedPhpdocTest.php
+++ b/php/tests/GeneratedPhpdocTest.php
@@ -1,7 +1,5 @@
<?php
-require_once('generated/NoNamespaceEnum.php');
-require_once('generated/NoNamespaceMessage.php');
require_once('test_base.php');
require_once('test_util.php');
diff --git a/php/tests/PhpImplementationTest.php b/php/tests/PhpImplementationTest.php
index 82d0c5a..7187315 100644
--- a/php/tests/PhpImplementationTest.php
+++ b/php/tests/PhpImplementationTest.php
@@ -18,7 +18,7 @@
* Please note, this test is only intended to be run without the protobuf C
* extension.
*/
-class ImplementationTest extends TestBase
+class PhpImplementationTest extends TestBase
{
/**
* Avoid calling setUp, which has void return type (not avalialbe in php7.0).
diff --git a/php/tests/autoload.php b/php/tests/autoload.php
deleted file mode 100644
index b98b13a..0000000
--- a/php/tests/autoload.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-error_reporting(E_ALL);
-
-function getGeneratedFiles($dir, &$results = array())
-{
- $files = scandir($dir);
-
- foreach ($files as $key => $value) {
- $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
- if (!is_dir($path)) {
- $results[] = $path;
- } else if ($value != "." && $value != "..") {
- getGeneratedFiles($path, $results);
- }
- }
- return $results;
-}
-
-foreach (getGeneratedFiles("generated") as $filename)
-{
- if (!is_dir($filename)) {
- include_once $filename;
- }
-
-}
-
diff --git a/php/tests/bootstrap_phpunit.php b/php/tests/bootstrap_phpunit.php
deleted file mode 100644
index 8452f15..0000000
--- a/php/tests/bootstrap_phpunit.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-require_once("vendor/autoload.php");
-
-error_reporting(E_ALL);
diff --git a/php/tests/compile_extension.sh b/php/tests/compile_extension.sh
index 85c73c6..d26fcb4 100755
--- a/php/tests/compile_extension.sh
+++ b/php/tests/compile_extension.sh
@@ -1,20 +1,26 @@
#!/bin/bash
-set -ex
+set -e
cd $(dirname $0)
../prepare_c_extension.sh
-pushd ../ext/google/protobuf
-phpize --clean
-rm -f configure.in configure.ac
-phpize
-if [ "$1" = "--release" ]; then
- ./configure --with-php-config=$(which php-config)
-else
- # To get debugging symbols in PHP itself, build PHP with:
- # $ ./configure --enable-debug CFLAGS='-g -O0'
- ./configure --with-php-config=$(which php-config) CFLAGS="-g -O0 -Wall"
+pushd ../ext/google/protobuf > /dev/null
+
+CONFIGURE_OPTIONS=("./configure" "--with-php-config=$(which php-config)")
+
+if [ "$1" != "--release" ]; then
+ CONFIGURE_OPTIONS+=("CFLAGS=-g -O0 -Wall")
fi
+
+# If the PHP interpreter we are building against or the arguments
+# have changed, we must regenerated the Makefile.
+if [[ ! -f Makefile ]] || [[ "$(grep ' \$ ./configure' config.log)" != " $ ${CONFIGURE_OPTIONS[@]}" ]]; then
+ phpize --clean
+ rm -f configure.in configure.ac
+ phpize
+ "${CONFIGURE_OPTIONS[@]}"
+fi
+
make
-popd
+popd > /dev/null
diff --git a/php/tests/force_c_ext.php b/php/tests/force_c_ext.php
new file mode 100644
index 0000000..afc63c5
--- /dev/null
+++ b/php/tests/force_c_ext.php
@@ -0,0 +1,14 @@
+<?php
+
+// We have to test this because the command-line argument will fail silently
+// if the extension could not be loaded:
+// php -dextension=ext/google/protobuf/modules/protouf.so
+if (!extension_loaded("protobuf")) {
+ throw new Exception("Protobuf extension not loaded");
+}
+
+spl_autoload_register(function($class) {
+ if (strpos($class, "Google\\Protobuf") === 0) {
+ throw new Exception("When using the C extension, we should not load runtime class: " . $class);
+ }
+}, true, true);
diff --git a/php/tests/generate_protos.sh b/php/tests/generate_protos.sh
deleted file mode 100755
index e83c3c1..0000000
--- a/php/tests/generate_protos.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-cd `dirname $0`
-
-rm -rf generated
-mkdir -p generated
-
-find proto -type f -name "*.proto"| xargs ../../src/protoc --experimental_allow_proto3_optional --php_out=generated -I../../src -I.
-
-if [ "$1" = "--aggregate_metadata" ]; then
- # Overwrite some of the files to use aggregation.
- AGGREGATED_FILES="proto/test.proto proto/test_include.proto proto/test_import_descriptor_proto.proto"
- ../../src/protoc --experimental_allow_proto3_optional --php_out=aggregate_metadata=foo#bar:generated -I../../src -I. $AGGREGATED_FILES
-fi
diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php
index a9c292d..1f2d095 100644
--- a/php/tests/memory_leak_test.php
+++ b/php/tests/memory_leak_test.php
@@ -2,57 +2,7 @@
# phpunit has memory leak by itself. Thus, it cannot be used to test memory leak.
-require_once('generated/NoNamespaceEnum.php');
-require_once('generated/NoNamespaceMessage.php');
-require_once('generated/NoNamespaceMessage/NestedEnum.php');
-require_once('generated/NoNamespaceMessage/NestedMessage.php');
-require_once('generated/PrefixEmpty.php');
-require_once('generated/PrefixTestPrefix.php');
-require_once('generated/PrefixTestPrefix/PrefixNestedEnum.php');
-require_once('generated/PrefixTestPrefix/PrefixNestedMessage.php');
-require_once('generated/TestEmptyNamespace.php');
-require_once('generated/TestEmptyNamespace/NestedEnum.php');
-require_once('generated/TestEmptyNamespace/NestedMessage.php');
-require_once('generated/Bar/TestInclude.php');
-require_once('generated/Bar/TestLegacyMessage.php');
-require_once('generated/Bar/TestLegacyMessage/NestedEnum.php');
-require_once('generated/Bar/TestLegacyMessage/NestedMessage.php');
-require_once('generated/Foo/PBARRAY.php');
-require_once('generated/Foo/PBEmpty.php');
-require_once('generated/Foo/TestAny.php');
-require_once('generated/Foo/TestBoolValue.php');
-require_once('generated/Foo/TestBytesValue.php');
-require_once('generated/Foo/TestEnum.php');
-require_once('generated/Foo/TestIncludeNamespaceMessage.php');
-require_once('generated/Foo/TestIncludePrefixMessage.php');
-require_once('generated/Foo/TestInt32Value.php');
-require_once('generated/Foo/TestInt64Value.php');
-require_once('generated/Foo/TestMessage.php');
-require_once('generated/Foo/TestMessage/PBEmpty.php');
-require_once('generated/Foo/TestMessage/NestedEnum.php');
-require_once('generated/Foo/TestMessage/Sub.php');
-require_once('generated/Foo/TestPackedMessage.php');
-require_once('generated/Foo/TestPhpDoc.php');
-require_once('generated/Foo/TestRandomFieldOrder.php');
-require_once('generated/Foo/TestReverseFieldOrder.php');
-require_once('generated/Foo/TestStringValue.php');
-require_once('generated/Foo/TestUInt32Value.php');
-require_once('generated/Foo/TestUInt64Value.php');
-require_once('generated/Foo/TestUnpackedMessage.php');
-require_once('generated/Foo/testLowerCaseMessage.php');
-require_once('generated/Foo/testLowerCaseEnum.php');
-require_once('generated/GPBMetadata/Proto/Test.php');
-require_once('generated/TestEmptyPhpNamespace.php');
-require_once('generated/GPBMetadata/Proto/TestInclude.php');
-require_once('generated/TestNoNamespace.php');
-require_once('generated/Metadata/Php/Test/TestPhpNamespace.php');
-require_once('generated/GPBMetadata/Proto/TestPrefix.php');
-require_once('generated/Php/Test/TestNamespace.php');
-require_once('generated/Php/Test/TestNamespace/PBEmpty.php');
-require_once('generated/Php/Test/TestNamespace/PBEmpty/NestedEnum.php');
-require_once('generated/Php/Test/TestNamespace/PBEmpty/NestedMessage.php');
-require_once('generated/Php/Test/TestNamespace/NestedEnum.php');
-require_once('generated/Php/Test/TestNamespace/NestedMessage.php');
+require_once('../vendor/autoload.php');
require_once('test_util.php');
use Google\Protobuf\Internal\RepeatedField;
diff --git a/php/tests/test.sh b/php/tests/test.sh
deleted file mode 100755
index d04f36a..0000000
--- a/php/tests/test.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-cd $(dirname $0)
-
-./generate_protos.sh
-./compile_extension.sh
-
-PHP_VERSION=$(php -r "echo PHP_VERSION;")
-
-# Each version of PHPUnit supports a fairly narrow range of PHP versions.
-case "$PHP_VERSION" in
- 7.0.*)
- PHPUNIT=phpunit-6.phar
- ;;
- 7.1.*|7.2.*)
- PHPUNIT=phpunit-7.5.0.phar
- ;;
- 7.3.*|7.4.*)
- PHPUNIT=phpunit-8.phar
- ;;
- 8.0.*)
- PHPUNIT=phpunit-9.phar
- ;;
- *)
- echo "ERROR: Unsupported PHP version $PHP_VERSION"
- exit 1
- ;;
-esac
-
-[ -f $PHPUNIT ] || wget https://phar.phpunit.de/$PHPUNIT
-
-tests=( ArrayTest.php EncodeDecodeTest.php GeneratedClassTest.php MapFieldTest.php WellKnownTest.php DescriptorsTest.php WrapperTypeSettersTest.php)
-
-for t in "${tests[@]}"
-do
- echo "****************************"
- echo "* $t"
- echo "****************************"
- php -dextension=../ext/google/protobuf/modules/protobuf.so $PHPUNIT --bootstrap autoload.php $t
- echo ""
-done
-
-for t in "${tests[@]}"
-do
- echo "****************************"
- echo "* $t persistent"
- echo "****************************"
- php -d protobuf.keep_descriptor_pool_after_request=1 -dextension=../ext/google/protobuf/modules/protobuf.so $PHPUNIT --bootstrap autoload.php $t
- echo ""
-done
-
-# # Make sure to run the memory test in debug mode.
-# php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
-
-export ZEND_DONT_UNLOAD_MODULES=1
-export USE_ZEND_ALLOC=0
-valgrind --suppressions=valgrind.supp --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
-valgrind --suppressions=valgrind.supp --leak-check=yes php -d protobuf.keep_descriptor_pool_after_request=1 -dextension=../ext/google/protobuf/modules/protobuf.so memory_leak_test.php
-
-# TODO(teboring): Only for debug (phpunit has memory leak which blocks this beging used by
-# regression test.)
-
-# for t in "${tests[@]}"
-# do
-# echo "****************************"
-# echo "* $t (memory leak)"
-# echo "****************************"
-# valgrind --leak-check=yes php -dextension=../ext/google/protobuf/modules/protobuf.so $PHPUNIT --bootstrap autoload.php $t
-# echo ""
-# done
diff --git a/php/tests/undefined_test.php b/php/tests/undefined_test.php
deleted file mode 100644
index 935d8be..0000000
--- a/php/tests/undefined_test.php
+++ /dev/null
@@ -1,920 +0,0 @@
-<?php
-
-require_once('test_util.php');
-
-use Google\Protobuf\Internal\RepeatedField;
-use Google\Protobuf\Internal\GPBType;
-use Foo\TestMessage;
-use Foo\TestMessage\Sub;
-
-class UndefinedTest extends PHPUnit_Framework_TestCase
-{
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32AppendStringFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32SetStringFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[] = 0;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32AppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32SetMessageFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[] = 0;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32AppendStringFail()
- {
- $arr = new RepeatedField(GPBType::UINT32);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32SetStringFail()
- {
- $arr = new RepeatedField(GPBType::UINT32);
- $arr[] = 0;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32AppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::UINT32);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32SetMessageFail()
- {
- $arr = new RepeatedField(GPBType::UINT32);
- $arr[] = 0;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64AppendStringFail()
- {
- $arr = new RepeatedField(GPBType::INT64);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64SetStringFail()
- {
- $arr = new RepeatedField(GPBType::INT64);
- $arr[] = 0;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64AppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::INT64);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64SetMessageFail()
- {
- $arr = new RepeatedField(GPBType::INT64);
- $arr[] = 0;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64AppendStringFail()
- {
- $arr = new RepeatedField(GPBType::UINT64);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64SetStringFail()
- {
- $arr = new RepeatedField(GPBType::UINT64);
- $arr[] = 0;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64AppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::UINT64);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64SetMessageFail()
- {
- $arr = new RepeatedField(GPBType::UINT64);
- $arr[] = 0;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testFloatAppendStringFail()
- {
- $arr = new RepeatedField(GPBType::FLOAT);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testFloatSetStringFail()
- {
- $arr = new RepeatedField(GPBType::FLOAT);
- $arr[] = 0.0;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testFloatAppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::FLOAT);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testFloatSetMessageFail()
- {
- $arr = new RepeatedField(GPBType::FLOAT);
- $arr[] = 0.0;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleAppendStringFail()
- {
- $arr = new RepeatedField(GPBType::DOUBLE);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleSetStringFail()
- {
- $arr = new RepeatedField(GPBType::DOUBLE);
- $arr[] = 0.0;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleAppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::DOUBLE);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleSetMessageFail()
- {
- $arr = new RepeatedField(GPBType::DOUBLE);
- $arr[] = 0.0;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testBoolAppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::BOOL);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testBoolSetMessageFail()
- {
- $arr = new RepeatedField(GPBType::BOOL);
- $arr[] = true;
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringAppendMessageFail()
- {
- $arr = new RepeatedField(GPBType::STRING);
- $arr[] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringSetMessageFail()
- {
- $arr = new RepeatedField(GPBType::STRING);
- $arr[] = 'abc';
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringAppendInvalidUTF8Fail()
- {
- $arr = new RepeatedField(GPBType::STRING);
- $hex = hex2bin("ff");
- $arr[] = $hex;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringSetInvalidUTF8Fail()
- {
- $arr = new RepeatedField(GPBType::STRING);
- $arr[] = 'abc';
- $hex = hex2bin("ff");
- $arr[0] = $hex;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageAppendIntFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = 1;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetIntFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new Sub;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageAppendStringFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetStringFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new Sub;
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageAppendOtherMessageFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new TestMessage;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageAppendNullFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $null = null;
- $arr[] = $null;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetNullFail()
- {
- $arr = new RepeatedField(GPBType::MESSAGE, Sub::class);
- $arr[] = new Sub();
- $null = null;
- $arr[0] = $null;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testRemoveMiddleFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
-
- $arr[] = 0;
- $arr[] = 1;
- $arr[] = 2;
- $this->assertSame(3, count($arr));
-
- unset($arr[1]);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testRemoveEmptyFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
-
- unset($arr[0]);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageOffsetFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[] = 0;
- $arr[new Sub()] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringOffsetFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[] = 0;
- $arr['abc'] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testSetNonExistedOffsetFail()
- {
- $arr = new RepeatedField(GPBType::INT32);
- $arr[0] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32FieldInvalidTypeFail()
- {
- $m = new TestMessage();
- $m->setOptionalInt32(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32FieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalInt32('abc');
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32FieldInvalidTypeFail()
- {
- $m = new TestMessage();
- $m->setOptionalUint32(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32FieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalUint32('abc');
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64FieldInvalidTypeFail()
- {
- $m = new TestMessage();
- $m->setOptionalInt64(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64FieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalInt64('abc');
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64FieldInvalidTypeFail()
- {
- $m = new TestMessage();
- $m->setOptionalUint64(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64FieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalUint64('abc');
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testFloatFieldInvalidTypeFail()
- {
- $m = new TestMessage();
- $m->setOptionalFloat(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testFloatFieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalFloat('abc');
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleFieldInvalidTypeFail()
- {
- $m = new TestMessage();
- $m->setOptionalDouble(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleFieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalDouble('abc');
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testBoolFieldInvalidStringFail()
- {
- $m = new TestMessage();
- $m->setOptionalBool(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringFieldInvalidUTF8Fail()
- {
- $m = new TestMessage();
- $hex = hex2bin("ff");
- $m->setOptionalString($hex);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageFieldWrongTypeFail()
- {
- $m = new TestMessage();
- $a = 1;
- $m->setOptionalMessage($a);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageFieldWrongClassFail()
- {
- $m = new TestMessage();
- $m->setOptionalMessage(new TestMessage());
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testRepeatedFieldWrongTypeFail()
- {
- $m = new TestMessage();
- $a = 1;
- $m->setRepeatedInt32($a);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testRepeatedFieldWrongObjectFail()
- {
- $m = new TestMessage();
- $m->setRepeatedInt32($m);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testRepeatedFieldWrongRepeatedTypeFail()
- {
- $m = new TestMessage();
-
- $repeated_int32 = new RepeatedField(GPBType::UINT32);
- $m->setRepeatedInt32($repeated_int32);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testRepeatedFieldWrongRepeatedMessageClassFail()
- {
- $m = new TestMessage();
-
- $repeated_message = new RepeatedField(GPBType::MESSAGE,
- TestMessage::class);
- $m->setRepeatedMessage($repeated_message);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMapFieldWrongTypeFail()
- {
- $m = new TestMessage();
- $a = 1;
- $m->setMapInt32Int32($a);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMapFieldWrongObjectFail()
- {
- $m = new TestMessage();
- $m->setMapInt32Int32($m);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMapFieldWrongRepeatedTypeFail()
- {
- $m = new TestMessage();
-
- $map_uint32_uint32 = new MapField(GPBType::UINT32, GPBType::UINT32);
- $m->setMapInt32Int32($map_uint32_uint32);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMapFieldWrongRepeatedMessageClassFail()
- {
- $m = new TestMessage();
-
- $map_int32_message = new MapField(GPBType::INT32,
- GPBType::MESSAGE,
- TestMessage::class);
- $m->setMapInt32Message($map_int32_message);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageMergeFromInvalidTypeFail()
- {
- $m = new TestMessage();
- $n = new Sub();
- $m->mergeFrom($n);
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32SetStringKeyFail()
- {
- $arr = new MapField(GPBType::INT32, GPBType::INT32);
- $arr['abc'] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32SetStringValueFail()
- {
- $arr = new MapField(GPBType::INT32, GPBType::INT32);
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32SetMessageKeyFail()
- {
- $arr = new MapField(GPBType::INT32, GPBType::INT32);
- $arr[new Sub()] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt32SetMessageValueFail()
- {
- $arr = new MapField(GPBType::INT32, GPBType::INT32);
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32SetStringKeyFail()
- {
- $arr = new MapField(GPBType::UINT32, GPBType::UINT32);
- $arr['abc'] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32SetStringValueFail()
- {
- $arr = new MapField(GPBType::UINT32, GPBType::UINT32);
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32SetMessageKeyFail()
- {
- $arr = new MapField(GPBType::UINT32, GPBType::UINT32);
- $arr[new Sub()] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint32SetMessageValueFail()
- {
- $arr = new MapField(GPBType::UINT32, GPBType::UINT32);
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64SetStringKeyFail()
- {
- $arr = new MapField(GPBType::INT64, GPBType::INT64);
- $arr['abc'] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64SetStringValueFail()
- {
- $arr = new MapField(GPBType::INT64, GPBType::INT64);
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64SetMessageKeyFail()
- {
- $arr = new MapField(GPBType::INT64, GPBType::INT64);
- $arr[new Sub()] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testInt64SetMessageValueFail()
- {
- $arr = new MapField(GPBType::INT64, GPBType::INT64);
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64SetStringKeyFail()
- {
- $arr = new MapField(GPBType::UINT64, GPBType::UINT64);
- $arr['abc'] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64SetStringValueFail()
- {
- $arr = new MapField(GPBType::UINT64, GPBType::UINT64);
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64SetMessageKeyFail()
- {
- $arr = new MapField(GPBType::UINT64, GPBType::UINT64);
- $arr[new Sub()] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testUint64SetMessageValueFail()
- {
- $arr = new MapField(GPBType::UINT64, GPBType::UINT64);
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleSetStringValueFail()
- {
- $arr = new MapField(GPBType::INT64, GPBType::DOUBLE);
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testDoubleSetMessageValueFail()
- {
- $arr = new MapField(GPBType::INT64, GPBType::DOUBLE);
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testBoolSetMessageKeyFail()
- {
- $arr = new MapField(GPBType::BOOL, GPBType::BOOL);
- $arr[new Sub()] = true;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testBoolSetMessageValueFail()
- {
- $arr = new MapField(GPBType::BOOL, GPBType::BOOL);
- $arr[true] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringSetInvalidUTF8KeyFail()
- {
- $arr = new MapField(GPBType::STRING, GPBType::STRING);
- $arr[hex2bin("ff")] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringSetInvalidUTF8ValueFail()
- {
- $arr = new MapField(GPBType::STRING, GPBType::STRING);
- $arr['abc'] = hex2bin("ff");
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringSetMessageKeyFail()
- {
- $arr = new MapField(GPBType::STRING, GPBType::STRING);
- $arr[new Sub()] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testStringSetMessageValueFail()
- {
- $arr = new MapField(GPBType::STRING, GPBType::STRING);
- $arr['abc'] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetIntValueFail()
- {
- $arr =
- new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class);
- $arr[0] = 0;
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetStringValueFail()
- {
- $arr =
- new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class);
- $arr[0] = 'abc';
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetOtherMessageValueFail()
- {
- $arr =
- new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class);
- $arr[0] = new Sub();
- }
-
- /**
- * @expectedException PHPUnit_Framework_Error
- */
- public function testMessageSetNullFailMap()
- {
- $arr =
- new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class);
- $null = NULL;
- $arr[0] = $null;
- }
-
-}
diff --git a/protobuf.bzl b/protobuf.bzl
index 12d3edb..a47711c 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -328,7 +328,12 @@
deps = [d[ProtoInfo] for d in ctx.attr.deps]
srcjar = ctx.actions.declare_file("{}.srcjar".format(ctx.attr.name))
- args.add("--java_out", srcjar)
+ if ctx.attr.javalite:
+ java_out = "lite:%s" % srcjar.path
+ else:
+ java_out = srcjar
+
+ args.add("--java_out", java_out)
descriptors = depset(
transitive = [dep.transitive_descriptor_sets for dep in deps],
@@ -368,6 +373,9 @@
mandatory = True,
providers = [ProtoInfo],
),
+ "javalite": attr.bool(
+ default = False,
+ ),
"_protoc": attr.label(
executable = True,
cfg = "host",
diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl
index a950085..bacee11 100644
--- a/protobuf_deps.bzl
+++ b/protobuf_deps.bzl
@@ -51,9 +51,9 @@
if not native.existing_rule("rules_proto"):
http_archive(
name = "rules_proto",
- sha256 = "aa1ee19226f707d44bee44c720915199c20c84a23318bb0597ed4e5c873ccbd5",
- strip_prefix = "rules_proto-40298556293ae502c66579620a7ce867d5f57311",
- urls = ["https://github.com/bazelbuild/rules_proto/archive/40298556293ae502c66579620a7ce867d5f57311.tar.gz"],
+ sha256 = "a4382f78723af788f0bc19fd4c8411f44ffe0a72723670a34692ffad56ada3ac",
+ strip_prefix = "rules_proto-f7a30f6f80006b591fa7c437fe5a951eb10bcbcf",
+ urls = ["https://github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.zip"],
)
if not native.existing_rule("rules_python"):
@@ -63,3 +63,11 @@
strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
)
+
+ if not native.existing_rule("rules_jvm_external"):
+ http_archive(
+ name = "rules_jvm_external",
+ sha256 = "31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169",
+ strip_prefix = "rules_jvm_external-4.0",
+ urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/4.0.zip"],
+ )
diff --git a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto b/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto
deleted file mode 100644
index 9f55e03..0000000
--- a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test1.proto
+++ /dev/null
@@ -1,55 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: matthewtoia@google.com (Matt Toia)
-
-
-package google.protobuf.python.internal;
-
-
-enum Factory1Enum {
- FACTORY_1_VALUE_0 = 0;
- FACTORY_1_VALUE_1 = 1;
-}
-
-message Factory1Message {
- optional Factory1Enum factory_1_enum = 1;
- enum NestedFactory1Enum {
- NESTED_FACTORY_1_VALUE_0 = 0;
- NESTED_FACTORY_1_VALUE_1 = 1;
- }
- optional NestedFactory1Enum nested_factory_1_enum = 2;
- message NestedFactory1Message {
- optional string value = 1;
- }
- optional NestedFactory1Message nested_factory_1_message = 3;
- optional int32 scalar_value = 4;
- repeated string list_value = 5;
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto b/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto
deleted file mode 100644
index d3ce4d7..0000000
--- a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/factory_test2.proto
+++ /dev/null
@@ -1,77 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: matthewtoia@google.com (Matt Toia)
-
-
-package google.protobuf.python.internal;
-
-import "google/protobuf/internal/factory_test1.proto";
-
-
-enum Factory2Enum {
- FACTORY_2_VALUE_0 = 0;
- FACTORY_2_VALUE_1 = 1;
-}
-
-message Factory2Message {
- required int32 mandatory = 1;
- optional Factory2Enum factory_2_enum = 2;
- enum NestedFactory2Enum {
- NESTED_FACTORY_2_VALUE_0 = 0;
- NESTED_FACTORY_2_VALUE_1 = 1;
- }
- optional NestedFactory2Enum nested_factory_2_enum = 3;
- message NestedFactory2Message {
- optional string value = 1;
- }
- optional NestedFactory2Message nested_factory_2_message = 4;
- optional Factory1Message factory_1_message = 5;
- optional Factory1Enum factory_1_enum = 6;
- optional Factory1Message.NestedFactory1Enum nested_factory_1_enum = 7;
- optional Factory1Message.NestedFactory1Message nested_factory_1_message = 8;
- optional Factory2Message circular_message = 9;
- optional string scalar_value = 10;
- repeated string list_value = 11;
- repeated group Grouped = 12 {
- optional string part_1 = 13;
- optional string part_2 = 14;
- }
- optional LoopMessage loop = 15;
- optional int32 int_with_default = 16 [default = 1776];
- optional double double_with_default = 17 [default = 9.99];
- optional string string_with_default = 18 [default = "hello world"];
- optional bool bool_with_default = 19 [default = false];
- optional Factory2Enum enum_with_default = 20 [default = FACTORY_2_VALUE_1];
-}
-
-message LoopMessage {
- optional Factory2Message loop = 1;
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto b/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto
deleted file mode 100644
index e2d9701..0000000
--- a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions.proto
+++ /dev/null
@@ -1,58 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: robinson@google.com (Will Robinson)
-
-
-package google.protobuf.internal;
-
-
-message TopLevelMessage {
- optional ExtendedMessage submessage = 1;
-}
-
-
-message ExtendedMessage {
- extensions 1 to max;
-}
-
-
-message ForeignMessage {
- optional int32 foreign_message_int = 1;
-}
-
-
-extend ExtendedMessage {
- optional int32 optional_int_extension = 1;
- optional ForeignMessage optional_message_extension = 2;
-
- repeated int32 repeated_int_extension = 3;
- repeated ForeignMessage repeated_message_extension = 4;
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto b/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto
deleted file mode 100644
index df98ac4..0000000
--- a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_extensions_dynamic.proto
+++ /dev/null
@@ -1,49 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: jasonh@google.com (Jason Hsueh)
-//
-// This file is used to test a corner case in the CPP implementation where the
-// generated C++ type is available for the extendee, but the extension is
-// defined in a file whose C++ type is not in the binary.
-
-
-import "google/protobuf/internal/more_extensions.proto";
-
-package google.protobuf.internal;
-
-message DynamicMessageType {
- optional int32 a = 1;
-}
-
-extend ExtendedMessage {
- optional int32 dynamic_int32_extension = 100;
- optional DynamicMessageType dynamic_message_extension = 101;
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto b/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto
deleted file mode 100644
index c701b44..0000000
--- a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/more_messages.proto
+++ /dev/null
@@ -1,51 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: robinson@google.com (Will Robinson)
-
-
-package google.protobuf.internal;
-
-// A message where tag numbers are listed out of order, to allow us to test our
-// canonicalization of serialized output, which should always be in tag order.
-// We also mix in some extensions for extra fun.
-message OutOfOrderFields {
- optional sint32 optional_sint32 = 5;
- extensions 4 to 4;
- optional uint32 optional_uint32 = 3;
- extensions 2 to 2;
- optional int32 optional_int32 = 1;
-};
-
-
-extend OutOfOrderFields {
- optional uint64 optional_uint64 = 4;
- optional int64 optional_int64 = 2;
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto b/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto
deleted file mode 100644
index 6a82299..0000000
--- a/python/compatibility_tests/v2.5.0/protos/python/google/protobuf/internal/test_bad_identifiers.proto
+++ /dev/null
@@ -1,52 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-
-
-package protobuf_unittest;
-
-option py_generic_services = true;
-
-message TestBadIdentifiers {
- extensions 100 to max;
-}
-
-// Make sure these reasonable extension names don't conflict with internal
-// variables.
-extend TestBadIdentifiers {
- optional string message = 100 [default="foo"];
- optional string descriptor = 101 [default="bar"];
- optional string reflection = 102 [default="baz"];
- optional string service = 103 [default="qux"];
-}
-
-message AnotherMessage {}
-service AnotherService {}
diff --git a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
deleted file mode 100644
index 95c8d4d..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/descriptor.proto
+++ /dev/null
@@ -1,620 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// The messages in this file describe the definitions found in .proto files.
-// A valid .proto file can be translated directly to a FileDescriptorProto
-// without any other information (e.g. without reading its imports).
-
-
-
-package google.protobuf;
-option java_package = "com.google.protobuf";
-option java_outer_classname = "DescriptorProtos";
-
-// descriptor.proto must be optimized for speed because reflection-based
-// algorithms don't work during bootstrapping.
-option optimize_for = SPEED;
-
-// The protocol compiler can output a FileDescriptorSet containing the .proto
-// files it parses.
-message FileDescriptorSet {
- repeated FileDescriptorProto file = 1;
-}
-
-// Describes a complete .proto file.
-message FileDescriptorProto {
- optional string name = 1; // file name, relative to root of source tree
- optional string package = 2; // e.g. "foo", "foo.bar", etc.
-
- // Names of files imported by this file.
- repeated string dependency = 3;
- // Indexes of the public imported files in the dependency list above.
- repeated int32 public_dependency = 10;
- // Indexes of the weak imported files in the dependency list.
- // For Google-internal migration only. Do not use.
- repeated int32 weak_dependency = 11;
-
- // All top-level definitions in this file.
- repeated DescriptorProto message_type = 4;
- repeated EnumDescriptorProto enum_type = 5;
- repeated ServiceDescriptorProto service = 6;
- repeated FieldDescriptorProto extension = 7;
-
- optional FileOptions options = 8;
-
- // 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.
- optional SourceCodeInfo source_code_info = 9;
-}
-
-// Describes a message type.
-message DescriptorProto {
- optional string name = 1;
-
- repeated FieldDescriptorProto field = 2;
- repeated FieldDescriptorProto extension = 6;
-
- repeated DescriptorProto nested_type = 3;
- repeated EnumDescriptorProto enum_type = 4;
-
- message ExtensionRange {
- optional int32 start = 1;
- optional int32 end = 2;
- }
- repeated ExtensionRange extension_range = 5;
-
- optional MessageOptions options = 7;
-}
-
-// Describes a field within a message.
-message FieldDescriptorProto {
- enum Type {
- // 0 is reserved for errors.
- // Order is weird for historical reasons.
- TYPE_DOUBLE = 1;
- TYPE_FLOAT = 2;
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
- // negative values are likely.
- TYPE_INT64 = 3;
- TYPE_UINT64 = 4;
- // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
- // negative values are likely.
- TYPE_INT32 = 5;
- TYPE_FIXED64 = 6;
- TYPE_FIXED32 = 7;
- TYPE_BOOL = 8;
- TYPE_STRING = 9;
- TYPE_GROUP = 10; // Tag-delimited aggregate.
- TYPE_MESSAGE = 11; // Length-delimited aggregate.
-
- // New in version 2.
- TYPE_BYTES = 12;
- TYPE_UINT32 = 13;
- TYPE_ENUM = 14;
- TYPE_SFIXED32 = 15;
- TYPE_SFIXED64 = 16;
- TYPE_SINT32 = 17; // Uses ZigZag encoding.
- TYPE_SINT64 = 18; // Uses ZigZag encoding.
- };
-
- enum Label {
- // 0 is reserved for errors
- LABEL_OPTIONAL = 1;
- LABEL_REQUIRED = 2;
- LABEL_REPEATED = 3;
- // TODO(sanjay): Should we add LABEL_MAP?
- };
-
- optional string name = 1;
- optional int32 number = 3;
- optional Label label = 4;
-
- // If type_name is set, this need not be set. If both this and type_name
- // are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
- optional Type type = 5;
-
- // 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).
- optional string type_name = 6;
-
- // For extensions, this is the name of the type being extended. It is
- // resolved in the same manner as type_name.
- optional string extendee = 2;
-
- // 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?
- optional string default_value = 7;
-
- optional FieldOptions options = 8;
-}
-
-// Describes an enum type.
-message EnumDescriptorProto {
- optional string name = 1;
-
- repeated EnumValueDescriptorProto value = 2;
-
- optional EnumOptions options = 3;
-}
-
-// Describes a value within an enum.
-message EnumValueDescriptorProto {
- optional string name = 1;
- optional int32 number = 2;
-
- optional EnumValueOptions options = 3;
-}
-
-// Describes a service.
-message ServiceDescriptorProto {
- optional string name = 1;
- repeated MethodDescriptorProto method = 2;
-
- optional ServiceOptions options = 3;
-}
-
-// Describes a method of a service.
-message MethodDescriptorProto {
- optional string name = 1;
-
- // Input and output type names. These are resolved in the same way as
- // FieldDescriptorProto.type_name, but must refer to a message type.
- optional string input_type = 2;
- optional string output_type = 3;
-
- optional MethodOptions options = 4;
-}
-
-
-// ===================================================================
-// Options
-
-// Each of the definitions above may have "options" attached. These are
-// just annotations which may cause code to be generated slightly differently
-// or may contain hints for code that manipulates protocol messages.
-//
-// Clients may define custom options as extensions of the *Options messages.
-// These extensions may not yet be known at parsing time, so the parser cannot
-// store the values in them. Instead it stores them in a field in the *Options
-// message called uninterpreted_option. This field must have the same name
-// across all *Options messages. We then use this field to populate the
-// extensions when we build a descriptor, at which point all protos have been
-// parsed and so all extensions are known.
-//
-// Extension numbers for custom options may be chosen as follows:
-// * For options which will only be used within a single application or
-// organization, or for experimental options, use field numbers 50000
-// through 99999. It is up to you to ensure that you do not use the
-// same number for multiple options.
-// * For options which will be published and used publicly by multiple
-// independent entities, e-mail protobuf-global-extension-registry@google.com
-// to reserve extension numbers. Simply provide your project name (e.g.
-// Object-C plugin) and your project website (if available) -- there's no need
-// to explain how you intend to use them. Usually you only need one extension
-// number. You can declare multiple options with only one extension number by
-// putting them in a sub-message. See the Custom Options section of the docs
-// for examples:
-// http://code.google.com/apis/protocolbuffers/docs/proto.html#options
-// If this turns out to be popular, a web service will be set up
-// to automatically assign option numbers.
-
-
-message FileOptions {
-
- // 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.
- optional string java_package = 1;
-
-
- // 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).
- optional string java_outer_classname = 8;
-
- // 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.
- optional bool java_multiple_files = 10 [default=false];
-
- // If set true, then the Java code generator will generate equals() and
- // hashCode() methods for all messages defined in the .proto file. This is
- // purely a speed optimization, as the AbstractMessage base class includes
- // reflection-based implementations of these methods.
- optional bool java_generate_equals_and_hash = 20 [default=false];
-
- // Generated classes can be optimized for speed or code size.
- enum OptimizeMode {
- SPEED = 1; // Generate complete code for parsing, serialization,
- // etc.
- CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
- LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
- }
- optional OptimizeMode optimize_for = 9 [default=SPEED];
-
- // Sets the Go package where structs generated from this .proto will be
- // placed. There is no default.
- optional string go_package = 11;
-
-
-
- // 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 proto2.
- //
- // 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.
- optional bool cc_generic_services = 16 [default=false];
- optional bool java_generic_services = 17 [default=false];
- optional bool py_generic_services = 18 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message MessageOptions {
- // 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.
- //
- // 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.
- optional bool message_set_wire_format = 1 [default=false];
-
- // 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".
- optional bool no_standard_descriptor_accessor = 2 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message FieldOptions {
- // 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!
- optional CType ctype = 1 [default = STRING];
- enum CType {
- // Default mode.
- STRING = 0;
-
- CORD = 1;
-
- STRING_PIECE = 2;
- }
- // 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.
- optional bool packed = 2;
-
-
-
- // 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 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.
- optional bool lazy = 5 [default=false];
-
- // 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.
- optional bool deprecated = 3 [default=false];
-
- // EXPERIMENTAL. DO NOT USE.
- // For "map" fields, the name of the field in the enclosed type that
- // is the key for this map. For example, suppose we have:
- // message Item {
- // required string name = 1;
- // required string value = 2;
- // }
- // message Config {
- // repeated Item items = 1 [experimental_map_key="name"];
- // }
- // In this situation, the map key for Item will be set to "name".
- // TODO: Fully-implement this, then remove the "experimental_" prefix.
- optional string experimental_map_key = 9;
-
- // For Google-internal migration only. Do not use.
- optional bool weak = 10 [default=false];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message EnumOptions {
-
- // Set this option to false to disallow mapping different tag names to a same
- // value.
- optional bool allow_alias = 2 [default=true];
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message EnumValueOptions {
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message ServiceOptions {
-
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
- // framework. We apologize for hoarding these numbers to ourselves, but
- // we were already using them long before we decided to release Protocol
- // Buffers.
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-message MethodOptions {
-
- // Note: Field numbers 1 through 32 are reserved for Google's internal RPC
- // framework. We apologize for hoarding these numbers to ourselves, but
- // we were already using them long before we decided to release Protocol
- // Buffers.
-
- // The parser stores options it doesn't recognize here. See above.
- repeated UninterpretedOption uninterpreted_option = 999;
-
- // Clients can define custom options in extensions of this message. See above.
- extensions 1000 to max;
-}
-
-
-// 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.
-message UninterpretedOption {
- // 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".
- message NamePart {
- required string name_part = 1;
- required bool is_extension = 2;
- }
- repeated NamePart name = 2;
-
- // The value of the uninterpreted option, in whatever type the tokenizer
- // identified it as during parsing. Exactly one of these should be set.
- optional string identifier_value = 3;
- optional uint64 positive_int_value = 4;
- optional int64 negative_int_value = 5;
- optional double double_value = 6;
- optional bytes string_value = 7;
- optional string aggregate_value = 8;
-}
-
-// ===================================================================
-// Optional source code info
-
-// Encapsulates information about the original source file from which a
-// FileDescriptorProto was generated.
-message SourceCodeInfo {
- // 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).
- //
- // 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.
- repeated Location location = 1;
- message 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;
- //
- // 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).
- repeated int32 path = 1 [packed=true];
-
- // 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.
- repeated int32 span = 2 [packed=true];
-
- // 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.
- //
- // 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:
- //
- // 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.
- //
- // // Comment attached to qux.
- // //
- // // Another line attached to qux.
- // optional double qux = 4;
- //
- // 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 leading_comments = 3;
- optional string trailing_comments = 4;
- }
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
deleted file mode 100644
index 6eb2d86..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest.proto
+++ /dev/null
@@ -1,719 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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.
-
-
-// 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
-
-import "google/protobuf/unittest_import.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.
- optional int32 bb = 1;
- }
-
- enum NestedEnum {
- FOO = 1;
- BAR = 2;
- BAZ = 3;
- }
-
- // Singular
- optional int32 optional_int32 = 1;
- optional int64 optional_int64 = 2;
- optional uint32 optional_uint32 = 3;
- optional uint64 optional_uint64 = 4;
- optional sint32 optional_sint32 = 5;
- optional sint64 optional_sint64 = 6;
- optional fixed32 optional_fixed32 = 7;
- optional fixed64 optional_fixed64 = 8;
- optional sfixed32 optional_sfixed32 = 9;
- optional sfixed64 optional_sfixed64 = 10;
- optional float optional_float = 11;
- optional double optional_double = 12;
- optional bool optional_bool = 13;
- optional string optional_string = 14;
- optional bytes optional_bytes = 15;
-
- optional group OptionalGroup = 16 {
- optional int32 a = 17;
- }
-
- optional NestedMessage optional_nested_message = 18;
- optional ForeignMessage optional_foreign_message = 19;
- optional protobuf_unittest_import.ImportMessage optional_import_message = 20;
-
- optional NestedEnum optional_nested_enum = 21;
- optional ForeignEnum optional_foreign_enum = 22;
- optional protobuf_unittest_import.ImportEnum optional_import_enum = 23;
-
- optional string optional_string_piece = 24 [ctype=STRING_PIECE];
- optional string optional_cord = 25 [ctype=CORD];
-
- // Defined in unittest_import_public.proto
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message = 26;
-
- optional NestedMessage optional_lazy_message = 27 [lazy=true];
-
- // 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 group RepeatedGroup = 46 {
- optional int32 a = 47;
- }
-
- 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;
-
- repeated string repeated_string_piece = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord = 55 [ctype=CORD];
-
- repeated NestedMessage repeated_lazy_message = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32 = 61 [default = 41 ];
- optional int64 default_int64 = 62 [default = 42 ];
- optional uint32 default_uint32 = 63 [default = 43 ];
- optional uint64 default_uint64 = 64 [default = 44 ];
- optional sint32 default_sint32 = 65 [default = -45 ];
- optional sint64 default_sint64 = 66 [default = 46 ];
- optional fixed32 default_fixed32 = 67 [default = 47 ];
- optional fixed64 default_fixed64 = 68 [default = 48 ];
- optional sfixed32 default_sfixed32 = 69 [default = 49 ];
- optional sfixed64 default_sfixed64 = 70 [default = -50 ];
- optional float default_float = 71 [default = 51.5 ];
- optional double default_double = 72 [default = 52e3 ];
- optional bool default_bool = 73 [default = true ];
- optional string default_string = 74 [default = "hello"];
- optional bytes default_bytes = 75 [default = "world"];
-
- optional NestedEnum default_nested_enum = 81 [default = BAR ];
- optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR];
- optional protobuf_unittest_import.ImportEnum
- default_import_enum = 83 [default = IMPORT_BAR];
-
- optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"];
- optional string default_cord = 85 [ctype=CORD,default="123"];
-}
-
-message TestDeprecatedFields {
- optional int32 deprecated_int32 = 1 [deprecated=true];
-}
-
-// Define these after TestAllTypes to make sure the compiler can handle
-// that.
-message ForeignMessage {
- optional int32 c = 1;
-}
-
-enum ForeignEnum {
- FOREIGN_FOO = 4;
- FOREIGN_BAR = 5;
- FOREIGN_BAZ = 6;
-}
-
-message TestAllExtensions {
- extensions 1 to max;
-}
-
-extend TestAllExtensions {
- // Singular
- optional int32 optional_int32_extension = 1;
- optional int64 optional_int64_extension = 2;
- optional uint32 optional_uint32_extension = 3;
- optional uint64 optional_uint64_extension = 4;
- optional sint32 optional_sint32_extension = 5;
- optional sint64 optional_sint64_extension = 6;
- optional fixed32 optional_fixed32_extension = 7;
- optional fixed64 optional_fixed64_extension = 8;
- optional sfixed32 optional_sfixed32_extension = 9;
- optional sfixed64 optional_sfixed64_extension = 10;
- optional float optional_float_extension = 11;
- optional double optional_double_extension = 12;
- optional bool optional_bool_extension = 13;
- optional string optional_string_extension = 14;
- optional bytes optional_bytes_extension = 15;
-
- optional group OptionalGroup_extension = 16 {
- optional int32 a = 17;
- }
-
- optional TestAllTypes.NestedMessage optional_nested_message_extension = 18;
- optional ForeignMessage optional_foreign_message_extension = 19;
- optional protobuf_unittest_import.ImportMessage
- optional_import_message_extension = 20;
-
- optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21;
- optional ForeignEnum optional_foreign_enum_extension = 22;
- optional protobuf_unittest_import.ImportEnum
- optional_import_enum_extension = 23;
-
- optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE];
- optional string optional_cord_extension = 25 [ctype=CORD];
-
- optional protobuf_unittest_import.PublicImportMessage
- optional_public_import_message_extension = 26;
-
- optional TestAllTypes.NestedMessage
- optional_lazy_message_extension = 27 [lazy=true];
-
- // Repeated
- repeated int32 repeated_int32_extension = 31;
- repeated int64 repeated_int64_extension = 32;
- repeated uint32 repeated_uint32_extension = 33;
- repeated uint64 repeated_uint64_extension = 34;
- repeated sint32 repeated_sint32_extension = 35;
- repeated sint64 repeated_sint64_extension = 36;
- repeated fixed32 repeated_fixed32_extension = 37;
- repeated fixed64 repeated_fixed64_extension = 38;
- repeated sfixed32 repeated_sfixed32_extension = 39;
- repeated sfixed64 repeated_sfixed64_extension = 40;
- repeated float repeated_float_extension = 41;
- repeated double repeated_double_extension = 42;
- repeated bool repeated_bool_extension = 43;
- repeated string repeated_string_extension = 44;
- repeated bytes repeated_bytes_extension = 45;
-
- repeated group RepeatedGroup_extension = 46 {
- optional int32 a = 47;
- }
-
- repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48;
- repeated ForeignMessage repeated_foreign_message_extension = 49;
- repeated protobuf_unittest_import.ImportMessage
- repeated_import_message_extension = 50;
-
- repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51;
- repeated ForeignEnum repeated_foreign_enum_extension = 52;
- repeated protobuf_unittest_import.ImportEnum
- repeated_import_enum_extension = 53;
-
- repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE];
- repeated string repeated_cord_extension = 55 [ctype=CORD];
-
- repeated TestAllTypes.NestedMessage
- repeated_lazy_message_extension = 57 [lazy=true];
-
- // Singular with defaults
- optional int32 default_int32_extension = 61 [default = 41 ];
- optional int64 default_int64_extension = 62 [default = 42 ];
- optional uint32 default_uint32_extension = 63 [default = 43 ];
- optional uint64 default_uint64_extension = 64 [default = 44 ];
- optional sint32 default_sint32_extension = 65 [default = -45 ];
- optional sint64 default_sint64_extension = 66 [default = 46 ];
- optional fixed32 default_fixed32_extension = 67 [default = 47 ];
- optional fixed64 default_fixed64_extension = 68 [default = 48 ];
- optional sfixed32 default_sfixed32_extension = 69 [default = 49 ];
- optional sfixed64 default_sfixed64_extension = 70 [default = -50 ];
- optional float default_float_extension = 71 [default = 51.5 ];
- optional double default_double_extension = 72 [default = 52e3 ];
- optional bool default_bool_extension = 73 [default = true ];
- optional string default_string_extension = 74 [default = "hello"];
- optional bytes default_bytes_extension = 75 [default = "world"];
-
- optional TestAllTypes.NestedEnum
- default_nested_enum_extension = 81 [default = BAR];
- optional ForeignEnum
- default_foreign_enum_extension = 82 [default = FOREIGN_BAR];
- optional protobuf_unittest_import.ImportEnum
- default_import_enum_extension = 83 [default = IMPORT_BAR];
-
- optional string default_string_piece_extension = 84 [ctype=STRING_PIECE,
- default="abc"];
- optional string default_cord_extension = 85 [ctype=CORD, default="123"];
-}
-
-message TestNestedExtension {
- extend TestAllExtensions {
- // Check for bug where string extensions declared in tested scope did not
- // compile.
- optional string test = 1002 [default="test"];
- }
-}
-
-// We have separate messages for testing required fields because it's
-// annoying to have to fill in required fields in TestProto in order to
-// do anything with it. Note that we don't need to test every type of
-// required filed because the code output is basically identical to
-// optional fields for all types.
-message TestRequired {
- required int32 a = 1;
- optional int32 dummy2 = 2;
- required int32 b = 3;
-
- extend TestAllExtensions {
- optional TestRequired single = 1000;
- repeated TestRequired multi = 1001;
- }
-
- // Pad the field count to 32 so that we can test that IsInitialized()
- // properly checks multiple elements of has_bits_.
- optional int32 dummy4 = 4;
- optional int32 dummy5 = 5;
- optional int32 dummy6 = 6;
- optional int32 dummy7 = 7;
- optional int32 dummy8 = 8;
- optional int32 dummy9 = 9;
- optional int32 dummy10 = 10;
- optional int32 dummy11 = 11;
- optional int32 dummy12 = 12;
- optional int32 dummy13 = 13;
- optional int32 dummy14 = 14;
- optional int32 dummy15 = 15;
- optional int32 dummy16 = 16;
- optional int32 dummy17 = 17;
- optional int32 dummy18 = 18;
- optional int32 dummy19 = 19;
- optional int32 dummy20 = 20;
- optional int32 dummy21 = 21;
- optional int32 dummy22 = 22;
- optional int32 dummy23 = 23;
- optional int32 dummy24 = 24;
- optional int32 dummy25 = 25;
- optional int32 dummy26 = 26;
- optional int32 dummy27 = 27;
- optional int32 dummy28 = 28;
- optional int32 dummy29 = 29;
- optional int32 dummy30 = 30;
- optional int32 dummy31 = 31;
- optional int32 dummy32 = 32;
-
- required int32 c = 33;
-}
-
-message TestRequiredForeign {
- optional TestRequired optional_message = 1;
- repeated TestRequired repeated_message = 2;
- optional int32 dummy = 3;
-}
-
-// Test that we can use NestedMessage from outside TestAllTypes.
-message TestForeignNested {
- optional TestAllTypes.NestedMessage foreign_nested = 1;
-}
-
-// TestEmptyMessage is used to test unknown field support.
-message TestEmptyMessage {
-}
-
-// Like above, but declare all field numbers as potential extensions. No
-// actual extensions should ever be defined for this type.
-message TestEmptyMessageWithExtensions {
- extensions 1 to max;
-}
-
-message TestMultipleExtensionRanges {
- extensions 42;
- extensions 4143 to 4243;
- extensions 65536 to max;
-}
-
-// 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.
- optional int32 a = 1;
- optional int32 bb = 268435455;
-}
-
-message TestRecursiveMessage {
- optional TestRecursiveMessage a = 1;
- optional int32 i = 2;
-}
-
-// Test that mutual recursion works.
-message TestMutualRecursionA {
- optional TestMutualRecursionB bb = 1;
-}
-
-message TestMutualRecursionB {
- optional TestMutualRecursionA a = 1;
- optional int32 optional_int32 = 2;
-}
-
-// Test that groups have disjoint field numbers from their siblings and
-// parents. This is NOT possible in proto1; only proto2. When attempting
-// to compile with proto1, this will emit an error; so we only include it
-// in protobuf_unittest_proto.
-message TestDupFieldNumber { // NO_PROTO1
- optional int32 a = 1; // NO_PROTO1
- optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1
- optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1
-} // NO_PROTO1
-
-// Additional messages for testing lazy fields.
-message TestEagerMessage {
- optional TestAllTypes sub_message = 1 [lazy=false];
-}
-message TestLazyMessage {
- optional TestAllTypes sub_message = 1 [lazy=true];
-}
-
-// Needed for a Python test.
-message TestNestedMessageHasBits {
- message NestedMessage {
- repeated int32 nestedmessage_repeated_int32 = 1;
- repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2;
- }
- optional NestedMessage optional_nested_message = 1;
-}
-
-
-// Test an enum that has multiple values with the same number.
-enum TestEnumWithDupValue {
- option allow_alias = true;
- FOO1 = 1;
- BAR1 = 2;
- BAZ = 3;
- FOO2 = 1;
- BAR2 = 2;
-}
-
-// Test an enum with large, unordered values.
-enum TestSparseEnum {
- SPARSE_A = 123;
- SPARSE_B = 62374;
- SPARSE_C = 12589234;
- SPARSE_D = -15;
- SPARSE_E = -53452;
- SPARSE_F = 0;
- SPARSE_G = 2;
-}
-
-// Test message with CamelCase field names. This violates Protocol Buffer
-// standard style.
-message TestCamelCaseFieldNames {
- optional int32 PrimitiveField = 1;
- optional string StringField = 2;
- optional ForeignEnum EnumField = 3;
- optional ForeignMessage MessageField = 4;
- optional string StringPieceField = 5 [ctype=STRING_PIECE];
- optional string CordField = 6 [ctype=CORD];
-
- repeated int32 RepeatedPrimitiveField = 7;
- repeated string RepeatedStringField = 8;
- repeated ForeignEnum RepeatedEnumField = 9;
- repeated ForeignMessage RepeatedMessageField = 10;
- repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE];
- repeated string RepeatedCordField = 12 [ctype=CORD];
-}
-
-
-// We list fields out of order, to ensure that we're using field number and not
-// field index to determine serialization order.
-message TestFieldOrderings {
- optional string my_string = 11;
- extensions 2 to 10;
- optional int64 my_int = 1;
- extensions 12 to 100;
- optional float my_float = 101;
-}
-
-
-extend TestFieldOrderings {
- optional string my_extension_string = 50;
- optional int32 my_extension_int = 5;
-}
-
-
-message TestExtremeDefaultValues {
- optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"];
- optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF];
- optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF];
- optional int32 small_int32 = 4 [default = -0x7FFFFFFF];
- optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF];
- optional int32 really_small_int32 = 21 [default = -0x80000000];
- optional int64 really_small_int64 = 22 [default = -0x8000000000000000];
-
- // The default value here is UTF-8 for "\u1234". (We could also just type
- // the UTF-8 text directly into this text file rather than escape it, but
- // lots of people use editors that would be confused by this.)
- optional string utf8_string = 6 [default = "\341\210\264"];
-
- // Tests for single-precision floating-point values.
- optional float zero_float = 7 [default = 0];
- optional float one_float = 8 [default = 1];
- optional float small_float = 9 [default = 1.5];
- optional float negative_one_float = 10 [default = -1];
- optional float negative_float = 11 [default = -1.5];
- // Using exponents
- optional float large_float = 12 [default = 2E8];
- optional float small_negative_float = 13 [default = -8e-28];
-
- // Text for nonfinite floating-point values.
- optional double inf_double = 14 [default = inf];
- optional double neg_inf_double = 15 [default = -inf];
- optional double nan_double = 16 [default = nan];
- optional float inf_float = 17 [default = inf];
- optional float neg_inf_float = 18 [default = -inf];
- optional float nan_float = 19 [default = nan];
-
- // Tests for C++ trigraphs.
- // Trigraphs should be escaped in C++ generated files, but they should not be
- // escaped for other languages.
- // Note that in .proto file, "\?" is a valid way to escape ? in string
- // literals.
- optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"];
-
- // String defaults containing the character '\000'
- optional string string_with_zero = 23 [default = "hel\000lo"];
- optional bytes bytes_with_zero = 24 [default = "wor\000ld"];
- optional string string_piece_with_zero = 25 [ctype=STRING_PIECE,
- default="ab\000c"];
- optional string cord_with_zero = 26 [ctype=CORD,
- default="12\0003"];
-}
-
-message SparseEnumMessage {
- optional TestSparseEnum sparse_enum = 1;
-}
-
-// Test String and Bytes: string is for valid UTF-8 strings
-message OneString {
- optional string data = 1;
-}
-
-message MoreString {
- repeated string data = 1;
-}
-
-message OneBytes {
- optional bytes data = 1;
-}
-
-message MoreBytes {
- repeated bytes data = 1;
-}
-
-
-// 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 TestPackedExtensions {
- extensions 1 to max;
-}
-
-extend TestPackedExtensions {
- repeated int32 packed_int32_extension = 90 [packed = true];
- repeated int64 packed_int64_extension = 91 [packed = true];
- repeated uint32 packed_uint32_extension = 92 [packed = true];
- repeated uint64 packed_uint64_extension = 93 [packed = true];
- repeated sint32 packed_sint32_extension = 94 [packed = true];
- repeated sint64 packed_sint64_extension = 95 [packed = true];
- repeated fixed32 packed_fixed32_extension = 96 [packed = true];
- repeated fixed64 packed_fixed64_extension = 97 [packed = true];
- repeated sfixed32 packed_sfixed32_extension = 98 [packed = true];
- repeated sfixed64 packed_sfixed64_extension = 99 [packed = true];
- repeated float packed_float_extension = 100 [packed = true];
- repeated double packed_double_extension = 101 [packed = true];
- repeated bool packed_bool_extension = 102 [packed = true];
- repeated ForeignEnum packed_enum_extension = 103 [packed = true];
-}
-
-// Used by ExtensionSetTest/DynamicExtensions. The test actually builds
-// a set of extensions to TestAllExtensions dynamically, based on the fields
-// of this message type.
-message TestDynamicExtensions {
- enum DynamicEnumType {
- DYNAMIC_FOO = 2200;
- DYNAMIC_BAR = 2201;
- DYNAMIC_BAZ = 2202;
- }
- message DynamicMessageType {
- optional int32 dynamic_field = 2100;
- }
-
- optional fixed32 scalar_extension = 2000;
- optional ForeignEnum enum_extension = 2001;
- optional DynamicEnumType dynamic_enum_extension = 2002;
-
- optional ForeignMessage message_extension = 2003;
- optional DynamicMessageType dynamic_message_extension = 2004;
-
- repeated string repeated_extension = 2005;
- repeated sint32 packed_extension = 2006 [packed = true];
-}
-
-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;
-}
-
-// Test that if an optional or required message/group field appears multiple
-// times in the input, they need to be merged.
-message TestParsingMerge {
- // RepeatedFieldsGenerator defines matching field types as TestParsingMerge,
- // except that all fields are repeated. In the tests, we will serialize the
- // RepeatedFieldsGenerator to bytes, and parse the bytes to TestParsingMerge.
- // Repeated fields in RepeatedFieldsGenerator are expected to be merged into
- // the corresponding required/optional fields in TestParsingMerge.
- message RepeatedFieldsGenerator {
- repeated TestAllTypes field1 = 1;
- repeated TestAllTypes field2 = 2;
- repeated TestAllTypes field3 = 3;
- repeated group Group1 = 10 {
- optional TestAllTypes field1 = 11;
- }
- repeated group Group2 = 20 {
- optional TestAllTypes field1 = 21;
- }
- repeated TestAllTypes ext1 = 1000;
- repeated TestAllTypes ext2 = 1001;
- }
- required TestAllTypes required_all_types = 1;
- optional TestAllTypes optional_all_types = 2;
- repeated TestAllTypes repeated_all_types = 3;
- optional group OptionalGroup = 10 {
- optional TestAllTypes optional_group_all_types = 11;
- }
- repeated group RepeatedGroup = 20 {
- optional TestAllTypes repeated_group_all_types = 21;
- }
- extensions 1000 to max;
- extend TestParsingMerge {
- optional TestAllTypes optional_ext = 1000;
- repeated TestAllTypes repeated_ext = 1001;
- }
-}
-
-message TestCommentInjectionMessage {
- // */ <- This should not close the generated doc comment
- optional string a = 1 [default="*/ <- Neither should this."];
-}
-
-
-// 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/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
deleted file mode 100644
index 2f4e3fd..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_custom_options.proto
+++ /dev/null
@@ -1,387 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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 proto2.
-
-
-// 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;
-
-// 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;
-
-
-// Some simple test custom options of various types.
-
-extend google.protobuf.FileOptions {
- optional uint64 file_opt1 = 7736974;
-}
-
-extend google.protobuf.MessageOptions {
- optional int32 message_opt1 = 7739036;
-}
-
-extend google.protobuf.FieldOptions {
- optional fixed64 field_opt1 = 7740936;
- // This is useful for testing that we correctly register default values for
- // extension options.
- optional int32 field_opt2 = 7753913 [default=42];
-}
-
-extend google.protobuf.EnumOptions {
- optional sfixed32 enum_opt1 = 7753576;
-}
-
-extend google.protobuf.EnumValueOptions {
- optional int32 enum_value_opt1 = 1560678;
-}
-
-extend google.protobuf.ServiceOptions {
- optional sint64 service_opt1 = 7887650;
-}
-
-enum MethodOpt1 {
- METHODOPT1_VAL1 = 1;
- METHODOPT1_VAL2 = 2;
-}
-
-extend google.protobuf.MethodOptions {
- optional 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;
-
- optional string field1 = 1 [ctype=CORD,
- (field_opt1)=8765432109];
-
- enum AnEnum {
- option (enum_opt1) = -789;
-
- 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_TYPE1 = 22;
- TEST_OPTION_ENUM_TYPE2 = -23;
- }
-}
-
-message DummyMessageInvalidAsOptionType {
-}
-
-extend google.protobuf.MessageOptions {
- optional bool bool_opt = 7706090;
- optional int32 int32_opt = 7705709;
- optional int64 int64_opt = 7705542;
- optional uint32 uint32_opt = 7704880;
- optional uint64 uint64_opt = 7702367;
- optional sint32 sint32_opt = 7701568;
- optional sint64 sint64_opt = 7700863;
- optional fixed32 fixed32_opt = 7700307;
- optional fixed64 fixed64_opt = 7700194;
- optional sfixed32 sfixed32_opt = 7698645;
- optional sfixed64 sfixed64_opt = 7685475;
- optional float float_opt = 7675390;
- optional double double_opt = 7673293;
- optional string string_opt = 7673285;
- optional bytes bytes_opt = 7673238;
- optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233;
- optional 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 {
- optional int32 foo = 1;
- optional int32 foo2 = 2;
- optional int32 foo3 = 3;
-
- extensions 100 to max;
-}
-
-message ComplexOptionType2 {
- optional ComplexOptionType1 bar = 1;
- optional int32 baz = 2;
-
- message ComplexOptionType4 {
- optional int32 waldo = 1;
-
- extend google.protobuf.MessageOptions {
- optional ComplexOptionType4 complex_opt4 = 7633546;
- }
- }
-
- optional ComplexOptionType4 fred = 3;
-
- extensions 100 to max;
-}
-
-message ComplexOptionType3 {
- optional int32 qux = 1;
-
- optional group ComplexOptionType5 = 2 {
- optional int32 plugh = 3;
- }
-}
-
-extend ComplexOptionType1 {
- optional int32 quux = 7663707;
- optional ComplexOptionType3 corge = 7663442;
-}
-
-extend ComplexOptionType2 {
- optional int32 grault = 7650927;
- optional ComplexOptionType1 garply = 7649992;
-}
-
-extend google.protobuf.MessageOptions {
- optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756;
- optional ComplexOptionType2 complex_opt2 = 7636949;
- optional ComplexOptionType3 complex_opt3 = 7636463;
- optional group ComplexOpt6 = 7595468 {
- optional int32 xyzzy = 7593951;
- }
-}
-
-// 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).(.protobuf_unittest.quux) = 324;
- option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876;
- option (complex_opt2).baz = 987;
- option (complex_opt2).(grault) = 654;
- option (complex_opt2).bar.foo = 743;
- option (complex_opt2).bar.(quux) = 1999;
- option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008;
- option (complex_opt2).(garply).foo = 741;
- option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998;
- option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121;
- option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971;
- option (complex_opt2).fred.waldo = 321;
- option (protobuf_unittest.complex_opt3).qux = 9;
- option (complex_opt3).complexoptiontype5.plugh = 22;
- option (complexopt6).xyzzy = 24;
-}
-
-// ------------------------------------------------------
-// Definitions for testing aggregate option parsing.
-// See descriptor_unittest.cc.
-
-message AggregateMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
-
-message AggregateMessageSetElement {
- extend AggregateMessageSet {
- optional AggregateMessageSetElement message_set_extension = 15447542;
- }
- optional string s = 1;
-}
-
-// A helper type used to test aggregate option parsing
-message Aggregate {
- optional int32 i = 1;
- optional string s = 2;
-
- // A nested object
- optional Aggregate sub = 3;
-
- // To test the parsing of extensions inside aggregate values
- optional google.protobuf.FileOptions file = 4;
- extend google.protobuf.FileOptions {
- optional Aggregate nested = 15476903;
- }
-
- // An embedded message set
- optional AggregateMessageSet mset = 5;
-}
-
-// Allow Aggregate to be used as an option at all possible locations
-// in the .proto grammar.
-extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; }
-extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; }
-extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; }
-extend google.protobuf.EnumOptions { optional Aggregate enumopt = 15483218; }
-extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; }
-extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; }
-extend google.protobuf.MethodOptions { optional 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' }
-
- // Include a google.protobuf.FileOptions and recursively extend it with
- // another fileopt.
- file {
- [protobuf_unittest.fileopt] {
- s:'FileExtensionAnnotation'
- }
- }
-
- // A message set inside an option value
- mset {
- [protobuf_unittest.AggregateMessageSetElement.message_set_extension] {
- s: 'EmbeddedMessageSetElement'
- }
- }
-};
-
-message AggregateMessage {
- option (msgopt) = { i:101 s:'MessageAnnotation' };
- optional 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' };
- VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }];
-}
-
-// Test custom options for nested type.
-message NestedOptionType {
- message NestedMessage {
- option (message_opt1) = 1001;
- optional int32 nested_field = 1 [(field_opt1) = 1002];
- }
- enum NestedEnum {
- option (enum_opt1) = 1003;
- NESTED_ENUM_VALUE = 1 [(enum_value_opt1) = 1004];
- }
- extend google.protobuf.FileOptions {
- optional int32 nested_extension = 7912573 [(field_opt2) = 1005];
- }
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
deleted file mode 100644
index ec36cca..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import.proto
+++ /dev/null
@@ -1,64 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// 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.proto to test importing.
-
-
-// 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;
-
-option optimize_for = SPEED;
-
-// Exercise the java_package option.
-option java_package = "com.google.protobuf.test";
-
-// 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.proto";
-
-message ImportMessage {
- optional int32 d = 1;
-}
-
-enum ImportEnum {
- IMPORT_FOO = 7;
- IMPORT_BAR = 8;
- IMPORT_BAZ = 9;
-}
-
diff --git a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
deleted file mode 100644
index ea5d1b1..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_import_public.proto
+++ /dev/null
@@ -1,40 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: liujisi@google.com (Pherl Liu)
-
-
-package protobuf_unittest_import;
-
-option java_package = "com.google.protobuf.test";
-
-message PublicImportMessage {
- optional int32 e = 1;
-}
diff --git a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
deleted file mode 100644
index 3497f09..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_mset.proto
+++ /dev/null
@@ -1,72 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-// Based on original Protocol Buffers design by
-// Sanjay Ghemawat, Jeff Dean, and others.
-//
-// This file contains messages for testing message_set_wire_format.
-
-package protobuf_unittest;
-
-option optimize_for = SPEED;
-
-// A message with message_set_wire_format.
-message TestMessageSet {
- option message_set_wire_format = true;
- extensions 4 to max;
-}
-
-message TestMessageSetContainer {
- optional TestMessageSet message_set = 1;
-}
-
-message TestMessageSetExtension1 {
- extend TestMessageSet {
- optional TestMessageSetExtension1 message_set_extension = 1545008;
- }
- optional int32 i = 15;
-}
-
-message TestMessageSetExtension2 {
- extend TestMessageSet {
- optional TestMessageSetExtension2 message_set_extension = 1547769;
- }
- optional string str = 25;
-}
-
-// MessageSet wire format is equivalent to this.
-message RawMessageSet {
- repeated group Item = 1 {
- required int32 type_id = 2;
- required bytes message = 3;
- }
-}
-
diff --git a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto b/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
deleted file mode 100644
index cffb412..0000000
--- a/python/compatibility_tests/v2.5.0/protos/src/proto/google/protobuf/unittest_no_generic_services.proto
+++ /dev/null
@@ -1,52 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// http://code.google.com/p/protobuf/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Author: kenton@google.com (Kenton Varda)
-
-package google.protobuf.no_generic_services_test;
-
-// *_generic_services are false by default.
-
-message TestMessage {
- optional int32 a = 1;
- extensions 1000 to max;
-}
-
-enum TestEnum {
- FOO = 1;
-}
-
-extend TestMessage {
- optional int32 test_extension = 1000;
-}
-
-service TestService {
- rpc Foo(TestMessage) returns(TestMessage);
-}
diff --git a/python/compatibility_tests/v2.5.0/setup.py b/python/compatibility_tests/v2.5.0/setup.py
deleted file mode 100755
index bf67536..0000000
--- a/python/compatibility_tests/v2.5.0/setup.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#! /usr/bin/env python
-#
-import glob
-import os
-import subprocess
-import sys
-
-from setuptools import setup, Extension, find_packages
-
-if sys.version_info[0] == 3:
- # Python 3
- from distutils.command.build_py import build_py_2to3 as _build_py
-else:
- # Python 2
- from distutils.command.build_py import build_py as _build_py
-from distutils.spawn import find_executable
-
-def generate_proto(source, code_gen):
- """Invokes the Protocol Compiler to generate a _pb2.py from the given
- .proto file."""
- output = source.replace(".proto", "_pb2.py").replace("protos/src/proto/", "").replace("protos/python/", "")
-
- if not os.path.exists(source):
- sys.stderr.write("Can't find required file: %s\n" % source)
- sys.exit(-1)
-
- protoc_command = [ code_gen, "-Iprotos/src/proto", "-Iprotos/python", "--python_out=.", source ]
- if subprocess.call(protoc_command) != 0:
- sys.exit(-1)
-
-class build_py(_build_py):
- def run(self):
- # generate .proto file
- protoc_1 = "./protoc_1"
- protoc_2 = "./protoc_2"
- generate_proto("protos/src/proto/google/protobuf/unittest.proto", protoc_2)
- generate_proto("protos/src/proto/google/protobuf/unittest_custom_options.proto", protoc_1)
- generate_proto("protos/src/proto/google/protobuf/unittest_import.proto", protoc_1)
- generate_proto("protos/src/proto/google/protobuf/unittest_import_public.proto", protoc_1)
- generate_proto("protos/src/proto/google/protobuf/unittest_mset.proto", protoc_1)
- generate_proto("protos/src/proto/google/protobuf/unittest_no_generic_services.proto", protoc_1)
- generate_proto("protos/python/google/protobuf/internal/factory_test1.proto", protoc_1)
- generate_proto("protos/python/google/protobuf/internal/factory_test2.proto", protoc_1)
- generate_proto("protos/python/google/protobuf/internal/more_extensions.proto", protoc_1)
- generate_proto("protos/python/google/protobuf/internal/more_extensions_dynamic.proto", protoc_1)
- generate_proto("protos/python/google/protobuf/internal/more_messages.proto", protoc_1)
- generate_proto("protos/python/google/protobuf/internal/test_bad_identifiers.proto", protoc_1)
-
- # _build_py is an old-style class, so super() doesn't work.
- _build_py.run(self)
-
-if __name__ == '__main__':
- # Keep this list of dependencies in sync with tox.ini.
- install_requires = ['six>=1.9', 'setuptools']
- if sys.version_info <= (2,7):
- install_requires.append('ordereddict')
- install_requires.append('unittest2')
-
- setup(
- name='protobuf',
- description='Protocol Buffers',
- download_url='https://github.com/protocolbuffers/protobuf/releases',
- long_description="Protocol Buffers are Google's data interchange format",
- url='https://developers.google.com/protocol-buffers/',
- maintainer='protobuf@googlegroups.com',
- maintainer_email='protobuf@googlegroups.com',
- license='3-Clause BSD License',
- classifiers=[
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.6",
- "Programming Language :: Python :: 2.7",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.3",
- "Programming Language :: Python :: 3.4",
- ],
- packages=find_packages(
- exclude=[
- 'import_test_package',
- ],
- ),
- test_suite='tests.google.protobuf.internal',
- cmdclass={
- 'build_py': build_py,
- },
- install_requires=install_requires,
- )
diff --git a/python/compatibility_tests/v2.5.0/test.sh b/python/compatibility_tests/v2.5.0/test.sh
deleted file mode 100755
index 740c132..0000000
--- a/python/compatibility_tests/v2.5.0/test.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/bash
-
-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=2.5.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 compatibility of the
-# latest version against other versions.
-OLD_VERSION=$1
-OLD_VERSION_PROTOC=https://repo1.maven.org/maven2/com/google/protobuf/protoc/$OLD_VERSION/protoc-$OLD_VERSION-linux-x86_64.exe
-
-# Extract the latest protobuf version number.
-VERSION_NUMBER=`grep "^__version__ = '.*'" ../../google/protobuf/__init__.py | sed "s|__version__ = '\(.*\)'|\1|"`
-
-echo "Running compatibility tests between current $VERSION_NUMBER and released $OLD_VERSION"
-
-# Check protoc
-[ -f ../../../src/protoc ] || {
- echo "[ERROR]: Please build protoc first."
- exit 1
-}
-
-# Test source compatibility. In these tests we recompile everything against
-# the new runtime (including old version generated code).
-rm google -f -r
-mkdir -p google/protobuf/internal
-# Build and copy the new runtime
-cd ../../
-python setup.py build
-cp google/protobuf/*.py compatibility_tests/v2.5.0/google/protobuf/
-cp google/protobuf/internal/*.py compatibility_tests/v2.5.0/google/protobuf/internal/
-cd compatibility_tests/v2.5.0
-cp tests/google/protobuf/internal/test_util.py google/protobuf/internal/
-cp google/protobuf/__init__.py google/
-
-# Download old version protoc compiler (for linux)
-wget $OLD_VERSION_PROTOC -O old_protoc
-chmod +x old_protoc
-
-# 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
-python setup.py build
-python setup.py 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
-python setup.py build
-python setup.py 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
-python setup.py build
-python setup.py test
-
-rm google -r -f
-rm build -r -f
-rm protoc_1
-rm protoc_2
-rm old_protoc
diff --git a/python/compatibility_tests/v2.5.0/tests/__init__.py b/python/compatibility_tests/v2.5.0/tests/__init__.py
deleted file mode 100644
index 5585614..0000000
--- a/python/compatibility_tests/v2.5.0/tests/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- __path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/python/compatibility_tests/v2.5.0/tests/google/__init__.py b/python/compatibility_tests/v2.5.0/tests/google/__init__.py
deleted file mode 100644
index 5585614..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- __path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py
deleted file mode 100644
index 5585614..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- __path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py
deleted file mode 100644
index 64c6956..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-# Copyright 2007 Google Inc. All Rights Reserved.
-
-if __name__ != '__main__':
- try:
- __import__('pkg_resources').declare_namespace(__name__)
- except ImportError:
- __path__ = __import__('pkgutil').extend_path(__path__, __name__)
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py
deleted file mode 100755
index c74f882..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/descriptor_test.py
+++ /dev/null
@@ -1,613 +0,0 @@
-#! /usr/bin/python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Unittest for google.protobuf.internal.descriptor."""
-
-__author__ = 'robinson@google.com (Will Robinson)'
-
-import unittest
-from google.protobuf import unittest_custom_options_pb2
-from google.protobuf import unittest_import_pb2
-from google.protobuf import unittest_pb2
-from google.protobuf import descriptor_pb2
-from google.protobuf import descriptor
-from google.protobuf import text_format
-
-
-TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII = """
-name: 'TestEmptyMessage'
-"""
-
-
-class DescriptorTest(unittest.TestCase):
-
- def setUp(self):
- self.my_file = descriptor.FileDescriptor(
- name='some/filename/some.proto',
- package='protobuf_unittest'
- )
- self.my_enum = descriptor.EnumDescriptor(
- name='ForeignEnum',
- full_name='protobuf_unittest.ForeignEnum',
- filename=None,
- file=self.my_file,
- values=[
- descriptor.EnumValueDescriptor(name='FOREIGN_FOO', index=0, number=4),
- descriptor.EnumValueDescriptor(name='FOREIGN_BAR', index=1, number=5),
- descriptor.EnumValueDescriptor(name='FOREIGN_BAZ', index=2, number=6),
- ])
- self.my_message = descriptor.Descriptor(
- name='NestedMessage',
- full_name='protobuf_unittest.TestAllTypes.NestedMessage',
- filename=None,
- file=self.my_file,
- containing_type=None,
- fields=[
- descriptor.FieldDescriptor(
- name='bb',
- full_name='protobuf_unittest.TestAllTypes.NestedMessage.bb',
- index=0, number=1,
- type=5, cpp_type=1, label=1,
- has_default_value=False, default_value=0,
- message_type=None, enum_type=None, containing_type=None,
- is_extension=False, extension_scope=None),
- ],
- nested_types=[],
- enum_types=[
- self.my_enum,
- ],
- extensions=[])
- self.my_method = descriptor.MethodDescriptor(
- name='Bar',
- full_name='protobuf_unittest.TestService.Bar',
- index=0,
- containing_service=None,
- input_type=None,
- output_type=None)
- self.my_service = descriptor.ServiceDescriptor(
- name='TestServiceWithOptions',
- full_name='protobuf_unittest.TestServiceWithOptions',
- file=self.my_file,
- index=0,
- methods=[
- self.my_method
- ])
-
- def testEnumValueName(self):
- self.assertEqual(self.my_message.EnumValueName('ForeignEnum', 4),
- 'FOREIGN_FOO')
-
- self.assertEqual(
- self.my_message.enum_types_by_name[
- 'ForeignEnum'].values_by_number[4].name,
- self.my_message.EnumValueName('ForeignEnum', 4))
-
- def testEnumFixups(self):
- self.assertEqual(self.my_enum, self.my_enum.values[0].type)
-
- def testContainingTypeFixups(self):
- self.assertEqual(self.my_message, self.my_message.fields[0].containing_type)
- self.assertEqual(self.my_message, self.my_enum.containing_type)
-
- def testContainingServiceFixups(self):
- self.assertEqual(self.my_service, self.my_method.containing_service)
-
- def testGetOptions(self):
- self.assertEqual(self.my_enum.GetOptions(),
- descriptor_pb2.EnumOptions())
- self.assertEqual(self.my_enum.values[0].GetOptions(),
- descriptor_pb2.EnumValueOptions())
- self.assertEqual(self.my_message.GetOptions(),
- descriptor_pb2.MessageOptions())
- self.assertEqual(self.my_message.fields[0].GetOptions(),
- descriptor_pb2.FieldOptions())
- self.assertEqual(self.my_method.GetOptions(),
- descriptor_pb2.MethodOptions())
- self.assertEqual(self.my_service.GetOptions(),
- descriptor_pb2.ServiceOptions())
-
- def testSimpleCustomOptions(self):
- file_descriptor = unittest_custom_options_pb2.DESCRIPTOR
- message_descriptor =\
- unittest_custom_options_pb2.TestMessageWithCustomOptions.DESCRIPTOR
- field_descriptor = message_descriptor.fields_by_name["field1"]
- enum_descriptor = message_descriptor.enum_types_by_name["AnEnum"]
- enum_value_descriptor =\
- message_descriptor.enum_values_by_name["ANENUM_VAL2"]
- service_descriptor =\
- unittest_custom_options_pb2.TestServiceWithCustomOptions.DESCRIPTOR
- method_descriptor = service_descriptor.FindMethodByName("Foo")
-
- file_options = file_descriptor.GetOptions()
- file_opt1 = unittest_custom_options_pb2.file_opt1
- self.assertEqual(9876543210, file_options.Extensions[file_opt1])
- message_options = message_descriptor.GetOptions()
- message_opt1 = unittest_custom_options_pb2.message_opt1
- self.assertEqual(-56, message_options.Extensions[message_opt1])
- field_options = field_descriptor.GetOptions()
- field_opt1 = unittest_custom_options_pb2.field_opt1
- self.assertEqual(8765432109, field_options.Extensions[field_opt1])
- field_opt2 = unittest_custom_options_pb2.field_opt2
- self.assertEqual(42, field_options.Extensions[field_opt2])
- enum_options = enum_descriptor.GetOptions()
- enum_opt1 = unittest_custom_options_pb2.enum_opt1
- self.assertEqual(-789, enum_options.Extensions[enum_opt1])
- enum_value_options = enum_value_descriptor.GetOptions()
- enum_value_opt1 = unittest_custom_options_pb2.enum_value_opt1
- self.assertEqual(123, enum_value_options.Extensions[enum_value_opt1])
-
- service_options = service_descriptor.GetOptions()
- service_opt1 = unittest_custom_options_pb2.service_opt1
- self.assertEqual(-9876543210, service_options.Extensions[service_opt1])
- method_options = method_descriptor.GetOptions()
- method_opt1 = unittest_custom_options_pb2.method_opt1
- self.assertEqual(unittest_custom_options_pb2.METHODOPT1_VAL2,
- method_options.Extensions[method_opt1])
-
- def testDifferentCustomOptionTypes(self):
- kint32min = -2**31
- kint64min = -2**63
- kint32max = 2**31 - 1
- kint64max = 2**63 - 1
- kuint32max = 2**32 - 1
- kuint64max = 2**64 - 1
-
- message_descriptor =\
- unittest_custom_options_pb2.CustomOptionMinIntegerValues.DESCRIPTOR
- message_options = message_descriptor.GetOptions()
- self.assertEqual(False, message_options.Extensions[
- unittest_custom_options_pb2.bool_opt])
- self.assertEqual(kint32min, message_options.Extensions[
- unittest_custom_options_pb2.int32_opt])
- self.assertEqual(kint64min, message_options.Extensions[
- unittest_custom_options_pb2.int64_opt])
- self.assertEqual(0, message_options.Extensions[
- unittest_custom_options_pb2.uint32_opt])
- self.assertEqual(0, message_options.Extensions[
- unittest_custom_options_pb2.uint64_opt])
- self.assertEqual(kint32min, message_options.Extensions[
- unittest_custom_options_pb2.sint32_opt])
- self.assertEqual(kint64min, message_options.Extensions[
- unittest_custom_options_pb2.sint64_opt])
- self.assertEqual(0, message_options.Extensions[
- unittest_custom_options_pb2.fixed32_opt])
- self.assertEqual(0, message_options.Extensions[
- unittest_custom_options_pb2.fixed64_opt])
- self.assertEqual(kint32min, message_options.Extensions[
- unittest_custom_options_pb2.sfixed32_opt])
- self.assertEqual(kint64min, message_options.Extensions[
- unittest_custom_options_pb2.sfixed64_opt])
-
- message_descriptor =\
- unittest_custom_options_pb2.CustomOptionMaxIntegerValues.DESCRIPTOR
- message_options = message_descriptor.GetOptions()
- self.assertEqual(True, message_options.Extensions[
- unittest_custom_options_pb2.bool_opt])
- self.assertEqual(kint32max, message_options.Extensions[
- unittest_custom_options_pb2.int32_opt])
- self.assertEqual(kint64max, message_options.Extensions[
- unittest_custom_options_pb2.int64_opt])
- self.assertEqual(kuint32max, message_options.Extensions[
- unittest_custom_options_pb2.uint32_opt])
- self.assertEqual(kuint64max, message_options.Extensions[
- unittest_custom_options_pb2.uint64_opt])
- self.assertEqual(kint32max, message_options.Extensions[
- unittest_custom_options_pb2.sint32_opt])
- self.assertEqual(kint64max, message_options.Extensions[
- unittest_custom_options_pb2.sint64_opt])
- self.assertEqual(kuint32max, message_options.Extensions[
- unittest_custom_options_pb2.fixed32_opt])
- self.assertEqual(kuint64max, message_options.Extensions[
- unittest_custom_options_pb2.fixed64_opt])
- self.assertEqual(kint32max, message_options.Extensions[
- unittest_custom_options_pb2.sfixed32_opt])
- self.assertEqual(kint64max, message_options.Extensions[
- unittest_custom_options_pb2.sfixed64_opt])
-
- message_descriptor =\
- unittest_custom_options_pb2.CustomOptionOtherValues.DESCRIPTOR
- message_options = message_descriptor.GetOptions()
- self.assertEqual(-100, message_options.Extensions[
- unittest_custom_options_pb2.int32_opt])
- self.assertAlmostEqual(12.3456789, message_options.Extensions[
- unittest_custom_options_pb2.float_opt], 6)
- self.assertAlmostEqual(1.234567890123456789, message_options.Extensions[
- unittest_custom_options_pb2.double_opt])
- self.assertEqual("Hello, \"World\"", message_options.Extensions[
- unittest_custom_options_pb2.string_opt])
- self.assertEqual("Hello\0World", message_options.Extensions[
- unittest_custom_options_pb2.bytes_opt])
- dummy_enum = unittest_custom_options_pb2.DummyMessageContainingEnum
- self.assertEqual(
- dummy_enum.TEST_OPTION_ENUM_TYPE2,
- message_options.Extensions[unittest_custom_options_pb2.enum_opt])
-
- message_descriptor =\
- unittest_custom_options_pb2.SettingRealsFromPositiveInts.DESCRIPTOR
- message_options = message_descriptor.GetOptions()
- self.assertAlmostEqual(12, message_options.Extensions[
- unittest_custom_options_pb2.float_opt], 6)
- self.assertAlmostEqual(154, message_options.Extensions[
- unittest_custom_options_pb2.double_opt])
-
- message_descriptor =\
- unittest_custom_options_pb2.SettingRealsFromNegativeInts.DESCRIPTOR
- message_options = message_descriptor.GetOptions()
- self.assertAlmostEqual(-12, message_options.Extensions[
- unittest_custom_options_pb2.float_opt], 6)
- self.assertAlmostEqual(-154, message_options.Extensions[
- unittest_custom_options_pb2.double_opt])
-
- def testComplexExtensionOptions(self):
- descriptor =\
- unittest_custom_options_pb2.VariousComplexOptions.DESCRIPTOR
- options = descriptor.GetOptions()
- self.assertEqual(42, options.Extensions[
- unittest_custom_options_pb2.complex_opt1].foo)
- self.assertEqual(324, options.Extensions[
- unittest_custom_options_pb2.complex_opt1].Extensions[
- unittest_custom_options_pb2.quux])
- self.assertEqual(876, options.Extensions[
- unittest_custom_options_pb2.complex_opt1].Extensions[
- unittest_custom_options_pb2.corge].qux)
- self.assertEqual(987, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].baz)
- self.assertEqual(654, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].Extensions[
- unittest_custom_options_pb2.grault])
- self.assertEqual(743, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].bar.foo)
- self.assertEqual(1999, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].bar.Extensions[
- unittest_custom_options_pb2.quux])
- self.assertEqual(2008, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].bar.Extensions[
- unittest_custom_options_pb2.corge].qux)
- self.assertEqual(741, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].Extensions[
- unittest_custom_options_pb2.garply].foo)
- self.assertEqual(1998, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].Extensions[
- unittest_custom_options_pb2.garply].Extensions[
- unittest_custom_options_pb2.quux])
- self.assertEqual(2121, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].Extensions[
- unittest_custom_options_pb2.garply].Extensions[
- unittest_custom_options_pb2.corge].qux)
- self.assertEqual(1971, options.Extensions[
- unittest_custom_options_pb2.ComplexOptionType2
- .ComplexOptionType4.complex_opt4].waldo)
- self.assertEqual(321, options.Extensions[
- unittest_custom_options_pb2.complex_opt2].fred.waldo)
- self.assertEqual(9, options.Extensions[
- unittest_custom_options_pb2.complex_opt3].qux)
- self.assertEqual(22, options.Extensions[
- unittest_custom_options_pb2.complex_opt3].complexoptiontype5.plugh)
- self.assertEqual(24, options.Extensions[
- unittest_custom_options_pb2.complexopt6].xyzzy)
-
- # Check that aggregate options were parsed and saved correctly in
- # the appropriate descriptors.
- def testAggregateOptions(self):
- file_descriptor = unittest_custom_options_pb2.DESCRIPTOR
- message_descriptor =\
- unittest_custom_options_pb2.AggregateMessage.DESCRIPTOR
- field_descriptor = message_descriptor.fields_by_name["fieldname"]
- enum_descriptor = unittest_custom_options_pb2.AggregateEnum.DESCRIPTOR
- enum_value_descriptor = enum_descriptor.values_by_name["VALUE"]
- service_descriptor =\
- unittest_custom_options_pb2.AggregateService.DESCRIPTOR
- method_descriptor = service_descriptor.FindMethodByName("Method")
-
- # Tests for the different types of data embedded in fileopt
- file_options = file_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.fileopt]
- self.assertEqual(100, file_options.i)
- self.assertEqual("FileAnnotation", file_options.s)
- self.assertEqual("NestedFileAnnotation", file_options.sub.s)
- self.assertEqual("FileExtensionAnnotation", file_options.file.Extensions[
- unittest_custom_options_pb2.fileopt].s)
- self.assertEqual("EmbeddedMessageSetElement", file_options.mset.Extensions[
- unittest_custom_options_pb2.AggregateMessageSetElement
- .message_set_extension].s)
-
- # Simple tests for all the other types of annotations
- self.assertEqual(
- "MessageAnnotation",
- message_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.msgopt].s)
- self.assertEqual(
- "FieldAnnotation",
- field_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.fieldopt].s)
- self.assertEqual(
- "EnumAnnotation",
- enum_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.enumopt].s)
- self.assertEqual(
- "EnumValueAnnotation",
- enum_value_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.enumvalopt].s)
- self.assertEqual(
- "ServiceAnnotation",
- service_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.serviceopt].s)
- self.assertEqual(
- "MethodAnnotation",
- method_descriptor.GetOptions().Extensions[
- unittest_custom_options_pb2.methodopt].s)
-
- def testNestedOptions(self):
- nested_message =\
- unittest_custom_options_pb2.NestedOptionType.NestedMessage.DESCRIPTOR
- self.assertEqual(1001, nested_message.GetOptions().Extensions[
- unittest_custom_options_pb2.message_opt1])
- nested_field = nested_message.fields_by_name["nested_field"]
- self.assertEqual(1002, nested_field.GetOptions().Extensions[
- unittest_custom_options_pb2.field_opt1])
- outer_message =\
- unittest_custom_options_pb2.NestedOptionType.DESCRIPTOR
- nested_enum = outer_message.enum_types_by_name["NestedEnum"]
- self.assertEqual(1003, nested_enum.GetOptions().Extensions[
- unittest_custom_options_pb2.enum_opt1])
- nested_enum_value = outer_message.enum_values_by_name["NESTED_ENUM_VALUE"]
- self.assertEqual(1004, nested_enum_value.GetOptions().Extensions[
- unittest_custom_options_pb2.enum_value_opt1])
- nested_extension = outer_message.extensions_by_name["nested_extension"]
- self.assertEqual(1005, nested_extension.GetOptions().Extensions[
- unittest_custom_options_pb2.field_opt2])
-
- def testFileDescriptorReferences(self):
- self.assertEqual(self.my_enum.file, self.my_file)
- self.assertEqual(self.my_message.file, self.my_file)
-
- def testFileDescriptor(self):
- self.assertEqual(self.my_file.name, 'some/filename/some.proto')
- self.assertEqual(self.my_file.package, 'protobuf_unittest')
-
-
-class DescriptorCopyToProtoTest(unittest.TestCase):
- """Tests for CopyTo functions of Descriptor."""
-
- def _AssertProtoEqual(self, actual_proto, expected_class, expected_ascii):
- expected_proto = expected_class()
- text_format.Merge(expected_ascii, expected_proto)
-
- self.assertEqual(
- actual_proto, expected_proto,
- 'Not equal,\nActual:\n%s\nExpected:\n%s\n'
- % (str(actual_proto), str(expected_proto)))
-
- def _InternalTestCopyToProto(self, desc, expected_proto_class,
- expected_proto_ascii):
- actual = expected_proto_class()
- desc.CopyToProto(actual)
- self._AssertProtoEqual(
- actual, expected_proto_class, expected_proto_ascii)
-
- def testCopyToProto_EmptyMessage(self):
- self._InternalTestCopyToProto(
- unittest_pb2.TestEmptyMessage.DESCRIPTOR,
- descriptor_pb2.DescriptorProto,
- TEST_EMPTY_MESSAGE_DESCRIPTOR_ASCII)
-
- def testCopyToProto_NestedMessage(self):
- TEST_NESTED_MESSAGE_ASCII = """
- name: 'NestedMessage'
- field: <
- name: 'bb'
- number: 1
- label: 1 # Optional
- type: 5 # TYPE_INT32
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR,
- descriptor_pb2.DescriptorProto,
- TEST_NESTED_MESSAGE_ASCII)
-
- def testCopyToProto_ForeignNestedMessage(self):
- TEST_FOREIGN_NESTED_ASCII = """
- name: 'TestForeignNested'
- field: <
- name: 'foreign_nested'
- number: 1
- label: 1 # Optional
- type: 11 # TYPE_MESSAGE
- type_name: '.protobuf_unittest.TestAllTypes.NestedMessage'
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2.TestForeignNested.DESCRIPTOR,
- descriptor_pb2.DescriptorProto,
- TEST_FOREIGN_NESTED_ASCII)
-
- def testCopyToProto_ForeignEnum(self):
- TEST_FOREIGN_ENUM_ASCII = """
- name: 'ForeignEnum'
- value: <
- name: 'FOREIGN_FOO'
- number: 4
- >
- value: <
- name: 'FOREIGN_BAR'
- number: 5
- >
- value: <
- name: 'FOREIGN_BAZ'
- number: 6
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2._FOREIGNENUM,
- descriptor_pb2.EnumDescriptorProto,
- TEST_FOREIGN_ENUM_ASCII)
-
- def testCopyToProto_Options(self):
- TEST_DEPRECATED_FIELDS_ASCII = """
- name: 'TestDeprecatedFields'
- field: <
- name: 'deprecated_int32'
- number: 1
- label: 1 # Optional
- type: 5 # TYPE_INT32
- options: <
- deprecated: true
- >
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2.TestDeprecatedFields.DESCRIPTOR,
- descriptor_pb2.DescriptorProto,
- TEST_DEPRECATED_FIELDS_ASCII)
-
- def testCopyToProto_AllExtensions(self):
- TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII = """
- name: 'TestEmptyMessageWithExtensions'
- extension_range: <
- start: 1
- end: 536870912
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2.TestEmptyMessageWithExtensions.DESCRIPTOR,
- descriptor_pb2.DescriptorProto,
- TEST_EMPTY_MESSAGE_WITH_EXTENSIONS_ASCII)
-
- def testCopyToProto_SeveralExtensions(self):
- TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII = """
- name: 'TestMultipleExtensionRanges'
- extension_range: <
- start: 42
- end: 43
- >
- extension_range: <
- start: 4143
- end: 4244
- >
- extension_range: <
- start: 65536
- end: 536870912
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2.TestMultipleExtensionRanges.DESCRIPTOR,
- descriptor_pb2.DescriptorProto,
- TEST_MESSAGE_WITH_SEVERAL_EXTENSIONS_ASCII)
-
- def testCopyToProto_FileDescriptor(self):
- UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII = ("""
- name: 'google/protobuf/unittest_import.proto'
- package: 'protobuf_unittest_import'
- dependency: 'google/protobuf/unittest_import_public.proto'
- message_type: <
- name: 'ImportMessage'
- field: <
- name: 'd'
- number: 1
- label: 1 # Optional
- type: 5 # TYPE_INT32
- >
- >
- """ +
- """enum_type: <
- name: 'ImportEnum'
- value: <
- name: 'IMPORT_FOO'
- number: 7
- >
- value: <
- name: 'IMPORT_BAR'
- number: 8
- >
- value: <
- name: 'IMPORT_BAZ'
- number: 9
- >
- >
- options: <
- java_package: 'com.google.protobuf.test'
- optimize_for: 1 # SPEED
- >
- public_dependency: 0
- """)
-
- self._InternalTestCopyToProto(
- unittest_import_pb2.DESCRIPTOR,
- descriptor_pb2.FileDescriptorProto,
- UNITTEST_IMPORT_FILE_DESCRIPTOR_ASCII)
-
- def testCopyToProto_ServiceDescriptor(self):
- TEST_SERVICE_ASCII = """
- name: 'TestService'
- method: <
- name: 'Foo'
- input_type: '.protobuf_unittest.FooRequest'
- output_type: '.protobuf_unittest.FooResponse'
- >
- method: <
- name: 'Bar'
- input_type: '.protobuf_unittest.BarRequest'
- output_type: '.protobuf_unittest.BarResponse'
- >
- """
-
- self._InternalTestCopyToProto(
- unittest_pb2.TestService.DESCRIPTOR,
- descriptor_pb2.ServiceDescriptorProto,
- TEST_SERVICE_ASCII)
-
-
-class MakeDescriptorTest(unittest.TestCase):
- def testMakeDescriptorWithUnsignedIntField(self):
- file_descriptor_proto = descriptor_pb2.FileDescriptorProto()
- file_descriptor_proto.name = 'Foo'
- message_type = file_descriptor_proto.message_type.add()
- message_type.name = file_descriptor_proto.name
- field = message_type.field.add()
- field.number = 1
- field.name = 'uint64_field'
- field.label = descriptor.FieldDescriptor.LABEL_REQUIRED
- field.type = descriptor.FieldDescriptor.TYPE_UINT64
- result = descriptor.MakeDescriptor(message_type)
- self.assertEqual(result.fields[0].cpp_type,
- descriptor.FieldDescriptor.CPPTYPE_UINT64)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py
deleted file mode 100755
index feb7752..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/generator_test.py
+++ /dev/null
@@ -1,269 +0,0 @@
-#! /usr/bin/python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# TODO(robinson): Flesh this out considerably. We focused on reflection_test.py
-# first, since it's testing the subtler code, and since it provides decent
-# indirect testing of the protocol compiler output.
-
-"""Unittest that directly tests the output of the pure-Python protocol
-compiler. See //google/protobuf/reflection_test.py for a test which
-further ensures that we can use Python protocol message objects as we expect.
-"""
-
-__author__ = 'robinson@google.com (Will Robinson)'
-
-import unittest
-from google.protobuf.internal import test_bad_identifiers_pb2
-from google.protobuf import unittest_custom_options_pb2
-from google.protobuf import unittest_import_pb2
-from google.protobuf import unittest_import_public_pb2
-from google.protobuf import unittest_mset_pb2
-from google.protobuf import unittest_pb2
-from google.protobuf import unittest_no_generic_services_pb2
-from google.protobuf import service
-
-MAX_EXTENSION = 536870912
-
-
-class GeneratorTest(unittest.TestCase):
-
- def testNestedMessageDescriptor(self):
- field_name = 'optional_nested_message'
- proto_type = unittest_pb2.TestAllTypes
- self.assertEqual(
- proto_type.NestedMessage.DESCRIPTOR,
- proto_type.DESCRIPTOR.fields_by_name[field_name].message_type)
-
- def testEnums(self):
- # We test only module-level enums here.
- # TODO(robinson): Examine descriptors directly to check
- # enum descriptor output.
- self.assertEqual(4, unittest_pb2.FOREIGN_FOO)
- self.assertEqual(5, unittest_pb2.FOREIGN_BAR)
- self.assertEqual(6, unittest_pb2.FOREIGN_BAZ)
-
- proto = unittest_pb2.TestAllTypes()
- self.assertEqual(1, proto.FOO)
- self.assertEqual(1, unittest_pb2.TestAllTypes.FOO)
- self.assertEqual(2, proto.BAR)
- self.assertEqual(2, unittest_pb2.TestAllTypes.BAR)
- self.assertEqual(3, proto.BAZ)
- self.assertEqual(3, unittest_pb2.TestAllTypes.BAZ)
-
- def testExtremeDefaultValues(self):
- message = unittest_pb2.TestExtremeDefaultValues()
-
- # Python pre-2.6 does not have isinf() or isnan() functions, so we have
- # to provide our own.
- def isnan(val):
- # NaN is never equal to itself.
- return val != val
- def isinf(val):
- # Infinity times zero equals NaN.
- return not isnan(val) and isnan(val * 0)
-
- self.assertTrue(isinf(message.inf_double))
- self.assertTrue(message.inf_double > 0)
- self.assertTrue(isinf(message.neg_inf_double))
- self.assertTrue(message.neg_inf_double < 0)
- self.assertTrue(isnan(message.nan_double))
-
- self.assertTrue(isinf(message.inf_float))
- self.assertTrue(message.inf_float > 0)
- self.assertTrue(isinf(message.neg_inf_float))
- self.assertTrue(message.neg_inf_float < 0)
- self.assertTrue(isnan(message.nan_float))
- self.assertEqual("? ? ?? ?? ??? ??/ ??-", message.cpp_trigraph)
-
- def testHasDefaultValues(self):
- desc = unittest_pb2.TestAllTypes.DESCRIPTOR
-
- expected_has_default_by_name = {
- 'optional_int32': False,
- 'repeated_int32': False,
- 'optional_nested_message': False,
- 'default_int32': True,
- }
-
- has_default_by_name = dict(
- [(f.name, f.has_default_value)
- for f in desc.fields
- if f.name in expected_has_default_by_name])
- self.assertEqual(expected_has_default_by_name, has_default_by_name)
-
- def testContainingTypeBehaviorForExtensions(self):
- self.assertEqual(unittest_pb2.optional_int32_extension.containing_type,
- unittest_pb2.TestAllExtensions.DESCRIPTOR)
- self.assertEqual(unittest_pb2.TestRequired.single.containing_type,
- unittest_pb2.TestAllExtensions.DESCRIPTOR)
-
- def testExtensionScope(self):
- self.assertEqual(unittest_pb2.optional_int32_extension.extension_scope,
- None)
- self.assertEqual(unittest_pb2.TestRequired.single.extension_scope,
- unittest_pb2.TestRequired.DESCRIPTOR)
-
- def testIsExtension(self):
- self.assertTrue(unittest_pb2.optional_int32_extension.is_extension)
- self.assertTrue(unittest_pb2.TestRequired.single.is_extension)
-
- message_descriptor = unittest_pb2.TestRequired.DESCRIPTOR
- non_extension_descriptor = message_descriptor.fields_by_name['a']
- self.assertTrue(not non_extension_descriptor.is_extension)
-
- def testOptions(self):
- proto = unittest_mset_pb2.TestMessageSet()
- self.assertTrue(proto.DESCRIPTOR.GetOptions().message_set_wire_format)
-
- def testMessageWithCustomOptions(self):
- proto = unittest_custom_options_pb2.TestMessageWithCustomOptions()
- enum_options = proto.DESCRIPTOR.enum_types_by_name['AnEnum'].GetOptions()
- self.assertTrue(enum_options is not None)
- # TODO(gps): We really should test for the presence of the enum_opt1
- # extension and for its value to be set to -789.
-
- def testNestedTypes(self):
- self.assertEquals(
- set(unittest_pb2.TestAllTypes.DESCRIPTOR.nested_types),
- set([
- unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR,
- unittest_pb2.TestAllTypes.OptionalGroup.DESCRIPTOR,
- unittest_pb2.TestAllTypes.RepeatedGroup.DESCRIPTOR,
- ]))
- self.assertEqual(unittest_pb2.TestEmptyMessage.DESCRIPTOR.nested_types, [])
- self.assertEqual(
- unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR.nested_types, [])
-
- def testContainingType(self):
- self.assertTrue(
- unittest_pb2.TestEmptyMessage.DESCRIPTOR.containing_type is None)
- self.assertTrue(
- unittest_pb2.TestAllTypes.DESCRIPTOR.containing_type is None)
- self.assertEqual(
- unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR.containing_type,
- unittest_pb2.TestAllTypes.DESCRIPTOR)
- self.assertEqual(
- unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR.containing_type,
- unittest_pb2.TestAllTypes.DESCRIPTOR)
- self.assertEqual(
- unittest_pb2.TestAllTypes.RepeatedGroup.DESCRIPTOR.containing_type,
- unittest_pb2.TestAllTypes.DESCRIPTOR)
-
- def testContainingTypeInEnumDescriptor(self):
- self.assertTrue(unittest_pb2._FOREIGNENUM.containing_type is None)
- self.assertEqual(unittest_pb2._TESTALLTYPES_NESTEDENUM.containing_type,
- unittest_pb2.TestAllTypes.DESCRIPTOR)
-
- def testPackage(self):
- self.assertEqual(
- unittest_pb2.TestAllTypes.DESCRIPTOR.file.package,
- 'protobuf_unittest')
- desc = unittest_pb2.TestAllTypes.NestedMessage.DESCRIPTOR
- self.assertEqual(desc.file.package, 'protobuf_unittest')
- self.assertEqual(
- unittest_import_pb2.ImportMessage.DESCRIPTOR.file.package,
- 'protobuf_unittest_import')
-
- self.assertEqual(
- unittest_pb2._FOREIGNENUM.file.package, 'protobuf_unittest')
- self.assertEqual(
- unittest_pb2._TESTALLTYPES_NESTEDENUM.file.package,
- 'protobuf_unittest')
- self.assertEqual(
- unittest_import_pb2._IMPORTENUM.file.package,
- 'protobuf_unittest_import')
-
- def testExtensionRange(self):
- self.assertEqual(
- unittest_pb2.TestAllTypes.DESCRIPTOR.extension_ranges, [])
- self.assertEqual(
- unittest_pb2.TestAllExtensions.DESCRIPTOR.extension_ranges,
- [(1, MAX_EXTENSION)])
- self.assertEqual(
- unittest_pb2.TestMultipleExtensionRanges.DESCRIPTOR.extension_ranges,
- [(42, 43), (4143, 4244), (65536, MAX_EXTENSION)])
-
- def testFileDescriptor(self):
- self.assertEqual(unittest_pb2.DESCRIPTOR.name,
- 'google/protobuf/unittest.proto')
- self.assertEqual(unittest_pb2.DESCRIPTOR.package, 'protobuf_unittest')
- self.assertFalse(unittest_pb2.DESCRIPTOR.serialized_pb is None)
-
- def testNoGenericServices(self):
- self.assertTrue(hasattr(unittest_no_generic_services_pb2, "TestMessage"))
- self.assertTrue(hasattr(unittest_no_generic_services_pb2, "FOO"))
- self.assertTrue(hasattr(unittest_no_generic_services_pb2, "test_extension"))
-
- # Make sure unittest_no_generic_services_pb2 has no services subclassing
- # Proto2 Service class.
- if hasattr(unittest_no_generic_services_pb2, "TestService"):
- self.assertFalse(issubclass(unittest_no_generic_services_pb2.TestService,
- service.Service))
-
- def testMessageTypesByName(self):
- file_type = unittest_pb2.DESCRIPTOR
- self.assertEqual(
- unittest_pb2._TESTALLTYPES,
- file_type.message_types_by_name[unittest_pb2._TESTALLTYPES.name])
-
- # Nested messages shouldn't be included in the message_types_by_name
- # dictionary (like in the C++ API).
- self.assertFalse(
- unittest_pb2._TESTALLTYPES_NESTEDMESSAGE.name in
- file_type.message_types_by_name)
-
- def testPublicImports(self):
- # Test public imports as embedded message.
- all_type_proto = unittest_pb2.TestAllTypes()
- self.assertEqual(0, all_type_proto.optional_public_import_message.e)
-
- # PublicImportMessage is actually defined in unittest_import_public_pb2
- # module, and is public imported by unittest_import_pb2 module.
- public_import_proto = unittest_import_pb2.PublicImportMessage()
- self.assertEqual(0, public_import_proto.e)
- self.assertTrue(unittest_import_public_pb2.PublicImportMessage is
- unittest_import_pb2.PublicImportMessage)
-
- def testBadIdentifiers(self):
- # We're just testing that the code was imported without problems.
- message = test_bad_identifiers_pb2.TestBadIdentifiers()
- self.assertEqual(message.Extensions[test_bad_identifiers_pb2.message],
- "foo")
- self.assertEqual(message.Extensions[test_bad_identifiers_pb2.descriptor],
- "bar")
- self.assertEqual(message.Extensions[test_bad_identifiers_pb2.reflection],
- "baz")
- self.assertEqual(message.Extensions[test_bad_identifiers_pb2.service],
- "qux")
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message
deleted file mode 100644
index 4dd62cd..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_message
+++ /dev/null
Binary files differ
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message
deleted file mode 100644
index ee28d38..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/golden_packed_fields_message
+++ /dev/null
Binary files differ
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py
deleted file mode 100755
index e71b295..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/message_test.py
+++ /dev/null
@@ -1,499 +0,0 @@
-#! /usr/bin/python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Tests python protocol buffers against the golden message.
-
-Note that the golden messages exercise every known field type, thus this
-test ends up exercising and verifying nearly all of the parsing and
-serialization code in the whole library.
-
-TODO(kenton): Merge with wire_format_test? It doesn't make a whole lot of
-sense to call this a test of the "message" module, which only declares an
-abstract interface.
-"""
-
-__author__ = 'gps@google.com (Gregory P. Smith)'
-
-import copy
-import math
-import operator
-import pickle
-
-import unittest
-from google.protobuf import unittest_import_pb2
-from google.protobuf import unittest_pb2
-from google.protobuf.internal import api_implementation
-from google.protobuf.internal import test_util
-from google.protobuf import message
-
-try:
- cmp # Python 2
-except NameError:
- cmp = lambda x, y: (x > y) - (x < y) # Python 3
-
-# Python pre-2.6 does not have isinf() or isnan() functions, so we have
-# to provide our own.
-def isnan(val):
- # NaN is never equal to itself.
- return val != val
-def isinf(val):
- # Infinity times zero equals NaN.
- return not isnan(val) and isnan(val * 0)
-def IsPosInf(val):
- return isinf(val) and (val > 0)
-def IsNegInf(val):
- return isinf(val) and (val < 0)
-
-class MessageTest(unittest.TestCase):
-
- def testGoldenMessage(self):
- golden_data = test_util.GoldenFile('golden_message').read()
- golden_message = unittest_pb2.TestAllTypes()
- golden_message.ParseFromString(golden_data)
- test_util.ExpectAllFieldsSet(self, golden_message)
- self.assertEqual(golden_data, golden_message.SerializeToString())
- golden_copy = copy.deepcopy(golden_message)
- self.assertEqual(golden_data, golden_copy.SerializeToString())
-
- def testGoldenExtensions(self):
- golden_data = test_util.GoldenFile('golden_message').read()
- golden_message = unittest_pb2.TestAllExtensions()
- golden_message.ParseFromString(golden_data)
- all_set = unittest_pb2.TestAllExtensions()
- test_util.SetAllExtensions(all_set)
- self.assertEquals(all_set, golden_message)
- self.assertEqual(golden_data, golden_message.SerializeToString())
- golden_copy = copy.deepcopy(golden_message)
- self.assertEqual(golden_data, golden_copy.SerializeToString())
-
- def testGoldenPackedMessage(self):
- golden_data = test_util.GoldenFile('golden_packed_fields_message').read()
- golden_message = unittest_pb2.TestPackedTypes()
- golden_message.ParseFromString(golden_data)
- all_set = unittest_pb2.TestPackedTypes()
- test_util.SetAllPackedFields(all_set)
- self.assertEquals(all_set, golden_message)
- self.assertEqual(golden_data, all_set.SerializeToString())
- golden_copy = copy.deepcopy(golden_message)
- self.assertEqual(golden_data, golden_copy.SerializeToString())
-
- def testGoldenPackedExtensions(self):
- golden_data = test_util.GoldenFile('golden_packed_fields_message').read()
- golden_message = unittest_pb2.TestPackedExtensions()
- golden_message.ParseFromString(golden_data)
- all_set = unittest_pb2.TestPackedExtensions()
- test_util.SetAllPackedExtensions(all_set)
- self.assertEquals(all_set, golden_message)
- self.assertEqual(golden_data, all_set.SerializeToString())
- golden_copy = copy.deepcopy(golden_message)
- self.assertEqual(golden_data, golden_copy.SerializeToString())
-
- def testPickleSupport(self):
- golden_data = test_util.GoldenFile('golden_message').read()
- golden_message = unittest_pb2.TestAllTypes()
- golden_message.ParseFromString(golden_data)
- pickled_message = pickle.dumps(golden_message)
-
- unpickled_message = pickle.loads(pickled_message)
- self.assertEquals(unpickled_message, golden_message)
-
- def testPickleIncompleteProto(self):
- golden_message = unittest_pb2.TestRequired(a=1)
- pickled_message = pickle.dumps(golden_message)
-
- unpickled_message = pickle.loads(pickled_message)
- self.assertEquals(unpickled_message, golden_message)
- self.assertEquals(unpickled_message.a, 1)
- # This is still an incomplete proto - so serializing should fail
- self.assertRaises(message.EncodeError, unpickled_message.SerializeToString)
-
- def testPositiveInfinity(self):
- golden_data = ('\x5D\x00\x00\x80\x7F'
- '\x61\x00\x00\x00\x00\x00\x00\xF0\x7F'
- '\xCD\x02\x00\x00\x80\x7F'
- '\xD1\x02\x00\x00\x00\x00\x00\x00\xF0\x7F')
- golden_message = unittest_pb2.TestAllTypes()
- golden_message.ParseFromString(golden_data)
- self.assertTrue(IsPosInf(golden_message.optional_float))
- self.assertTrue(IsPosInf(golden_message.optional_double))
- self.assertTrue(IsPosInf(golden_message.repeated_float[0]))
- self.assertTrue(IsPosInf(golden_message.repeated_double[0]))
- self.assertEqual(golden_data, golden_message.SerializeToString())
-
- def testNegativeInfinity(self):
- golden_data = ('\x5D\x00\x00\x80\xFF'
- '\x61\x00\x00\x00\x00\x00\x00\xF0\xFF'
- '\xCD\x02\x00\x00\x80\xFF'
- '\xD1\x02\x00\x00\x00\x00\x00\x00\xF0\xFF')
- golden_message = unittest_pb2.TestAllTypes()
- golden_message.ParseFromString(golden_data)
- self.assertTrue(IsNegInf(golden_message.optional_float))
- self.assertTrue(IsNegInf(golden_message.optional_double))
- self.assertTrue(IsNegInf(golden_message.repeated_float[0]))
- self.assertTrue(IsNegInf(golden_message.repeated_double[0]))
- self.assertEqual(golden_data, golden_message.SerializeToString())
-
- def testNotANumber(self):
- golden_data = ('\x5D\x00\x00\xC0\x7F'
- '\x61\x00\x00\x00\x00\x00\x00\xF8\x7F'
- '\xCD\x02\x00\x00\xC0\x7F'
- '\xD1\x02\x00\x00\x00\x00\x00\x00\xF8\x7F')
- golden_message = unittest_pb2.TestAllTypes()
- golden_message.ParseFromString(golden_data)
- self.assertTrue(isnan(golden_message.optional_float))
- self.assertTrue(isnan(golden_message.optional_double))
- self.assertTrue(isnan(golden_message.repeated_float[0]))
- self.assertTrue(isnan(golden_message.repeated_double[0]))
-
- # The protocol buffer may serialize to any one of multiple different
- # representations of a NaN. Rather than verify a specific representation,
- # verify the serialized string can be converted into a correctly
- # behaving protocol buffer.
- serialized = golden_message.SerializeToString()
- message = unittest_pb2.TestAllTypes()
- message.ParseFromString(serialized)
- self.assertTrue(isnan(message.optional_float))
- self.assertTrue(isnan(message.optional_double))
- self.assertTrue(isnan(message.repeated_float[0]))
- self.assertTrue(isnan(message.repeated_double[0]))
-
- def testPositiveInfinityPacked(self):
- golden_data = ('\xA2\x06\x04\x00\x00\x80\x7F'
- '\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\x7F')
- golden_message = unittest_pb2.TestPackedTypes()
- golden_message.ParseFromString(golden_data)
- self.assertTrue(IsPosInf(golden_message.packed_float[0]))
- self.assertTrue(IsPosInf(golden_message.packed_double[0]))
- self.assertEqual(golden_data, golden_message.SerializeToString())
-
- def testNegativeInfinityPacked(self):
- golden_data = ('\xA2\x06\x04\x00\x00\x80\xFF'
- '\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF0\xFF')
- golden_message = unittest_pb2.TestPackedTypes()
- golden_message.ParseFromString(golden_data)
- self.assertTrue(IsNegInf(golden_message.packed_float[0]))
- self.assertTrue(IsNegInf(golden_message.packed_double[0]))
- self.assertEqual(golden_data, golden_message.SerializeToString())
-
- def testNotANumberPacked(self):
- golden_data = ('\xA2\x06\x04\x00\x00\xC0\x7F'
- '\xAA\x06\x08\x00\x00\x00\x00\x00\x00\xF8\x7F')
- golden_message = unittest_pb2.TestPackedTypes()
- golden_message.ParseFromString(golden_data)
- self.assertTrue(isnan(golden_message.packed_float[0]))
- self.assertTrue(isnan(golden_message.packed_double[0]))
-
- serialized = golden_message.SerializeToString()
- message = unittest_pb2.TestPackedTypes()
- message.ParseFromString(serialized)
- self.assertTrue(isnan(message.packed_float[0]))
- self.assertTrue(isnan(message.packed_double[0]))
-
- def testExtremeFloatValues(self):
- message = unittest_pb2.TestAllTypes()
-
- # Most positive exponent, no significand bits set.
- kMostPosExponentNoSigBits = math.pow(2, 127)
- message.optional_float = kMostPosExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == kMostPosExponentNoSigBits)
-
- # Most positive exponent, one significand bit set.
- kMostPosExponentOneSigBit = 1.5 * math.pow(2, 127)
- message.optional_float = kMostPosExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == kMostPosExponentOneSigBit)
-
- # Repeat last two cases with values of same magnitude, but negative.
- message.optional_float = -kMostPosExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == -kMostPosExponentNoSigBits)
-
- message.optional_float = -kMostPosExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == -kMostPosExponentOneSigBit)
-
- # Most negative exponent, no significand bits set.
- kMostNegExponentNoSigBits = math.pow(2, -127)
- message.optional_float = kMostNegExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == kMostNegExponentNoSigBits)
-
- # Most negative exponent, one significand bit set.
- kMostNegExponentOneSigBit = 1.5 * math.pow(2, -127)
- message.optional_float = kMostNegExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == kMostNegExponentOneSigBit)
-
- # Repeat last two cases with values of the same magnitude, but negative.
- message.optional_float = -kMostNegExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == -kMostNegExponentNoSigBits)
-
- message.optional_float = -kMostNegExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_float == -kMostNegExponentOneSigBit)
-
- def testExtremeDoubleValues(self):
- message = unittest_pb2.TestAllTypes()
-
- # Most positive exponent, no significand bits set.
- kMostPosExponentNoSigBits = math.pow(2, 1023)
- message.optional_double = kMostPosExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == kMostPosExponentNoSigBits)
-
- # Most positive exponent, one significand bit set.
- kMostPosExponentOneSigBit = 1.5 * math.pow(2, 1023)
- message.optional_double = kMostPosExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == kMostPosExponentOneSigBit)
-
- # Repeat last two cases with values of same magnitude, but negative.
- message.optional_double = -kMostPosExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == -kMostPosExponentNoSigBits)
-
- message.optional_double = -kMostPosExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == -kMostPosExponentOneSigBit)
-
- # Most negative exponent, no significand bits set.
- kMostNegExponentNoSigBits = math.pow(2, -1023)
- message.optional_double = kMostNegExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == kMostNegExponentNoSigBits)
-
- # Most negative exponent, one significand bit set.
- kMostNegExponentOneSigBit = 1.5 * math.pow(2, -1023)
- message.optional_double = kMostNegExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == kMostNegExponentOneSigBit)
-
- # Repeat last two cases with values of the same magnitude, but negative.
- message.optional_double = -kMostNegExponentNoSigBits
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == -kMostNegExponentNoSigBits)
-
- message.optional_double = -kMostNegExponentOneSigBit
- message.ParseFromString(message.SerializeToString())
- self.assertTrue(message.optional_double == -kMostNegExponentOneSigBit)
-
- def testSortingRepeatedScalarFieldsDefaultComparator(self):
- """Check some different types with the default comparator."""
- message = unittest_pb2.TestAllTypes()
-
- # TODO(mattp): would testing more scalar types strengthen test?
- message.repeated_int32.append(1)
- message.repeated_int32.append(3)
- message.repeated_int32.append(2)
- message.repeated_int32.sort()
- self.assertEqual(message.repeated_int32[0], 1)
- self.assertEqual(message.repeated_int32[1], 2)
- self.assertEqual(message.repeated_int32[2], 3)
-
- message.repeated_float.append(1.1)
- message.repeated_float.append(1.3)
- message.repeated_float.append(1.2)
- message.repeated_float.sort()
- self.assertAlmostEqual(message.repeated_float[0], 1.1)
- self.assertAlmostEqual(message.repeated_float[1], 1.2)
- self.assertAlmostEqual(message.repeated_float[2], 1.3)
-
- message.repeated_string.append('a')
- message.repeated_string.append('c')
- message.repeated_string.append('b')
- message.repeated_string.sort()
- self.assertEqual(message.repeated_string[0], 'a')
- self.assertEqual(message.repeated_string[1], 'b')
- self.assertEqual(message.repeated_string[2], 'c')
-
- message.repeated_bytes.append('a')
- message.repeated_bytes.append('c')
- message.repeated_bytes.append('b')
- message.repeated_bytes.sort()
- self.assertEqual(message.repeated_bytes[0], 'a')
- self.assertEqual(message.repeated_bytes[1], 'b')
- self.assertEqual(message.repeated_bytes[2], 'c')
-
- def testSortingRepeatedScalarFieldsCustomComparator(self):
- """Check some different types with custom comparator."""
- message = unittest_pb2.TestAllTypes()
-
- message.repeated_int32.append(-3)
- message.repeated_int32.append(-2)
- message.repeated_int32.append(-1)
- message.repeated_int32.sort(lambda x,y: cmp(abs(x), abs(y)))
- self.assertEqual(message.repeated_int32[0], -1)
- self.assertEqual(message.repeated_int32[1], -2)
- self.assertEqual(message.repeated_int32[2], -3)
-
- message.repeated_string.append('aaa')
- message.repeated_string.append('bb')
- message.repeated_string.append('c')
- message.repeated_string.sort(lambda x,y: cmp(len(x), len(y)))
- self.assertEqual(message.repeated_string[0], 'c')
- self.assertEqual(message.repeated_string[1], 'bb')
- self.assertEqual(message.repeated_string[2], 'aaa')
-
- def testSortingRepeatedCompositeFieldsCustomComparator(self):
- """Check passing a custom comparator to sort a repeated composite field."""
- message = unittest_pb2.TestAllTypes()
-
- message.repeated_nested_message.add().bb = 1
- message.repeated_nested_message.add().bb = 3
- message.repeated_nested_message.add().bb = 2
- message.repeated_nested_message.add().bb = 6
- message.repeated_nested_message.add().bb = 5
- message.repeated_nested_message.add().bb = 4
- message.repeated_nested_message.sort(lambda x,y: cmp(x.bb, y.bb))
- self.assertEqual(message.repeated_nested_message[0].bb, 1)
- self.assertEqual(message.repeated_nested_message[1].bb, 2)
- self.assertEqual(message.repeated_nested_message[2].bb, 3)
- self.assertEqual(message.repeated_nested_message[3].bb, 4)
- self.assertEqual(message.repeated_nested_message[4].bb, 5)
- self.assertEqual(message.repeated_nested_message[5].bb, 6)
-
- def testRepeatedCompositeFieldSortArguments(self):
- """Check sorting a repeated composite field using list.sort() arguments."""
- message = unittest_pb2.TestAllTypes()
-
- get_bb = operator.attrgetter('bb')
- cmp_bb = lambda a, b: cmp(a.bb, b.bb)
- message.repeated_nested_message.add().bb = 1
- message.repeated_nested_message.add().bb = 3
- message.repeated_nested_message.add().bb = 2
- message.repeated_nested_message.add().bb = 6
- message.repeated_nested_message.add().bb = 5
- message.repeated_nested_message.add().bb = 4
- message.repeated_nested_message.sort(key=get_bb)
- self.assertEqual([k.bb for k in message.repeated_nested_message],
- [1, 2, 3, 4, 5, 6])
- message.repeated_nested_message.sort(key=get_bb, reverse=True)
- self.assertEqual([k.bb for k in message.repeated_nested_message],
- [6, 5, 4, 3, 2, 1])
- message.repeated_nested_message.sort(sort_function=cmp_bb)
- self.assertEqual([k.bb for k in message.repeated_nested_message],
- [1, 2, 3, 4, 5, 6])
- message.repeated_nested_message.sort(cmp=cmp_bb, reverse=True)
- self.assertEqual([k.bb for k in message.repeated_nested_message],
- [6, 5, 4, 3, 2, 1])
-
- def testRepeatedScalarFieldSortArguments(self):
- """Check sorting a scalar field using list.sort() arguments."""
- message = unittest_pb2.TestAllTypes()
-
- abs_cmp = lambda a, b: cmp(abs(a), abs(b))
- message.repeated_int32.append(-3)
- message.repeated_int32.append(-2)
- message.repeated_int32.append(-1)
- message.repeated_int32.sort(key=abs)
- self.assertEqual(list(message.repeated_int32), [-1, -2, -3])
- message.repeated_int32.sort(key=abs, reverse=True)
- self.assertEqual(list(message.repeated_int32), [-3, -2, -1])
- message.repeated_int32.sort(sort_function=abs_cmp)
- self.assertEqual(list(message.repeated_int32), [-1, -2, -3])
- message.repeated_int32.sort(cmp=abs_cmp, reverse=True)
- self.assertEqual(list(message.repeated_int32), [-3, -2, -1])
-
- len_cmp = lambda a, b: cmp(len(a), len(b))
- message.repeated_string.append('aaa')
- message.repeated_string.append('bb')
- message.repeated_string.append('c')
- message.repeated_string.sort(key=len)
- self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa'])
- message.repeated_string.sort(key=len, reverse=True)
- self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
- message.repeated_string.sort(sort_function=len_cmp)
- self.assertEqual(list(message.repeated_string), ['c', 'bb', 'aaa'])
- message.repeated_string.sort(cmp=len_cmp, reverse=True)
- self.assertEqual(list(message.repeated_string), ['aaa', 'bb', 'c'])
-
- def testParsingMerge(self):
- """Check the merge behavior when a required or optional field appears
- multiple times in the input."""
- messages = [
- unittest_pb2.TestAllTypes(),
- unittest_pb2.TestAllTypes(),
- unittest_pb2.TestAllTypes() ]
- messages[0].optional_int32 = 1
- messages[1].optional_int64 = 2
- messages[2].optional_int32 = 3
- messages[2].optional_string = 'hello'
-
- merged_message = unittest_pb2.TestAllTypes()
- merged_message.optional_int32 = 3
- merged_message.optional_int64 = 2
- merged_message.optional_string = 'hello'
-
- generator = unittest_pb2.TestParsingMerge.RepeatedFieldsGenerator()
- generator.field1.extend(messages)
- generator.field2.extend(messages)
- generator.field3.extend(messages)
- generator.ext1.extend(messages)
- generator.ext2.extend(messages)
- generator.group1.add().field1.MergeFrom(messages[0])
- generator.group1.add().field1.MergeFrom(messages[1])
- generator.group1.add().field1.MergeFrom(messages[2])
- generator.group2.add().field1.MergeFrom(messages[0])
- generator.group2.add().field1.MergeFrom(messages[1])
- generator.group2.add().field1.MergeFrom(messages[2])
-
- data = generator.SerializeToString()
- parsing_merge = unittest_pb2.TestParsingMerge()
- parsing_merge.ParseFromString(data)
-
- # Required and optional fields should be merged.
- self.assertEqual(parsing_merge.required_all_types, merged_message)
- self.assertEqual(parsing_merge.optional_all_types, merged_message)
- self.assertEqual(parsing_merge.optionalgroup.optional_group_all_types,
- merged_message)
- self.assertEqual(parsing_merge.Extensions[
- unittest_pb2.TestParsingMerge.optional_ext],
- merged_message)
-
- # Repeated fields should not be merged.
- self.assertEqual(len(parsing_merge.repeated_all_types), 3)
- self.assertEqual(len(parsing_merge.repeatedgroup), 3)
- self.assertEqual(len(parsing_merge.Extensions[
- unittest_pb2.TestParsingMerge.repeated_ext]), 3)
-
-
- def testSortEmptyRepeatedCompositeContainer(self):
- """Exercise a scenario that has led to segfaults in the past.
- """
- m = unittest_pb2.TestAllTypes()
- m.repeated_nested_message.sort()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py
deleted file mode 100755
index 9b7356f..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/service_reflection_test.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#! /usr/bin/python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Tests for google.protobuf.internal.service_reflection."""
-
-__author__ = 'petar@google.com (Petar Petrov)'
-
-import unittest
-from google.protobuf import unittest_pb2
-from google.protobuf import service_reflection
-from google.protobuf import service
-
-
-class FooUnitTest(unittest.TestCase):
-
- def testService(self):
- class MockRpcChannel(service.RpcChannel):
- def CallMethod(self, method, controller, request, response, callback):
- self.method = method
- self.controller = controller
- self.request = request
- callback(response)
-
- class MockRpcController(service.RpcController):
- def SetFailed(self, msg):
- self.failure_message = msg
-
- self.callback_response = None
-
- class MyService(unittest_pb2.TestService):
- pass
-
- self.callback_response = None
-
- def MyCallback(response):
- self.callback_response = response
-
- rpc_controller = MockRpcController()
- channel = MockRpcChannel()
- srvc = MyService()
- srvc.Foo(rpc_controller, unittest_pb2.FooRequest(), MyCallback)
- self.assertEqual('Method Foo not implemented.',
- rpc_controller.failure_message)
- self.assertEqual(None, self.callback_response)
-
- rpc_controller.failure_message = None
-
- service_descriptor = unittest_pb2.TestService.GetDescriptor()
- srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
- unittest_pb2.BarRequest(), MyCallback)
- self.assertEqual('Method Bar not implemented.',
- rpc_controller.failure_message)
- self.assertEqual(None, self.callback_response)
-
- class MyServiceImpl(unittest_pb2.TestService):
- def Foo(self, rpc_controller, request, done):
- self.foo_called = True
- def Bar(self, rpc_controller, request, done):
- self.bar_called = True
-
- srvc = MyServiceImpl()
- rpc_controller.failure_message = None
- srvc.Foo(rpc_controller, unittest_pb2.FooRequest(), MyCallback)
- self.assertEqual(None, rpc_controller.failure_message)
- self.assertEqual(True, srvc.foo_called)
-
- rpc_controller.failure_message = None
- srvc.CallMethod(service_descriptor.methods[1], rpc_controller,
- unittest_pb2.BarRequest(), MyCallback)
- self.assertEqual(None, rpc_controller.failure_message)
- self.assertEqual(True, srvc.bar_called)
-
- def testServiceStub(self):
- class MockRpcChannel(service.RpcChannel):
- def CallMethod(self, method, controller, request,
- response_class, callback):
- self.method = method
- self.controller = controller
- self.request = request
- callback(response_class())
-
- self.callback_response = None
-
- def MyCallback(response):
- self.callback_response = response
-
- channel = MockRpcChannel()
- stub = unittest_pb2.TestService_Stub(channel)
- rpc_controller = 'controller'
- request = 'request'
-
- # GetDescriptor now static, still works as instance method for compatibility
- self.assertEqual(unittest_pb2.TestService_Stub.GetDescriptor(),
- stub.GetDescriptor())
-
- # Invoke method.
- stub.Foo(rpc_controller, request, MyCallback)
-
- self.assertTrue(isinstance(self.callback_response,
- unittest_pb2.FooResponse))
- self.assertEqual(request, channel.request)
- self.assertEqual(rpc_controller, channel.controller)
- self.assertEqual(stub.GetDescriptor().methods[0], channel.method)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py
deleted file mode 100644
index e2c9db0..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/test_util.py
+++ /dev/null
@@ -1,651 +0,0 @@
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Utilities for Python proto2 tests.
-
-This is intentionally modeled on C++ code in
-//google/protobuf/test_util.*.
-"""
-
-__author__ = 'robinson@google.com (Will Robinson)'
-
-import os.path
-
-from google.protobuf import unittest_import_pb2
-from google.protobuf import unittest_pb2
-
-
-def SetAllNonLazyFields(message):
- """Sets every non-lazy field in the message to a unique value.
-
- Args:
- message: A unittest_pb2.TestAllTypes instance.
- """
-
- #
- # Optional fields.
- #
-
- message.optional_int32 = 101
- message.optional_int64 = 102
- message.optional_uint32 = 103
- message.optional_uint64 = 104
- message.optional_sint32 = 105
- message.optional_sint64 = 106
- message.optional_fixed32 = 107
- message.optional_fixed64 = 108
- message.optional_sfixed32 = 109
- message.optional_sfixed64 = 110
- message.optional_float = 111
- message.optional_double = 112
- message.optional_bool = True
- # TODO(robinson): Firmly spec out and test how
- # protos interact with unicode. One specific example:
- # what happens if we change the literal below to
- # u'115'? What *should* happen? Still some discussion
- # to finish with Kenton about bytes vs. strings
- # and forcing everything to be utf8. :-/
- message.optional_string = '115'
- message.optional_bytes = '116'
-
- message.optionalgroup.a = 117
- message.optional_nested_message.bb = 118
- message.optional_foreign_message.c = 119
- message.optional_import_message.d = 120
- message.optional_public_import_message.e = 126
-
- message.optional_nested_enum = unittest_pb2.TestAllTypes.BAZ
- message.optional_foreign_enum = unittest_pb2.FOREIGN_BAZ
- message.optional_import_enum = unittest_import_pb2.IMPORT_BAZ
-
- message.optional_string_piece = '124'
- message.optional_cord = '125'
-
- #
- # Repeated fields.
- #
-
- message.repeated_int32.append(201)
- message.repeated_int64.append(202)
- message.repeated_uint32.append(203)
- message.repeated_uint64.append(204)
- message.repeated_sint32.append(205)
- message.repeated_sint64.append(206)
- message.repeated_fixed32.append(207)
- message.repeated_fixed64.append(208)
- message.repeated_sfixed32.append(209)
- message.repeated_sfixed64.append(210)
- message.repeated_float.append(211)
- message.repeated_double.append(212)
- message.repeated_bool.append(True)
- message.repeated_string.append('215')
- message.repeated_bytes.append('216')
-
- message.repeatedgroup.add().a = 217
- message.repeated_nested_message.add().bb = 218
- message.repeated_foreign_message.add().c = 219
- message.repeated_import_message.add().d = 220
- message.repeated_lazy_message.add().bb = 227
-
- message.repeated_nested_enum.append(unittest_pb2.TestAllTypes.BAR)
- message.repeated_foreign_enum.append(unittest_pb2.FOREIGN_BAR)
- message.repeated_import_enum.append(unittest_import_pb2.IMPORT_BAR)
-
- message.repeated_string_piece.append('224')
- message.repeated_cord.append('225')
-
- # Add a second one of each field.
- message.repeated_int32.append(301)
- message.repeated_int64.append(302)
- message.repeated_uint32.append(303)
- message.repeated_uint64.append(304)
- message.repeated_sint32.append(305)
- message.repeated_sint64.append(306)
- message.repeated_fixed32.append(307)
- message.repeated_fixed64.append(308)
- message.repeated_sfixed32.append(309)
- message.repeated_sfixed64.append(310)
- message.repeated_float.append(311)
- message.repeated_double.append(312)
- message.repeated_bool.append(False)
- message.repeated_string.append('315')
- message.repeated_bytes.append('316')
-
- message.repeatedgroup.add().a = 317
- message.repeated_nested_message.add().bb = 318
- message.repeated_foreign_message.add().c = 319
- message.repeated_import_message.add().d = 320
- message.repeated_lazy_message.add().bb = 327
-
- message.repeated_nested_enum.append(unittest_pb2.TestAllTypes.BAZ)
- message.repeated_foreign_enum.append(unittest_pb2.FOREIGN_BAZ)
- message.repeated_import_enum.append(unittest_import_pb2.IMPORT_BAZ)
-
- message.repeated_string_piece.append('324')
- message.repeated_cord.append('325')
-
- #
- # Fields that have defaults.
- #
-
- message.default_int32 = 401
- message.default_int64 = 402
- message.default_uint32 = 403
- message.default_uint64 = 404
- message.default_sint32 = 405
- message.default_sint64 = 406
- message.default_fixed32 = 407
- message.default_fixed64 = 408
- message.default_sfixed32 = 409
- message.default_sfixed64 = 410
- message.default_float = 411
- message.default_double = 412
- message.default_bool = False
- message.default_string = '415'
- message.default_bytes = '416'
-
- message.default_nested_enum = unittest_pb2.TestAllTypes.FOO
- message.default_foreign_enum = unittest_pb2.FOREIGN_FOO
- message.default_import_enum = unittest_import_pb2.IMPORT_FOO
-
- message.default_string_piece = '424'
- message.default_cord = '425'
-
-
-def SetAllFields(message):
- SetAllNonLazyFields(message)
- message.optional_lazy_message.bb = 127
-
-
-def SetAllExtensions(message):
- """Sets every extension in the message to a unique value.
-
- Args:
- message: A unittest_pb2.TestAllExtensions instance.
- """
-
- extensions = message.Extensions
- pb2 = unittest_pb2
- import_pb2 = unittest_import_pb2
-
- #
- # Optional fields.
- #
-
- extensions[pb2.optional_int32_extension] = 101
- extensions[pb2.optional_int64_extension] = 102
- extensions[pb2.optional_uint32_extension] = 103
- extensions[pb2.optional_uint64_extension] = 104
- extensions[pb2.optional_sint32_extension] = 105
- extensions[pb2.optional_sint64_extension] = 106
- extensions[pb2.optional_fixed32_extension] = 107
- extensions[pb2.optional_fixed64_extension] = 108
- extensions[pb2.optional_sfixed32_extension] = 109
- extensions[pb2.optional_sfixed64_extension] = 110
- extensions[pb2.optional_float_extension] = 111
- extensions[pb2.optional_double_extension] = 112
- extensions[pb2.optional_bool_extension] = True
- extensions[pb2.optional_string_extension] = '115'
- extensions[pb2.optional_bytes_extension] = '116'
-
- extensions[pb2.optionalgroup_extension].a = 117
- extensions[pb2.optional_nested_message_extension].bb = 118
- extensions[pb2.optional_foreign_message_extension].c = 119
- extensions[pb2.optional_import_message_extension].d = 120
- extensions[pb2.optional_public_import_message_extension].e = 126
- extensions[pb2.optional_lazy_message_extension].bb = 127
-
- extensions[pb2.optional_nested_enum_extension] = pb2.TestAllTypes.BAZ
- extensions[pb2.optional_nested_enum_extension] = pb2.TestAllTypes.BAZ
- extensions[pb2.optional_foreign_enum_extension] = pb2.FOREIGN_BAZ
- extensions[pb2.optional_import_enum_extension] = import_pb2.IMPORT_BAZ
-
- extensions[pb2.optional_string_piece_extension] = '124'
- extensions[pb2.optional_cord_extension] = '125'
-
- #
- # Repeated fields.
- #
-
- extensions[pb2.repeated_int32_extension].append(201)
- extensions[pb2.repeated_int64_extension].append(202)
- extensions[pb2.repeated_uint32_extension].append(203)
- extensions[pb2.repeated_uint64_extension].append(204)
- extensions[pb2.repeated_sint32_extension].append(205)
- extensions[pb2.repeated_sint64_extension].append(206)
- extensions[pb2.repeated_fixed32_extension].append(207)
- extensions[pb2.repeated_fixed64_extension].append(208)
- extensions[pb2.repeated_sfixed32_extension].append(209)
- extensions[pb2.repeated_sfixed64_extension].append(210)
- extensions[pb2.repeated_float_extension].append(211)
- extensions[pb2.repeated_double_extension].append(212)
- extensions[pb2.repeated_bool_extension].append(True)
- extensions[pb2.repeated_string_extension].append('215')
- extensions[pb2.repeated_bytes_extension].append('216')
-
- extensions[pb2.repeatedgroup_extension].add().a = 217
- extensions[pb2.repeated_nested_message_extension].add().bb = 218
- extensions[pb2.repeated_foreign_message_extension].add().c = 219
- extensions[pb2.repeated_import_message_extension].add().d = 220
- extensions[pb2.repeated_lazy_message_extension].add().bb = 227
-
- extensions[pb2.repeated_nested_enum_extension].append(pb2.TestAllTypes.BAR)
- extensions[pb2.repeated_foreign_enum_extension].append(pb2.FOREIGN_BAR)
- extensions[pb2.repeated_import_enum_extension].append(import_pb2.IMPORT_BAR)
-
- extensions[pb2.repeated_string_piece_extension].append('224')
- extensions[pb2.repeated_cord_extension].append('225')
-
- # Append a second one of each field.
- extensions[pb2.repeated_int32_extension].append(301)
- extensions[pb2.repeated_int64_extension].append(302)
- extensions[pb2.repeated_uint32_extension].append(303)
- extensions[pb2.repeated_uint64_extension].append(304)
- extensions[pb2.repeated_sint32_extension].append(305)
- extensions[pb2.repeated_sint64_extension].append(306)
- extensions[pb2.repeated_fixed32_extension].append(307)
- extensions[pb2.repeated_fixed64_extension].append(308)
- extensions[pb2.repeated_sfixed32_extension].append(309)
- extensions[pb2.repeated_sfixed64_extension].append(310)
- extensions[pb2.repeated_float_extension].append(311)
- extensions[pb2.repeated_double_extension].append(312)
- extensions[pb2.repeated_bool_extension].append(False)
- extensions[pb2.repeated_string_extension].append('315')
- extensions[pb2.repeated_bytes_extension].append('316')
-
- extensions[pb2.repeatedgroup_extension].add().a = 317
- extensions[pb2.repeated_nested_message_extension].add().bb = 318
- extensions[pb2.repeated_foreign_message_extension].add().c = 319
- extensions[pb2.repeated_import_message_extension].add().d = 320
- extensions[pb2.repeated_lazy_message_extension].add().bb = 327
-
- extensions[pb2.repeated_nested_enum_extension].append(pb2.TestAllTypes.BAZ)
- extensions[pb2.repeated_foreign_enum_extension].append(pb2.FOREIGN_BAZ)
- extensions[pb2.repeated_import_enum_extension].append(import_pb2.IMPORT_BAZ)
-
- extensions[pb2.repeated_string_piece_extension].append('324')
- extensions[pb2.repeated_cord_extension].append('325')
-
- #
- # Fields with defaults.
- #
-
- extensions[pb2.default_int32_extension] = 401
- extensions[pb2.default_int64_extension] = 402
- extensions[pb2.default_uint32_extension] = 403
- extensions[pb2.default_uint64_extension] = 404
- extensions[pb2.default_sint32_extension] = 405
- extensions[pb2.default_sint64_extension] = 406
- extensions[pb2.default_fixed32_extension] = 407
- extensions[pb2.default_fixed64_extension] = 408
- extensions[pb2.default_sfixed32_extension] = 409
- extensions[pb2.default_sfixed64_extension] = 410
- extensions[pb2.default_float_extension] = 411
- extensions[pb2.default_double_extension] = 412
- extensions[pb2.default_bool_extension] = False
- extensions[pb2.default_string_extension] = '415'
- extensions[pb2.default_bytes_extension] = '416'
-
- extensions[pb2.default_nested_enum_extension] = pb2.TestAllTypes.FOO
- extensions[pb2.default_foreign_enum_extension] = pb2.FOREIGN_FOO
- extensions[pb2.default_import_enum_extension] = import_pb2.IMPORT_FOO
-
- extensions[pb2.default_string_piece_extension] = '424'
- extensions[pb2.default_cord_extension] = '425'
-
-
-def SetAllFieldsAndExtensions(message):
- """Sets every field and extension in the message to a unique value.
-
- Args:
- message: A unittest_pb2.TestAllExtensions message.
- """
- message.my_int = 1
- message.my_string = 'foo'
- message.my_float = 1.0
- message.Extensions[unittest_pb2.my_extension_int] = 23
- message.Extensions[unittest_pb2.my_extension_string] = 'bar'
-
-
-def ExpectAllFieldsAndExtensionsInOrder(serialized):
- """Ensures that serialized is the serialization we expect for a message
- filled with SetAllFieldsAndExtensions(). (Specifically, ensures that the
- serialization is in canonical, tag-number order).
- """
- my_extension_int = unittest_pb2.my_extension_int
- my_extension_string = unittest_pb2.my_extension_string
- expected_strings = []
- message = unittest_pb2.TestFieldOrderings()
- message.my_int = 1 # Field 1.
- expected_strings.append(message.SerializeToString())
- message.Clear()
- message.Extensions[my_extension_int] = 23 # Field 5.
- expected_strings.append(message.SerializeToString())
- message.Clear()
- message.my_string = 'foo' # Field 11.
- expected_strings.append(message.SerializeToString())
- message.Clear()
- message.Extensions[my_extension_string] = 'bar' # Field 50.
- expected_strings.append(message.SerializeToString())
- message.Clear()
- message.my_float = 1.0
- expected_strings.append(message.SerializeToString())
- message.Clear()
- expected = ''.join(expected_strings)
-
- if expected != serialized:
- raise ValueError('Expected %r, found %r' % (expected, serialized))
-
-
-def ExpectAllFieldsSet(test_case, message):
- """Check all fields for correct values have after Set*Fields() is called."""
- test_case.assertTrue(message.HasField('optional_int32'))
- test_case.assertTrue(message.HasField('optional_int64'))
- test_case.assertTrue(message.HasField('optional_uint32'))
- test_case.assertTrue(message.HasField('optional_uint64'))
- test_case.assertTrue(message.HasField('optional_sint32'))
- test_case.assertTrue(message.HasField('optional_sint64'))
- test_case.assertTrue(message.HasField('optional_fixed32'))
- test_case.assertTrue(message.HasField('optional_fixed64'))
- test_case.assertTrue(message.HasField('optional_sfixed32'))
- test_case.assertTrue(message.HasField('optional_sfixed64'))
- test_case.assertTrue(message.HasField('optional_float'))
- test_case.assertTrue(message.HasField('optional_double'))
- test_case.assertTrue(message.HasField('optional_bool'))
- test_case.assertTrue(message.HasField('optional_string'))
- test_case.assertTrue(message.HasField('optional_bytes'))
-
- test_case.assertTrue(message.HasField('optionalgroup'))
- test_case.assertTrue(message.HasField('optional_nested_message'))
- test_case.assertTrue(message.HasField('optional_foreign_message'))
- test_case.assertTrue(message.HasField('optional_import_message'))
-
- test_case.assertTrue(message.optionalgroup.HasField('a'))
- test_case.assertTrue(message.optional_nested_message.HasField('bb'))
- test_case.assertTrue(message.optional_foreign_message.HasField('c'))
- test_case.assertTrue(message.optional_import_message.HasField('d'))
-
- test_case.assertTrue(message.HasField('optional_nested_enum'))
- test_case.assertTrue(message.HasField('optional_foreign_enum'))
- test_case.assertTrue(message.HasField('optional_import_enum'))
-
- test_case.assertTrue(message.HasField('optional_string_piece'))
- test_case.assertTrue(message.HasField('optional_cord'))
-
- test_case.assertEqual(101, message.optional_int32)
- test_case.assertEqual(102, message.optional_int64)
- test_case.assertEqual(103, message.optional_uint32)
- test_case.assertEqual(104, message.optional_uint64)
- test_case.assertEqual(105, message.optional_sint32)
- test_case.assertEqual(106, message.optional_sint64)
- test_case.assertEqual(107, message.optional_fixed32)
- test_case.assertEqual(108, message.optional_fixed64)
- test_case.assertEqual(109, message.optional_sfixed32)
- test_case.assertEqual(110, message.optional_sfixed64)
- test_case.assertEqual(111, message.optional_float)
- test_case.assertEqual(112, message.optional_double)
- test_case.assertEqual(True, message.optional_bool)
- test_case.assertEqual('115', message.optional_string)
- test_case.assertEqual('116', message.optional_bytes)
-
- test_case.assertEqual(117, message.optionalgroup.a)
- test_case.assertEqual(118, message.optional_nested_message.bb)
- test_case.assertEqual(119, message.optional_foreign_message.c)
- test_case.assertEqual(120, message.optional_import_message.d)
- test_case.assertEqual(126, message.optional_public_import_message.e)
- test_case.assertEqual(127, message.optional_lazy_message.bb)
-
- test_case.assertEqual(unittest_pb2.TestAllTypes.BAZ,
- message.optional_nested_enum)
- test_case.assertEqual(unittest_pb2.FOREIGN_BAZ,
- message.optional_foreign_enum)
- test_case.assertEqual(unittest_import_pb2.IMPORT_BAZ,
- message.optional_import_enum)
-
- # -----------------------------------------------------------------
-
- test_case.assertEqual(2, len(message.repeated_int32))
- test_case.assertEqual(2, len(message.repeated_int64))
- test_case.assertEqual(2, len(message.repeated_uint32))
- test_case.assertEqual(2, len(message.repeated_uint64))
- test_case.assertEqual(2, len(message.repeated_sint32))
- test_case.assertEqual(2, len(message.repeated_sint64))
- test_case.assertEqual(2, len(message.repeated_fixed32))
- test_case.assertEqual(2, len(message.repeated_fixed64))
- test_case.assertEqual(2, len(message.repeated_sfixed32))
- test_case.assertEqual(2, len(message.repeated_sfixed64))
- test_case.assertEqual(2, len(message.repeated_float))
- test_case.assertEqual(2, len(message.repeated_double))
- test_case.assertEqual(2, len(message.repeated_bool))
- test_case.assertEqual(2, len(message.repeated_string))
- test_case.assertEqual(2, len(message.repeated_bytes))
-
- test_case.assertEqual(2, len(message.repeatedgroup))
- test_case.assertEqual(2, len(message.repeated_nested_message))
- test_case.assertEqual(2, len(message.repeated_foreign_message))
- test_case.assertEqual(2, len(message.repeated_import_message))
- test_case.assertEqual(2, len(message.repeated_nested_enum))
- test_case.assertEqual(2, len(message.repeated_foreign_enum))
- test_case.assertEqual(2, len(message.repeated_import_enum))
-
- test_case.assertEqual(2, len(message.repeated_string_piece))
- test_case.assertEqual(2, len(message.repeated_cord))
-
- test_case.assertEqual(201, message.repeated_int32[0])
- test_case.assertEqual(202, message.repeated_int64[0])
- test_case.assertEqual(203, message.repeated_uint32[0])
- test_case.assertEqual(204, message.repeated_uint64[0])
- test_case.assertEqual(205, message.repeated_sint32[0])
- test_case.assertEqual(206, message.repeated_sint64[0])
- test_case.assertEqual(207, message.repeated_fixed32[0])
- test_case.assertEqual(208, message.repeated_fixed64[0])
- test_case.assertEqual(209, message.repeated_sfixed32[0])
- test_case.assertEqual(210, message.repeated_sfixed64[0])
- test_case.assertEqual(211, message.repeated_float[0])
- test_case.assertEqual(212, message.repeated_double[0])
- test_case.assertEqual(True, message.repeated_bool[0])
- test_case.assertEqual('215', message.repeated_string[0])
- test_case.assertEqual('216', message.repeated_bytes[0])
-
- test_case.assertEqual(217, message.repeatedgroup[0].a)
- test_case.assertEqual(218, message.repeated_nested_message[0].bb)
- test_case.assertEqual(219, message.repeated_foreign_message[0].c)
- test_case.assertEqual(220, message.repeated_import_message[0].d)
- test_case.assertEqual(227, message.repeated_lazy_message[0].bb)
-
- test_case.assertEqual(unittest_pb2.TestAllTypes.BAR,
- message.repeated_nested_enum[0])
- test_case.assertEqual(unittest_pb2.FOREIGN_BAR,
- message.repeated_foreign_enum[0])
- test_case.assertEqual(unittest_import_pb2.IMPORT_BAR,
- message.repeated_import_enum[0])
-
- test_case.assertEqual(301, message.repeated_int32[1])
- test_case.assertEqual(302, message.repeated_int64[1])
- test_case.assertEqual(303, message.repeated_uint32[1])
- test_case.assertEqual(304, message.repeated_uint64[1])
- test_case.assertEqual(305, message.repeated_sint32[1])
- test_case.assertEqual(306, message.repeated_sint64[1])
- test_case.assertEqual(307, message.repeated_fixed32[1])
- test_case.assertEqual(308, message.repeated_fixed64[1])
- test_case.assertEqual(309, message.repeated_sfixed32[1])
- test_case.assertEqual(310, message.repeated_sfixed64[1])
- test_case.assertEqual(311, message.repeated_float[1])
- test_case.assertEqual(312, message.repeated_double[1])
- test_case.assertEqual(False, message.repeated_bool[1])
- test_case.assertEqual('315', message.repeated_string[1])
- test_case.assertEqual('316', message.repeated_bytes[1])
-
- test_case.assertEqual(317, message.repeatedgroup[1].a)
- test_case.assertEqual(318, message.repeated_nested_message[1].bb)
- test_case.assertEqual(319, message.repeated_foreign_message[1].c)
- test_case.assertEqual(320, message.repeated_import_message[1].d)
- test_case.assertEqual(327, message.repeated_lazy_message[1].bb)
-
- test_case.assertEqual(unittest_pb2.TestAllTypes.BAZ,
- message.repeated_nested_enum[1])
- test_case.assertEqual(unittest_pb2.FOREIGN_BAZ,
- message.repeated_foreign_enum[1])
- test_case.assertEqual(unittest_import_pb2.IMPORT_BAZ,
- message.repeated_import_enum[1])
-
- # -----------------------------------------------------------------
-
- test_case.assertTrue(message.HasField('default_int32'))
- test_case.assertTrue(message.HasField('default_int64'))
- test_case.assertTrue(message.HasField('default_uint32'))
- test_case.assertTrue(message.HasField('default_uint64'))
- test_case.assertTrue(message.HasField('default_sint32'))
- test_case.assertTrue(message.HasField('default_sint64'))
- test_case.assertTrue(message.HasField('default_fixed32'))
- test_case.assertTrue(message.HasField('default_fixed64'))
- test_case.assertTrue(message.HasField('default_sfixed32'))
- test_case.assertTrue(message.HasField('default_sfixed64'))
- test_case.assertTrue(message.HasField('default_float'))
- test_case.assertTrue(message.HasField('default_double'))
- test_case.assertTrue(message.HasField('default_bool'))
- test_case.assertTrue(message.HasField('default_string'))
- test_case.assertTrue(message.HasField('default_bytes'))
-
- test_case.assertTrue(message.HasField('default_nested_enum'))
- test_case.assertTrue(message.HasField('default_foreign_enum'))
- test_case.assertTrue(message.HasField('default_import_enum'))
-
- test_case.assertEqual(401, message.default_int32)
- test_case.assertEqual(402, message.default_int64)
- test_case.assertEqual(403, message.default_uint32)
- test_case.assertEqual(404, message.default_uint64)
- test_case.assertEqual(405, message.default_sint32)
- test_case.assertEqual(406, message.default_sint64)
- test_case.assertEqual(407, message.default_fixed32)
- test_case.assertEqual(408, message.default_fixed64)
- test_case.assertEqual(409, message.default_sfixed32)
- test_case.assertEqual(410, message.default_sfixed64)
- test_case.assertEqual(411, message.default_float)
- test_case.assertEqual(412, message.default_double)
- test_case.assertEqual(False, message.default_bool)
- test_case.assertEqual('415', message.default_string)
- test_case.assertEqual('416', message.default_bytes)
-
- test_case.assertEqual(unittest_pb2.TestAllTypes.FOO,
- message.default_nested_enum)
- test_case.assertEqual(unittest_pb2.FOREIGN_FOO,
- message.default_foreign_enum)
- test_case.assertEqual(unittest_import_pb2.IMPORT_FOO,
- message.default_import_enum)
-
-def GoldenFile(filename):
- """Finds the given golden file and returns a file object representing it."""
-
- # Search up the directory tree looking for the C++ protobuf source code.
- path = '.'
- while os.path.exists(path):
- if os.path.exists(os.path.join(path, 'tests/google/protobuf/internal')):
- # Found it. Load the golden file from the testdata directory.
- full_path = os.path.join(path, 'tests/google/protobuf/internal', filename)
- return open(full_path, 'rb')
- path = os.path.join(path, '..')
-
- raise RuntimeError(
- 'Could not find golden files. This test must be run from within the '
- 'protobuf source package so that it can read test data files from the '
- 'C++ source tree.')
-
-
-def SetAllPackedFields(message):
- """Sets every field in the message to a unique value.
-
- Args:
- message: A unittest_pb2.TestPackedTypes instance.
- """
- message.packed_int32.extend([601, 701])
- message.packed_int64.extend([602, 702])
- message.packed_uint32.extend([603, 703])
- message.packed_uint64.extend([604, 704])
- message.packed_sint32.extend([605, 705])
- message.packed_sint64.extend([606, 706])
- message.packed_fixed32.extend([607, 707])
- message.packed_fixed64.extend([608, 708])
- message.packed_sfixed32.extend([609, 709])
- message.packed_sfixed64.extend([610, 710])
- message.packed_float.extend([611.0, 711.0])
- message.packed_double.extend([612.0, 712.0])
- message.packed_bool.extend([True, False])
- message.packed_enum.extend([unittest_pb2.FOREIGN_BAR,
- unittest_pb2.FOREIGN_BAZ])
-
-
-def SetAllPackedExtensions(message):
- """Sets every extension in the message to a unique value.
-
- Args:
- message: A unittest_pb2.TestPackedExtensions instance.
- """
- extensions = message.Extensions
- pb2 = unittest_pb2
-
- extensions[pb2.packed_int32_extension].extend([601, 701])
- extensions[pb2.packed_int64_extension].extend([602, 702])
- extensions[pb2.packed_uint32_extension].extend([603, 703])
- extensions[pb2.packed_uint64_extension].extend([604, 704])
- extensions[pb2.packed_sint32_extension].extend([605, 705])
- extensions[pb2.packed_sint64_extension].extend([606, 706])
- extensions[pb2.packed_fixed32_extension].extend([607, 707])
- extensions[pb2.packed_fixed64_extension].extend([608, 708])
- extensions[pb2.packed_sfixed32_extension].extend([609, 709])
- extensions[pb2.packed_sfixed64_extension].extend([610, 710])
- extensions[pb2.packed_float_extension].extend([611.0, 711.0])
- extensions[pb2.packed_double_extension].extend([612.0, 712.0])
- extensions[pb2.packed_bool_extension].extend([True, False])
- extensions[pb2.packed_enum_extension].extend([unittest_pb2.FOREIGN_BAR,
- unittest_pb2.FOREIGN_BAZ])
-
-
-def SetAllUnpackedFields(message):
- """Sets every field in the message to a unique value.
-
- Args:
- message: A unittest_pb2.TestUnpackedTypes instance.
- """
- message.unpacked_int32.extend([601, 701])
- message.unpacked_int64.extend([602, 702])
- message.unpacked_uint32.extend([603, 703])
- message.unpacked_uint64.extend([604, 704])
- message.unpacked_sint32.extend([605, 705])
- message.unpacked_sint64.extend([606, 706])
- message.unpacked_fixed32.extend([607, 707])
- message.unpacked_fixed64.extend([608, 708])
- message.unpacked_sfixed32.extend([609, 709])
- message.unpacked_sfixed64.extend([610, 710])
- message.unpacked_float.extend([611.0, 711.0])
- message.unpacked_double.extend([612.0, 712.0])
- message.unpacked_bool.extend([True, False])
- message.unpacked_enum.extend([unittest_pb2.FOREIGN_BAR,
- unittest_pb2.FOREIGN_BAZ])
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py
deleted file mode 100755
index 0bee668..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_test.py
+++ /dev/null
@@ -1,622 +0,0 @@
-#! /usr/bin/python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Test for google.protobuf.text_format."""
-
-__author__ = 'kenton@google.com (Kenton Varda)'
-
-import difflib
-import re
-
-import unittest
-from google.protobuf import text_format
-from google.protobuf.internal import test_util
-from google.protobuf import unittest_pb2
-from google.protobuf import unittest_mset_pb2
-
-
-class TextFormatTest(unittest.TestCase):
- def ReadGolden(self, golden_filename):
- f = test_util.GoldenFile(golden_filename)
- golden_lines = f.readlines()
- f.close()
- return golden_lines
-
- def CompareToGoldenFile(self, text, golden_filename):
- golden_lines = self.ReadGolden(golden_filename)
- self.CompareToGoldenLines(text, golden_lines)
-
- def CompareToGoldenText(self, text, golden_text):
- self.CompareToGoldenLines(text, golden_text.splitlines(1))
-
- def CompareToGoldenLines(self, text, golden_lines):
- actual_lines = text.splitlines(1)
- self.assertEqual(golden_lines, actual_lines,
- "Text doesn't match golden. Diff:\n" +
- ''.join(difflib.ndiff(golden_lines, actual_lines)))
-
- def testPrintAllFields(self):
- message = unittest_pb2.TestAllTypes()
- test_util.SetAllFields(message)
- self.CompareToGoldenFile(
- self.RemoveRedundantZeros(text_format.MessageToString(message)),
- 'text_format_unittest_data.txt')
-
- def testPrintAllExtensions(self):
- message = unittest_pb2.TestAllExtensions()
- test_util.SetAllExtensions(message)
- self.CompareToGoldenFile(
- self.RemoveRedundantZeros(text_format.MessageToString(message)),
- 'text_format_unittest_extensions_data.txt')
-
- def testPrintMessageSet(self):
- message = unittest_mset_pb2.TestMessageSetContainer()
- ext1 = unittest_mset_pb2.TestMessageSetExtension1.message_set_extension
- ext2 = unittest_mset_pb2.TestMessageSetExtension2.message_set_extension
- message.message_set.Extensions[ext1].i = 23
- message.message_set.Extensions[ext2].str = 'foo'
- self.CompareToGoldenText(text_format.MessageToString(message),
- 'message_set {\n'
- ' [protobuf_unittest.TestMessageSetExtension1] {\n'
- ' i: 23\n'
- ' }\n'
- ' [protobuf_unittest.TestMessageSetExtension2] {\n'
- ' str: \"foo\"\n'
- ' }\n'
- '}\n')
-
- """
- def testPrintBadEnumValue(self):
- message = unittest_pb2.TestAllTypes()
- message.optional_nested_enum = 100
- message.optional_foreign_enum = 101
- message.optional_import_enum = 102
- self.CompareToGoldenText(
- text_format.MessageToString(message),
- 'optional_nested_enum: 100\n'
- 'optional_foreign_enum: 101\n'
- 'optional_import_enum: 102\n')
-
- def testPrintBadEnumValueExtensions(self):
- message = unittest_pb2.TestAllExtensions()
- message.Extensions[unittest_pb2.optional_nested_enum_extension] = 100
- message.Extensions[unittest_pb2.optional_foreign_enum_extension] = 101
- message.Extensions[unittest_pb2.optional_import_enum_extension] = 102
- self.CompareToGoldenText(
- text_format.MessageToString(message),
- '[protobuf_unittest.optional_nested_enum_extension]: 100\n'
- '[protobuf_unittest.optional_foreign_enum_extension]: 101\n'
- '[protobuf_unittest.optional_import_enum_extension]: 102\n')
- """
-
- def testPrintExotic(self):
- message = unittest_pb2.TestAllTypes()
- message.repeated_int64.append(-9223372036854775808)
- message.repeated_uint64.append(18446744073709551615)
- message.repeated_double.append(123.456)
- message.repeated_double.append(1.23e22)
- message.repeated_double.append(1.23e-18)
- message.repeated_string.append('\000\001\a\b\f\n\r\t\v\\\'"')
- message.repeated_string.append(u'\u00fc\ua71f')
- self.CompareToGoldenText(
- self.RemoveRedundantZeros(text_format.MessageToString(message)),
- 'repeated_int64: -9223372036854775808\n'
- 'repeated_uint64: 18446744073709551615\n'
- 'repeated_double: 123.456\n'
- 'repeated_double: 1.23e+22\n'
- 'repeated_double: 1.23e-18\n'
- 'repeated_string: '
- '"\\000\\001\\007\\010\\014\\n\\r\\t\\013\\\\\\\'\\""\n'
- 'repeated_string: "\\303\\274\\352\\234\\237"\n')
-
- def testPrintNestedMessageAsOneLine(self):
- message = unittest_pb2.TestAllTypes()
- msg = message.repeated_nested_message.add()
- msg.bb = 42;
- self.CompareToGoldenText(
- text_format.MessageToString(message, as_one_line=True),
- 'repeated_nested_message { bb: 42 }')
-
- def testPrintRepeatedFieldsAsOneLine(self):
- message = unittest_pb2.TestAllTypes()
- message.repeated_int32.append(1)
- message.repeated_int32.append(1)
- message.repeated_int32.append(3)
- message.repeated_string.append("Google")
- message.repeated_string.append("Zurich")
- self.CompareToGoldenText(
- text_format.MessageToString(message, as_one_line=True),
- 'repeated_int32: 1 repeated_int32: 1 repeated_int32: 3 '
- 'repeated_string: "Google" repeated_string: "Zurich"')
-
- def testPrintNestedNewLineInStringAsOneLine(self):
- message = unittest_pb2.TestAllTypes()
- message.optional_string = "a\nnew\nline"
- self.CompareToGoldenText(
- text_format.MessageToString(message, as_one_line=True),
- 'optional_string: "a\\nnew\\nline"')
-
- def testPrintMessageSetAsOneLine(self):
- message = unittest_mset_pb2.TestMessageSetContainer()
- ext1 = unittest_mset_pb2.TestMessageSetExtension1.message_set_extension
- ext2 = unittest_mset_pb2.TestMessageSetExtension2.message_set_extension
- message.message_set.Extensions[ext1].i = 23
- message.message_set.Extensions[ext2].str = 'foo'
- self.CompareToGoldenText(
- text_format.MessageToString(message, as_one_line=True),
- 'message_set {'
- ' [protobuf_unittest.TestMessageSetExtension1] {'
- ' i: 23'
- ' }'
- ' [protobuf_unittest.TestMessageSetExtension2] {'
- ' str: \"foo\"'
- ' }'
- ' }')
-
- def testPrintExoticAsOneLine(self):
- message = unittest_pb2.TestAllTypes()
- message.repeated_int64.append(-9223372036854775808)
- message.repeated_uint64.append(18446744073709551615)
- message.repeated_double.append(123.456)
- message.repeated_double.append(1.23e22)
- message.repeated_double.append(1.23e-18)
- message.repeated_string.append('\000\001\a\b\f\n\r\t\v\\\'"')
- message.repeated_string.append(u'\u00fc\ua71f')
- self.CompareToGoldenText(
- self.RemoveRedundantZeros(
- text_format.MessageToString(message, as_one_line=True)),
- 'repeated_int64: -9223372036854775808'
- ' repeated_uint64: 18446744073709551615'
- ' repeated_double: 123.456'
- ' repeated_double: 1.23e+22'
- ' repeated_double: 1.23e-18'
- ' repeated_string: '
- '"\\000\\001\\007\\010\\014\\n\\r\\t\\013\\\\\\\'\\""'
- ' repeated_string: "\\303\\274\\352\\234\\237"')
-
- def testRoundTripExoticAsOneLine(self):
- message = unittest_pb2.TestAllTypes()
- message.repeated_int64.append(-9223372036854775808)
- message.repeated_uint64.append(18446744073709551615)
- message.repeated_double.append(123.456)
- message.repeated_double.append(1.23e22)
- message.repeated_double.append(1.23e-18)
- message.repeated_string.append('\000\001\a\b\f\n\r\t\v\\\'"')
- message.repeated_string.append(u'\u00fc\ua71f')
-
- # Test as_utf8 = False.
- wire_text = text_format.MessageToString(
- message, as_one_line=True, as_utf8=False)
- parsed_message = unittest_pb2.TestAllTypes()
- text_format.Merge(wire_text, parsed_message)
- self.assertEquals(message, parsed_message)
-
- # Test as_utf8 = True.
- wire_text = text_format.MessageToString(
- message, as_one_line=True, as_utf8=True)
- parsed_message = unittest_pb2.TestAllTypes()
- text_format.Merge(wire_text, parsed_message)
- self.assertEquals(message, parsed_message)
-
- def testPrintRawUtf8String(self):
- message = unittest_pb2.TestAllTypes()
- message.repeated_string.append(u'\u00fc\ua71f')
- text = text_format.MessageToString(message, as_utf8 = True)
- self.CompareToGoldenText(text, 'repeated_string: "\303\274\352\234\237"\n')
- parsed_message = unittest_pb2.TestAllTypes()
- text_format.Merge(text, parsed_message)
- self.assertEquals(message, parsed_message)
-
- def testMessageToString(self):
- message = unittest_pb2.ForeignMessage()
- message.c = 123
- self.assertEqual('c: 123\n', str(message))
-
- def RemoveRedundantZeros(self, text):
- # Some platforms print 1e+5 as 1e+005. This is fine, but we need to remove
- # these zeros in order to match the golden file.
- text = text.replace('e+0','e+').replace('e+0','e+') \
- .replace('e-0','e-').replace('e-0','e-')
- # Floating point fields are printed with .0 suffix even if they are
- # actually integer numbers.
- text = re.compile(r'\.0$', re.MULTILINE).sub('', text)
- return text
-
- def testMergeGolden(self):
- golden_text = '\n'.join(self.ReadGolden('text_format_unittest_data.txt'))
- parsed_message = unittest_pb2.TestAllTypes()
- text_format.Merge(golden_text, parsed_message)
-
- message = unittest_pb2.TestAllTypes()
- test_util.SetAllFields(message)
- self.assertEquals(message, parsed_message)
-
- def testMergeGoldenExtensions(self):
- golden_text = '\n'.join(self.ReadGolden(
- 'text_format_unittest_extensions_data.txt'))
- parsed_message = unittest_pb2.TestAllExtensions()
- text_format.Merge(golden_text, parsed_message)
-
- message = unittest_pb2.TestAllExtensions()
- test_util.SetAllExtensions(message)
- self.assertEquals(message, parsed_message)
-
- def testMergeAllFields(self):
- message = unittest_pb2.TestAllTypes()
- test_util.SetAllFields(message)
- ascii_text = text_format.MessageToString(message)
-
- parsed_message = unittest_pb2.TestAllTypes()
- text_format.Merge(ascii_text, parsed_message)
- self.assertEqual(message, parsed_message)
- test_util.ExpectAllFieldsSet(self, message)
-
- def testMergeAllExtensions(self):
- message = unittest_pb2.TestAllExtensions()
- test_util.SetAllExtensions(message)
- ascii_text = text_format.MessageToString(message)
-
- parsed_message = unittest_pb2.TestAllExtensions()
- text_format.Merge(ascii_text, parsed_message)
- self.assertEqual(message, parsed_message)
-
- def testMergeMessageSet(self):
- message = unittest_pb2.TestAllTypes()
- text = ('repeated_uint64: 1\n'
- 'repeated_uint64: 2\n')
- text_format.Merge(text, message)
- self.assertEqual(1, message.repeated_uint64[0])
- self.assertEqual(2, message.repeated_uint64[1])
-
- message = unittest_mset_pb2.TestMessageSetContainer()
- text = ('message_set {\n'
- ' [protobuf_unittest.TestMessageSetExtension1] {\n'
- ' i: 23\n'
- ' }\n'
- ' [protobuf_unittest.TestMessageSetExtension2] {\n'
- ' str: \"foo\"\n'
- ' }\n'
- '}\n')
- text_format.Merge(text, message)
- ext1 = unittest_mset_pb2.TestMessageSetExtension1.message_set_extension
- ext2 = unittest_mset_pb2.TestMessageSetExtension2.message_set_extension
- self.assertEquals(23, message.message_set.Extensions[ext1].i)
- self.assertEquals('foo', message.message_set.Extensions[ext2].str)
-
- def testMergeExotic(self):
- message = unittest_pb2.TestAllTypes()
- text = ('repeated_int64: -9223372036854775808\n'
- 'repeated_uint64: 18446744073709551615\n'
- 'repeated_double: 123.456\n'
- 'repeated_double: 1.23e+22\n'
- 'repeated_double: 1.23e-18\n'
- 'repeated_string: \n'
- '"\\000\\001\\007\\010\\014\\n\\r\\t\\013\\\\\\\'\\""\n'
- 'repeated_string: "foo" \'corge\' "grault"\n'
- 'repeated_string: "\\303\\274\\352\\234\\237"\n'
- 'repeated_string: "\\xc3\\xbc"\n'
- 'repeated_string: "\xc3\xbc"\n')
- text_format.Merge(text, message)
-
- self.assertEqual(-9223372036854775808, message.repeated_int64[0])
- self.assertEqual(18446744073709551615, message.repeated_uint64[0])
- self.assertEqual(123.456, message.repeated_double[0])
- self.assertEqual(1.23e22, message.repeated_double[1])
- self.assertEqual(1.23e-18, message.repeated_double[2])
- self.assertEqual(
- '\000\001\a\b\f\n\r\t\v\\\'"', message.repeated_string[0])
- self.assertEqual('foocorgegrault', message.repeated_string[1])
- self.assertEqual(u'\u00fc\ua71f', message.repeated_string[2])
- self.assertEqual(u'\u00fc', message.repeated_string[3])
-
- def testMergeEmptyText(self):
- message = unittest_pb2.TestAllTypes()
- text = ''
- text_format.Merge(text, message)
- self.assertEquals(unittest_pb2.TestAllTypes(), message)
-
- def testMergeInvalidUtf8(self):
- message = unittest_pb2.TestAllTypes()
- text = 'repeated_string: "\\xc3\\xc3"'
- self.assertRaises(text_format.ParseError, text_format.Merge, text, message)
-
- def testMergeSingleWord(self):
- message = unittest_pb2.TestAllTypes()
- text = 'foo'
- self.assertRaisesWithMessage(
- text_format.ParseError,
- ('1:1 : Message type "protobuf_unittest.TestAllTypes" has no field named '
- '"foo".'),
- text_format.Merge, text, message)
-
- def testMergeUnknownField(self):
- message = unittest_pb2.TestAllTypes()
- text = 'unknown_field: 8\n'
- self.assertRaisesWithMessage(
- text_format.ParseError,
- ('1:1 : Message type "protobuf_unittest.TestAllTypes" has no field named '
- '"unknown_field".'),
- text_format.Merge, text, message)
-
- def testMergeBadExtension(self):
- message = unittest_pb2.TestAllExtensions()
- text = '[unknown_extension]: 8\n'
- self.assertRaises(
- text_format.ParseError,
- text_format.Merge, text, message)
- message = unittest_pb2.TestAllTypes()
- self.assertRaisesWithMessage(
- text_format.ParseError,
- ('1:2 : Message type "protobuf_unittest.TestAllTypes" does not have '
- 'extensions.'),
- text_format.Merge, text, message)
-
- def testMergeGroupNotClosed(self):
- message = unittest_pb2.TestAllTypes()
- text = 'RepeatedGroup: <'
- self.assertRaisesWithMessage(
- text_format.ParseError, '1:16 : Expected ">".',
- text_format.Merge, text, message)
-
- text = 'RepeatedGroup: {'
- self.assertRaisesWithMessage(
- text_format.ParseError, '1:16 : Expected "}".',
- text_format.Merge, text, message)
-
- def testMergeEmptyGroup(self):
- message = unittest_pb2.TestAllTypes()
- text = 'OptionalGroup: {}'
- text_format.Merge(text, message)
- self.assertTrue(message.HasField('optionalgroup'))
-
- message.Clear()
-
- message = unittest_pb2.TestAllTypes()
- text = 'OptionalGroup: <>'
- text_format.Merge(text, message)
- self.assertTrue(message.HasField('optionalgroup'))
-
- def testMergeBadEnumValue(self):
- message = unittest_pb2.TestAllTypes()
- text = 'optional_nested_enum: BARR'
- self.assertRaisesWithMessage(
- text_format.ParseError,
- ('1:23 : \'optional_nested_enum: BARR\': '
- 'Enum type "protobuf_unittest.TestAllTypes.NestedEnum" '
- 'has no value named BARR.'),
- text_format.Merge, text, message)
-
- message = unittest_pb2.TestAllTypes()
- text = 'optional_nested_enum: 100'
- self.assertRaisesWithMessage(
- text_format.ParseError,
- ('1:23 : \'optional_nested_enum: 100\': '
- 'Enum type "protobuf_unittest.TestAllTypes.NestedEnum" '
- 'has no value with number 100.'),
- text_format.Merge, text, message)
-
- def testMergeBadIntValue(self):
- message = unittest_pb2.TestAllTypes()
- text = 'optional_int32: bork'
- self.assertRaisesWithMessage(
- text_format.ParseError,
- ('1:17 : \'optional_int32: bork\': '
- 'Couldn\'t parse integer: bork'),
- text_format.Merge, text, message)
-
- def testMergeStringFieldUnescape(self):
- message = unittest_pb2.TestAllTypes()
- text = r'''repeated_string: "\xf\x62"
- repeated_string: "\\xf\\x62"
- repeated_string: "\\\xf\\\x62"
- repeated_string: "\\\\xf\\\\x62"
- repeated_string: "\\\\\xf\\\\\x62"
- repeated_string: "\x5cx20"'''
- text_format.Merge(text, message)
-
- SLASH = '\\'
- self.assertEqual('\x0fb', message.repeated_string[0])
- self.assertEqual(SLASH + 'xf' + SLASH + 'x62', message.repeated_string[1])
- self.assertEqual(SLASH + '\x0f' + SLASH + 'b', message.repeated_string[2])
- self.assertEqual(SLASH + SLASH + 'xf' + SLASH + SLASH + 'x62',
- message.repeated_string[3])
- self.assertEqual(SLASH + SLASH + '\x0f' + SLASH + SLASH + 'b',
- message.repeated_string[4])
- self.assertEqual(SLASH + 'x20', message.repeated_string[5])
-
- def assertRaisesWithMessage(self, e_class, e, func, *args, **kwargs):
- """Same as assertRaises, but also compares the exception message."""
- if hasattr(e_class, '__name__'):
- exc_name = e_class.__name__
- else:
- exc_name = str(e_class)
-
- try:
- func(*args, **kwargs)
- except e_class as expr:
- if str(expr) != e:
- msg = '%s raised, but with wrong message: "%s" instead of "%s"'
- raise self.failureException(msg % (exc_name,
- str(expr).encode('string_escape'),
- e.encode('string_escape')))
- return
- else:
- raise self.failureException('%s not raised' % exc_name)
-
-
-class TokenizerTest(unittest.TestCase):
- """
- def testSimpleTokenCases(self):
- text = ('identifier1:"string1"\n \n\n'
- 'identifier2 : \n \n123 \n identifier3 :\'string\'\n'
- 'identifiER_4 : 1.1e+2 ID5:-0.23 ID6:\'aaaa\\\'bbbb\'\n'
- 'ID7 : "aa\\"bb"\n\n\n\n ID8: {A:inf B:-inf C:true D:false}\n'
- 'ID9: 22 ID10: -111111111111111111 ID11: -22\n'
- 'ID12: 2222222222222222222 ID13: 1.23456f ID14: 1.2e+2f '
- 'false_bool: 0 true_BOOL:t \n true_bool1: 1 false_BOOL1:f ' )
- tokenizer = text_format._Tokenizer(text)
- methods = [(tokenizer.ConsumeIdentifier, 'identifier1'),
- ':',
- (tokenizer.ConsumeString, 'string1'),
- (tokenizer.ConsumeIdentifier, 'identifier2'),
- ':',
- (tokenizer.ConsumeInt32, 123),
- (tokenizer.ConsumeIdentifier, 'identifier3'),
- ':',
- (tokenizer.ConsumeString, 'string'),
- (tokenizer.ConsumeIdentifier, 'identifiER_4'),
- ':',
- (tokenizer.ConsumeFloat, 1.1e+2),
- (tokenizer.ConsumeIdentifier, 'ID5'),
- ':',
- (tokenizer.ConsumeFloat, -0.23),
- (tokenizer.ConsumeIdentifier, 'ID6'),
- ':',
- (tokenizer.ConsumeString, 'aaaa\'bbbb'),
- (tokenizer.ConsumeIdentifier, 'ID7'),
- ':',
- (tokenizer.ConsumeString, 'aa\"bb'),
- (tokenizer.ConsumeIdentifier, 'ID8'),
- ':',
- '{',
- (tokenizer.ConsumeIdentifier, 'A'),
- ':',
- (tokenizer.ConsumeFloat, float('inf')),
- (tokenizer.ConsumeIdentifier, 'B'),
- ':',
- (tokenizer.ConsumeFloat, -float('inf')),
- (tokenizer.ConsumeIdentifier, 'C'),
- ':',
- (tokenizer.ConsumeBool, True),
- (tokenizer.ConsumeIdentifier, 'D'),
- ':',
- (tokenizer.ConsumeBool, False),
- '}',
- (tokenizer.ConsumeIdentifier, 'ID9'),
- ':',
- (tokenizer.ConsumeUint32, 22),
- (tokenizer.ConsumeIdentifier, 'ID10'),
- ':',
- (tokenizer.ConsumeInt64, -111111111111111111),
- (tokenizer.ConsumeIdentifier, 'ID11'),
- ':',
- (tokenizer.ConsumeInt32, -22),
- (tokenizer.ConsumeIdentifier, 'ID12'),
- ':',
- (tokenizer.ConsumeUint64, 2222222222222222222),
- (tokenizer.ConsumeIdentifier, 'ID13'),
- ':',
- (tokenizer.ConsumeFloat, 1.23456),
- (tokenizer.ConsumeIdentifier, 'ID14'),
- ':',
- (tokenizer.ConsumeFloat, 1.2e+2),
- (tokenizer.ConsumeIdentifier, 'false_bool'),
- ':',
- (tokenizer.ConsumeBool, False),
- (tokenizer.ConsumeIdentifier, 'true_BOOL'),
- ':',
- (tokenizer.ConsumeBool, True),
- (tokenizer.ConsumeIdentifier, 'true_bool1'),
- ':',
- (tokenizer.ConsumeBool, True),
- (tokenizer.ConsumeIdentifier, 'false_BOOL1'),
- ':',
- (tokenizer.ConsumeBool, False)]
-
- i = 0
- while not tokenizer.AtEnd():
- m = methods[i]
- if type(m) == str:
- token = tokenizer.token
- self.assertEqual(token, m)
- tokenizer.NextToken()
- else:
- self.assertEqual(m[1], m[0]())
- i += 1
-
- def testConsumeIntegers(self):
- # This test only tests the failures in the integer parsing methods as well
- # as the '0' special cases.
- int64_max = (1 << 63) - 1
- uint32_max = (1 << 32) - 1
- text = '-1 %d %d' % (uint32_max + 1, int64_max + 1)
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeUint32)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeUint64)
- self.assertEqual(-1, tokenizer.ConsumeInt32())
-
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeUint32)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeInt32)
- self.assertEqual(uint32_max + 1, tokenizer.ConsumeInt64())
-
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeInt64)
- self.assertEqual(int64_max + 1, tokenizer.ConsumeUint64())
- self.assertTrue(tokenizer.AtEnd())
-
- text = '-0 -0 0 0'
- tokenizer = text_format._Tokenizer(text)
- self.assertEqual(0, tokenizer.ConsumeUint32())
- self.assertEqual(0, tokenizer.ConsumeUint64())
- self.assertEqual(0, tokenizer.ConsumeUint32())
- self.assertEqual(0, tokenizer.ConsumeUint64())
- self.assertTrue(tokenizer.AtEnd())
- """
-
- def testConsumeByteString(self):
- text = '"string1\''
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeByteString)
-
- text = 'string1"'
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeByteString)
-
- text = '\n"\\xt"'
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeByteString)
-
- text = '\n"\\"'
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeByteString)
-
- text = '\n"\\x"'
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeByteString)
-
- def testConsumeBool(self):
- text = 'not-a-bool'
- tokenizer = text_format._Tokenizer(text)
- self.assertRaises(text_format.ParseError, tokenizer.ConsumeBool)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt
deleted file mode 100644
index bbe5882..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_data.txt
+++ /dev/null
@@ -1,128 +0,0 @@
-optional_int32: 101
-optional_int64: 102
-optional_uint32: 103
-optional_uint64: 104
-optional_sint32: 105
-optional_sint64: 106
-optional_fixed32: 107
-optional_fixed64: 108
-optional_sfixed32: 109
-optional_sfixed64: 110
-optional_float: 111
-optional_double: 112
-optional_bool: true
-optional_string: "115"
-optional_bytes: "116"
-OptionalGroup {
- a: 117
-}
-optional_nested_message {
- bb: 118
-}
-optional_foreign_message {
- c: 119
-}
-optional_import_message {
- d: 120
-}
-optional_nested_enum: BAZ
-optional_foreign_enum: FOREIGN_BAZ
-optional_import_enum: IMPORT_BAZ
-optional_string_piece: "124"
-optional_cord: "125"
-optional_public_import_message {
- e: 126
-}
-optional_lazy_message {
- bb: 127
-}
-repeated_int32: 201
-repeated_int32: 301
-repeated_int64: 202
-repeated_int64: 302
-repeated_uint32: 203
-repeated_uint32: 303
-repeated_uint64: 204
-repeated_uint64: 304
-repeated_sint32: 205
-repeated_sint32: 305
-repeated_sint64: 206
-repeated_sint64: 306
-repeated_fixed32: 207
-repeated_fixed32: 307
-repeated_fixed64: 208
-repeated_fixed64: 308
-repeated_sfixed32: 209
-repeated_sfixed32: 309
-repeated_sfixed64: 210
-repeated_sfixed64: 310
-repeated_float: 211
-repeated_float: 311
-repeated_double: 212
-repeated_double: 312
-repeated_bool: true
-repeated_bool: false
-repeated_string: "215"
-repeated_string: "315"
-repeated_bytes: "216"
-repeated_bytes: "316"
-RepeatedGroup {
- a: 217
-}
-RepeatedGroup {
- a: 317
-}
-repeated_nested_message {
- bb: 218
-}
-repeated_nested_message {
- bb: 318
-}
-repeated_foreign_message {
- c: 219
-}
-repeated_foreign_message {
- c: 319
-}
-repeated_import_message {
- d: 220
-}
-repeated_import_message {
- d: 320
-}
-repeated_nested_enum: BAR
-repeated_nested_enum: BAZ
-repeated_foreign_enum: FOREIGN_BAR
-repeated_foreign_enum: FOREIGN_BAZ
-repeated_import_enum: IMPORT_BAR
-repeated_import_enum: IMPORT_BAZ
-repeated_string_piece: "224"
-repeated_string_piece: "324"
-repeated_cord: "225"
-repeated_cord: "325"
-repeated_lazy_message {
- bb: 227
-}
-repeated_lazy_message {
- bb: 327
-}
-default_int32: 401
-default_int64: 402
-default_uint32: 403
-default_uint64: 404
-default_sint32: 405
-default_sint64: 406
-default_fixed32: 407
-default_fixed64: 408
-default_sfixed32: 409
-default_sfixed64: 410
-default_float: 411
-default_double: 412
-default_bool: false
-default_string: "415"
-default_bytes: "416"
-default_nested_enum: FOO
-default_foreign_enum: FOREIGN_FOO
-default_import_enum: IMPORT_FOO
-default_string_piece: "424"
-default_cord: "425"
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt
deleted file mode 100644
index 0a217f0..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/text_format_unittest_extensions_data.txt
+++ /dev/null
@@ -1,128 +0,0 @@
-[protobuf_unittest.optional_int32_extension]: 101
-[protobuf_unittest.optional_int64_extension]: 102
-[protobuf_unittest.optional_uint32_extension]: 103
-[protobuf_unittest.optional_uint64_extension]: 104
-[protobuf_unittest.optional_sint32_extension]: 105
-[protobuf_unittest.optional_sint64_extension]: 106
-[protobuf_unittest.optional_fixed32_extension]: 107
-[protobuf_unittest.optional_fixed64_extension]: 108
-[protobuf_unittest.optional_sfixed32_extension]: 109
-[protobuf_unittest.optional_sfixed64_extension]: 110
-[protobuf_unittest.optional_float_extension]: 111
-[protobuf_unittest.optional_double_extension]: 112
-[protobuf_unittest.optional_bool_extension]: true
-[protobuf_unittest.optional_string_extension]: "115"
-[protobuf_unittest.optional_bytes_extension]: "116"
-[protobuf_unittest.optionalgroup_extension] {
- a: 117
-}
-[protobuf_unittest.optional_nested_message_extension] {
- bb: 118
-}
-[protobuf_unittest.optional_foreign_message_extension] {
- c: 119
-}
-[protobuf_unittest.optional_import_message_extension] {
- d: 120
-}
-[protobuf_unittest.optional_nested_enum_extension]: BAZ
-[protobuf_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ
-[protobuf_unittest.optional_import_enum_extension]: IMPORT_BAZ
-[protobuf_unittest.optional_string_piece_extension]: "124"
-[protobuf_unittest.optional_cord_extension]: "125"
-[protobuf_unittest.optional_public_import_message_extension] {
- e: 126
-}
-[protobuf_unittest.optional_lazy_message_extension] {
- bb: 127
-}
-[protobuf_unittest.repeated_int32_extension]: 201
-[protobuf_unittest.repeated_int32_extension]: 301
-[protobuf_unittest.repeated_int64_extension]: 202
-[protobuf_unittest.repeated_int64_extension]: 302
-[protobuf_unittest.repeated_uint32_extension]: 203
-[protobuf_unittest.repeated_uint32_extension]: 303
-[protobuf_unittest.repeated_uint64_extension]: 204
-[protobuf_unittest.repeated_uint64_extension]: 304
-[protobuf_unittest.repeated_sint32_extension]: 205
-[protobuf_unittest.repeated_sint32_extension]: 305
-[protobuf_unittest.repeated_sint64_extension]: 206
-[protobuf_unittest.repeated_sint64_extension]: 306
-[protobuf_unittest.repeated_fixed32_extension]: 207
-[protobuf_unittest.repeated_fixed32_extension]: 307
-[protobuf_unittest.repeated_fixed64_extension]: 208
-[protobuf_unittest.repeated_fixed64_extension]: 308
-[protobuf_unittest.repeated_sfixed32_extension]: 209
-[protobuf_unittest.repeated_sfixed32_extension]: 309
-[protobuf_unittest.repeated_sfixed64_extension]: 210
-[protobuf_unittest.repeated_sfixed64_extension]: 310
-[protobuf_unittest.repeated_float_extension]: 211
-[protobuf_unittest.repeated_float_extension]: 311
-[protobuf_unittest.repeated_double_extension]: 212
-[protobuf_unittest.repeated_double_extension]: 312
-[protobuf_unittest.repeated_bool_extension]: true
-[protobuf_unittest.repeated_bool_extension]: false
-[protobuf_unittest.repeated_string_extension]: "215"
-[protobuf_unittest.repeated_string_extension]: "315"
-[protobuf_unittest.repeated_bytes_extension]: "216"
-[protobuf_unittest.repeated_bytes_extension]: "316"
-[protobuf_unittest.repeatedgroup_extension] {
- a: 217
-}
-[protobuf_unittest.repeatedgroup_extension] {
- a: 317
-}
-[protobuf_unittest.repeated_nested_message_extension] {
- bb: 218
-}
-[protobuf_unittest.repeated_nested_message_extension] {
- bb: 318
-}
-[protobuf_unittest.repeated_foreign_message_extension] {
- c: 219
-}
-[protobuf_unittest.repeated_foreign_message_extension] {
- c: 319
-}
-[protobuf_unittest.repeated_import_message_extension] {
- d: 220
-}
-[protobuf_unittest.repeated_import_message_extension] {
- d: 320
-}
-[protobuf_unittest.repeated_nested_enum_extension]: BAR
-[protobuf_unittest.repeated_nested_enum_extension]: BAZ
-[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR
-[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ
-[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAR
-[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAZ
-[protobuf_unittest.repeated_string_piece_extension]: "224"
-[protobuf_unittest.repeated_string_piece_extension]: "324"
-[protobuf_unittest.repeated_cord_extension]: "225"
-[protobuf_unittest.repeated_cord_extension]: "325"
-[protobuf_unittest.repeated_lazy_message_extension] {
- bb: 227
-}
-[protobuf_unittest.repeated_lazy_message_extension] {
- bb: 327
-}
-[protobuf_unittest.default_int32_extension]: 401
-[protobuf_unittest.default_int64_extension]: 402
-[protobuf_unittest.default_uint32_extension]: 403
-[protobuf_unittest.default_uint64_extension]: 404
-[protobuf_unittest.default_sint32_extension]: 405
-[protobuf_unittest.default_sint64_extension]: 406
-[protobuf_unittest.default_fixed32_extension]: 407
-[protobuf_unittest.default_fixed64_extension]: 408
-[protobuf_unittest.default_sfixed32_extension]: 409
-[protobuf_unittest.default_sfixed64_extension]: 410
-[protobuf_unittest.default_float_extension]: 411
-[protobuf_unittest.default_double_extension]: 412
-[protobuf_unittest.default_bool_extension]: false
-[protobuf_unittest.default_string_extension]: "415"
-[protobuf_unittest.default_bytes_extension]: "416"
-[protobuf_unittest.default_nested_enum_extension]: FOO
-[protobuf_unittest.default_foreign_enum_extension]: FOREIGN_FOO
-[protobuf_unittest.default_import_enum_extension]: IMPORT_FOO
-[protobuf_unittest.default_string_piece_extension]: "424"
-[protobuf_unittest.default_cord_extension]: "425"
diff --git a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py b/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py
deleted file mode 100755
index 7600778..0000000
--- a/python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/wire_format_test.py
+++ /dev/null
@@ -1,253 +0,0 @@
-#! /usr/bin/python
-#
-# Protocol Buffers - Google's data interchange format
-# Copyright 2008 Google Inc. All rights reserved.
-# http://code.google.com/p/protobuf/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-"""Test for google.protobuf.internal.wire_format."""
-
-__author__ = 'robinson@google.com (Will Robinson)'
-
-import unittest
-from google.protobuf import message
-from google.protobuf.internal import wire_format
-
-
-class WireFormatTest(unittest.TestCase):
-
- def testPackTag(self):
- field_number = 0xabc
- tag_type = 2
- self.assertEqual((field_number << 3) | tag_type,
- wire_format.PackTag(field_number, tag_type))
- PackTag = wire_format.PackTag
- # Number too high.
- self.assertRaises(message.EncodeError, PackTag, field_number, 6)
- # Number too low.
- self.assertRaises(message.EncodeError, PackTag, field_number, -1)
-
- def testUnpackTag(self):
- # Test field numbers that will require various varint sizes.
- for expected_field_number in (1, 15, 16, 2047, 2048):
- for expected_wire_type in range(6): # Highest-numbered wiretype is 5.
- field_number, wire_type = wire_format.UnpackTag(
- wire_format.PackTag(expected_field_number, expected_wire_type))
- self.assertEqual(expected_field_number, field_number)
- self.assertEqual(expected_wire_type, wire_type)
-
- self.assertRaises(TypeError, wire_format.UnpackTag, None)
- self.assertRaises(TypeError, wire_format.UnpackTag, 'abc')
- self.assertRaises(TypeError, wire_format.UnpackTag, 0.0)
- self.assertRaises(TypeError, wire_format.UnpackTag, object())
-
- def testZigZagEncode(self):
- Z = wire_format.ZigZagEncode
- self.assertEqual(0, Z(0))
- self.assertEqual(1, Z(-1))
- self.assertEqual(2, Z(1))
- self.assertEqual(3, Z(-2))
- self.assertEqual(4, Z(2))
- self.assertEqual(0xfffffffe, Z(0x7fffffff))
- self.assertEqual(0xffffffff, Z(-0x80000000))
- self.assertEqual(0xfffffffffffffffe, Z(0x7fffffffffffffff))
- self.assertEqual(0xffffffffffffffff, Z(-0x8000000000000000))
-
- self.assertRaises(TypeError, Z, None)
- self.assertRaises(TypeError, Z, 'abcd')
- self.assertRaises(TypeError, Z, 0.0)
- self.assertRaises(TypeError, Z, object())
-
- def testZigZagDecode(self):
- Z = wire_format.ZigZagDecode
- self.assertEqual(0, Z(0))
- self.assertEqual(-1, Z(1))
- self.assertEqual(1, Z(2))
- self.assertEqual(-2, Z(3))
- self.assertEqual(2, Z(4))
- self.assertEqual(0x7fffffff, Z(0xfffffffe))
- self.assertEqual(-0x80000000, Z(0xffffffff))
- self.assertEqual(0x7fffffffffffffff, Z(0xfffffffffffffffe))
- self.assertEqual(-0x8000000000000000, Z(0xffffffffffffffff))
-
- self.assertRaises(TypeError, Z, None)
- self.assertRaises(TypeError, Z, 'abcd')
- self.assertRaises(TypeError, Z, 0.0)
- self.assertRaises(TypeError, Z, object())
-
- def NumericByteSizeTestHelper(self, byte_size_fn, value, expected_value_size):
- # Use field numbers that cause various byte sizes for the tag information.
- for field_number, tag_bytes in ((15, 1), (16, 2), (2047, 2), (2048, 3)):
- expected_size = expected_value_size + tag_bytes
- actual_size = byte_size_fn(field_number, value)
- self.assertEqual(expected_size, actual_size,
- 'byte_size_fn: %s, field_number: %d, value: %r\n'
- 'Expected: %d, Actual: %d'% (
- byte_size_fn, field_number, value, expected_size, actual_size))
-
- def testByteSizeFunctions(self):
- # Test all numeric *ByteSize() functions.
- NUMERIC_ARGS = [
- # Int32ByteSize().
- [wire_format.Int32ByteSize, 0, 1],
- [wire_format.Int32ByteSize, 127, 1],
- [wire_format.Int32ByteSize, 128, 2],
- [wire_format.Int32ByteSize, -1, 10],
- # Int64ByteSize().
- [wire_format.Int64ByteSize, 0, 1],
- [wire_format.Int64ByteSize, 127, 1],
- [wire_format.Int64ByteSize, 128, 2],
- [wire_format.Int64ByteSize, -1, 10],
- # UInt32ByteSize().
- [wire_format.UInt32ByteSize, 0, 1],
- [wire_format.UInt32ByteSize, 127, 1],
- [wire_format.UInt32ByteSize, 128, 2],
- [wire_format.UInt32ByteSize, wire_format.UINT32_MAX, 5],
- # UInt64ByteSize().
- [wire_format.UInt64ByteSize, 0, 1],
- [wire_format.UInt64ByteSize, 127, 1],
- [wire_format.UInt64ByteSize, 128, 2],
- [wire_format.UInt64ByteSize, wire_format.UINT64_MAX, 10],
- # SInt32ByteSize().
- [wire_format.SInt32ByteSize, 0, 1],
- [wire_format.SInt32ByteSize, -1, 1],
- [wire_format.SInt32ByteSize, 1, 1],
- [wire_format.SInt32ByteSize, -63, 1],
- [wire_format.SInt32ByteSize, 63, 1],
- [wire_format.SInt32ByteSize, -64, 1],
- [wire_format.SInt32ByteSize, 64, 2],
- # SInt64ByteSize().
- [wire_format.SInt64ByteSize, 0, 1],
- [wire_format.SInt64ByteSize, -1, 1],
- [wire_format.SInt64ByteSize, 1, 1],
- [wire_format.SInt64ByteSize, -63, 1],
- [wire_format.SInt64ByteSize, 63, 1],
- [wire_format.SInt64ByteSize, -64, 1],
- [wire_format.SInt64ByteSize, 64, 2],
- # Fixed32ByteSize().
- [wire_format.Fixed32ByteSize, 0, 4],
- [wire_format.Fixed32ByteSize, wire_format.UINT32_MAX, 4],
- # Fixed64ByteSize().
- [wire_format.Fixed64ByteSize, 0, 8],
- [wire_format.Fixed64ByteSize, wire_format.UINT64_MAX, 8],
- # SFixed32ByteSize().
- [wire_format.SFixed32ByteSize, 0, 4],
- [wire_format.SFixed32ByteSize, wire_format.INT32_MIN, 4],
- [wire_format.SFixed32ByteSize, wire_format.INT32_MAX, 4],
- # SFixed64ByteSize().
- [wire_format.SFixed64ByteSize, 0, 8],
- [wire_format.SFixed64ByteSize, wire_format.INT64_MIN, 8],
- [wire_format.SFixed64ByteSize, wire_format.INT64_MAX, 8],
- # FloatByteSize().
- [wire_format.FloatByteSize, 0.0, 4],
- [wire_format.FloatByteSize, 1000000000.0, 4],
- [wire_format.FloatByteSize, -1000000000.0, 4],
- # DoubleByteSize().
- [wire_format.DoubleByteSize, 0.0, 8],
- [wire_format.DoubleByteSize, 1000000000.0, 8],
- [wire_format.DoubleByteSize, -1000000000.0, 8],
- # BoolByteSize().
- [wire_format.BoolByteSize, False, 1],
- [wire_format.BoolByteSize, True, 1],
- # EnumByteSize().
- [wire_format.EnumByteSize, 0, 1],
- [wire_format.EnumByteSize, 127, 1],
- [wire_format.EnumByteSize, 128, 2],
- [wire_format.EnumByteSize, wire_format.UINT32_MAX, 5],
- ]
- for args in NUMERIC_ARGS:
- self.NumericByteSizeTestHelper(*args)
-
- # Test strings and bytes.
- for byte_size_fn in (wire_format.StringByteSize, wire_format.BytesByteSize):
- # 1 byte for tag, 1 byte for length, 3 bytes for contents.
- self.assertEqual(5, byte_size_fn(10, 'abc'))
- # 2 bytes for tag, 1 byte for length, 3 bytes for contents.
- self.assertEqual(6, byte_size_fn(16, 'abc'))
- # 2 bytes for tag, 2 bytes for length, 128 bytes for contents.
- self.assertEqual(132, byte_size_fn(16, 'a' * 128))
-
- # Test UTF-8 string byte size calculation.
- # 1 byte for tag, 1 byte for length, 8 bytes for content.
- self.assertEqual(10, wire_format.StringByteSize(
- 5, unicode('\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82', 'utf-8')))
-
- class MockMessage(object):
- def __init__(self, byte_size):
- self.byte_size = byte_size
- def ByteSize(self):
- return self.byte_size
-
- message_byte_size = 10
- mock_message = MockMessage(byte_size=message_byte_size)
- # Test groups.
- # (2 * 1) bytes for begin and end tags, plus message_byte_size.
- self.assertEqual(2 + message_byte_size,
- wire_format.GroupByteSize(1, mock_message))
- # (2 * 2) bytes for begin and end tags, plus message_byte_size.
- self.assertEqual(4 + message_byte_size,
- wire_format.GroupByteSize(16, mock_message))
-
- # Test messages.
- # 1 byte for tag, plus 1 byte for length, plus contents.
- self.assertEqual(2 + mock_message.byte_size,
- wire_format.MessageByteSize(1, mock_message))
- # 2 bytes for tag, plus 1 byte for length, plus contents.
- self.assertEqual(3 + mock_message.byte_size,
- wire_format.MessageByteSize(16, mock_message))
- # 2 bytes for tag, plus 2 bytes for length, plus contents.
- mock_message.byte_size = 128
- self.assertEqual(4 + mock_message.byte_size,
- wire_format.MessageByteSize(16, mock_message))
-
-
- # Test message set item byte size.
- # 4 bytes for tags, plus 1 byte for length, plus 1 byte for type_id,
- # plus contents.
- mock_message.byte_size = 10
- self.assertEqual(mock_message.byte_size + 6,
- wire_format.MessageSetItemByteSize(1, mock_message))
-
- # 4 bytes for tags, plus 2 bytes for length, plus 1 byte for type_id,
- # plus contents.
- mock_message.byte_size = 128
- self.assertEqual(mock_message.byte_size + 7,
- wire_format.MessageSetItemByteSize(1, mock_message))
-
- # 4 bytes for tags, plus 2 bytes for length, plus 2 byte for type_id,
- # plus contents.
- self.assertEqual(mock_message.byte_size + 8,
- wire_format.MessageSetItemByteSize(128, mock_message))
-
- # Too-long varint.
- self.assertRaises(message.EncodeError,
- wire_format.UInt64ByteSize, 1, 1 << 128)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py
index 190b895..70fdae1 100644
--- a/python/google/protobuf/descriptor.py
+++ b/python/google/protobuf/descriptor.py
@@ -913,6 +913,24 @@
self.input_type = input_type
self.output_type = output_type
+ def CopyToProto(self, proto):
+ """Copies this to a descriptor_pb2.MethodDescriptorProto.
+
+ Args:
+ proto (descriptor_pb2.MethodDescriptorProto): An empty descriptor proto.
+
+ Raises:
+ Error: If self couldn't be serialized, due to too few constructor
+ arguments.
+ """
+ if self.containing_service is not None:
+ from google.protobuf import descriptor_pb2
+ service_proto = descriptor_pb2.ServiceDescriptorProto()
+ self.containing_service.CopyToProto(service_proto)
+ proto.CopyFrom(service_proto.method[self.index])
+ else:
+ raise Error('Descriptor does not contain a service.')
+
class FileDescriptor(DescriptorBase):
"""Descriptor for a file. Mimics the descriptor_pb2.FileDescriptorProto.
diff --git a/python/google/protobuf/internal/api_implementation.py b/python/google/protobuf/internal/api_implementation.py
index 7592be4..be1af7d 100644
--- a/python/google/protobuf/internal/api_implementation.py
+++ b/python/google/protobuf/internal/api_implementation.py
@@ -32,8 +32,8 @@
"""
import os
-import warnings
import sys
+import warnings
try:
# pylint: disable=g-import-not-at-top
@@ -60,10 +60,11 @@
raise ImportError('_use_fast_cpp_protos import succeeded but was None')
del _use_fast_cpp_protos
_api_version = 2
- # Can not import both use_fast_cpp_protos and use_pure_python.
from google.protobuf import use_pure_python
raise RuntimeError(
- 'Conflict depend on both use_fast_cpp_protos and use_pure_python')
+ 'Conflicting deps on both :use_fast_cpp_protos and :use_pure_python.\n'
+ ' go/build_deps_on_BOTH_use_fast_cpp_protos_AND_use_pure_python\n'
+ 'This should be impossible via a link error at build time...')
except ImportError:
try:
# pylint: disable=g-import-not-at-top
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py
index 5e3b0a9..4fc8049 100755
--- a/python/google/protobuf/internal/descriptor_test.py
+++ b/python/google/protobuf/internal/descriptor_test.py
@@ -907,10 +907,6 @@
descriptor_pb2.ServiceDescriptorProto,
TEST_SERVICE_ASCII)
- @unittest.skipIf(
- api_implementation.Type() == 'python',
- 'It is not implemented in python.')
- # TODO(jieluo): Add support for pure python or remove in c extension.
def testCopyToProto_MethodDescriptor(self):
expected_ascii = """
name: 'Foo'
diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py
index 36dfbfd..3ee14e4 100755
--- a/python/google/protobuf/internal/proto_builder_test.py
+++ b/python/google/protobuf/internal/proto_builder_test.py
@@ -42,6 +42,7 @@
import unittest
from google.protobuf import descriptor_pb2
+from google.protobuf import descriptor
from google.protobuf import descriptor_pool
from google.protobuf import proto_builder
from google.protobuf import text_format
@@ -91,6 +92,23 @@
pool=pool)
self.assertIs(proto_cls1.DESCRIPTOR, proto_cls2.DESCRIPTOR)
+ def testMakeLargeProtoClass(self):
+ """Test that large created protos don't use reserved field numbers."""
+ num_fields = 123456
+ fields = {
+ 'foo%d' % i: descriptor_pb2.FieldDescriptorProto.TYPE_INT64
+ for i in range(num_fields)
+ }
+ proto_cls = proto_builder.MakeSimpleProtoClass(
+ fields,
+ full_name='net.proto2.python.public.proto_builder_test.LargeProtoTest')
+
+ reserved_field_numbers = set(
+ range(descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER,
+ descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER + 1))
+ proto_field_numbers = set(proto_cls.DESCRIPTOR.fields_by_number)
+ self.assertFalse(reserved_field_numbers.intersection(proto_field_numbers))
+
if __name__ == '__main__':
unittest.main()
diff --git a/python/google/protobuf/internal/python_protobuf.cc b/python/google/protobuf/internal/python_protobuf.cc
deleted file mode 100644
index e823bf2..0000000
--- a/python/google/protobuf/internal/python_protobuf.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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: qrczak@google.com (Marcin Kowalczyk)
-
-#include <google/protobuf/python/python_protobuf.h>
-
-namespace google {
-namespace protobuf {
-namespace python {
-
-static const Message* GetCProtoInsidePyProtoStub(PyObject* msg) { return NULL; }
-static Message* MutableCProtoInsidePyProtoStub(PyObject* msg) { return NULL; }
-
-// This is initialized with a default, stub implementation.
-// If python-google.protobuf.cc is loaded, the function pointer is overridden
-// with a full implementation.
-const Message* (*GetCProtoInsidePyProtoPtr)(PyObject* msg) =
- GetCProtoInsidePyProtoStub;
-Message* (*MutableCProtoInsidePyProtoPtr)(PyObject* msg) =
- MutableCProtoInsidePyProtoStub;
-
-const Message* GetCProtoInsidePyProto(PyObject* msg) {
- return GetCProtoInsidePyProtoPtr(msg);
-}
-Message* MutableCProtoInsidePyProto(PyObject* msg) {
- return MutableCProtoInsidePyProtoPtr(msg);
-}
-
-} // namespace python
-} // namespace protobuf
-} // namespace google
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
index c8f5602..965614d 100644
--- a/python/google/protobuf/json_format.py
+++ b/python/google/protobuf/json_format.py
@@ -531,8 +531,9 @@
'"{1}" fields.'.format(
message.DESCRIPTOR.full_name, name))
names.append(name)
+ value = js[name]
# Check no other oneof field is parsed.
- if field.containing_oneof is not None:
+ if field.containing_oneof is not None and value is not None:
oneof_name = field.containing_oneof.name
if oneof_name in names:
raise ParseError('Message type "{0}" should not have multiple '
@@ -540,7 +541,6 @@
message.DESCRIPTOR.full_name, oneof_name))
names.append(oneof_name)
- value = js[name]
if value is None:
if (field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE
and field.message_type.full_name == 'google.protobuf.Value'):
diff --git a/python/google/protobuf/proto_builder.py b/python/google/protobuf/proto_builder.py
index 736caed..2b7dddc 100644
--- a/python/google/protobuf/proto_builder.py
+++ b/python/google/protobuf/proto_builder.py
@@ -31,13 +31,14 @@
"""Dynamic Protobuf class creator."""
try:
- from collections import OrderedDict
+ from collections import OrderedDict
except ImportError:
- from ordereddict import OrderedDict #PY26
+ from ordereddict import OrderedDict #PY26
import hashlib
import os
from google.protobuf import descriptor_pb2
+from google.protobuf import descriptor
from google.protobuf import message_factory
@@ -124,6 +125,12 @@
for f_number, (f_name, f_type) in enumerate(field_items, 1):
field_proto = desc_proto.field.add()
field_proto.name = f_name
+ # # If the number falls in the reserved range, reassign it to the correct
+ # # number after the range.
+ if f_number >= descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER:
+ f_number += (
+ descriptor.FieldDescriptor.LAST_RESERVED_FIELD_NUMBER -
+ descriptor.FieldDescriptor.FIRST_RESERVED_FIELD_NUMBER + 1)
field_proto.number = f_number
field_proto.label = descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL
field_proto.type = f_type
diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc
index d330e0d..b607956 100644
--- a/python/google/protobuf/pyext/descriptor_pool.cc
+++ b/python/google/protobuf/pyext/descriptor_pool.cc
@@ -219,7 +219,7 @@
}
PyObject* SetErrorFromCollector(DescriptorPool::ErrorCollector* self,
- char* name, char* error_type) {
+ const char* name, const char* error_type) {
BuildFileErrorCollector* error_collector =
reinterpret_cast<BuildFileErrorCollector*>(self);
if (error_collector && !error_collector->error_message.empty()) {
diff --git a/python/google/protobuf/pyext/repeated_composite_container.cc b/python/google/protobuf/pyext/repeated_composite_container.cc
index cbc0f9f..f3d6fc3 100644
--- a/python/google/protobuf/pyext/repeated_composite_container.cc
+++ b/python/google/protobuf/pyext/repeated_composite_container.cc
@@ -379,16 +379,19 @@
const FieldDescriptor* descriptor = self->parent_field_descriptor;
const Py_ssize_t length = Length(reinterpret_cast<PyObject*>(self));
- // Since Python protobuf objects are never arena-allocated, adding and
- // removing message pointers to the underlying array is just updating
- // pointers.
- for (Py_ssize_t i = 0; i < length; ++i)
- reflection->ReleaseLast(message, descriptor);
-
+ // We need to rearrange things to match python's sort order. Because there
+ // was already an O(n*log(n)) step in python and a bunch of reflection, we
+ // expect an O(n**2) step in C++ won't hurt too much.
for (Py_ssize_t i = 0; i < length; ++i) {
- CMessage* py_cmsg = reinterpret_cast<CMessage*>(
- PyList_GET_ITEM(child_list, i));
- reflection->AddAllocatedMessage(message, descriptor, py_cmsg->message);
+ Message* child_message =
+ reinterpret_cast<CMessage*>(PyList_GET_ITEM(child_list, i))->message;
+ for (Py_ssize_t j = i; j < length; ++j) {
+ if (child_message ==
+ &reflection->GetRepeatedMessage(*message, descriptor, j)) {
+ reflection->SwapElements(message, descriptor, i, j);
+ break;
+ }
+ }
}
}
diff --git a/python/google/protobuf/python_protobuf.h b/python/google/protobuf/python_protobuf.h
deleted file mode 100644
index 8db1ffb..0000000
--- a/python/google/protobuf/python_protobuf.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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: qrczak@google.com (Marcin Kowalczyk)
-//
-// This module exposes the C proto inside the given Python proto, in
-// case the Python proto is implemented with a C proto.
-
-#ifndef GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
-#define GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
-
-#include <Python.h>
-
-namespace google {
-namespace protobuf {
-
-class Message;
-
-namespace python {
-
-// Return the pointer to the C proto inside the given Python proto,
-// or NULL when this is not a Python proto implemented with a C proto.
-const Message* GetCProtoInsidePyProto(PyObject* msg);
-Message* MutableCProtoInsidePyProto(PyObject* msg);
-
-} // namespace python
-} // namespace protobuf
-} // namespace google
-
-#endif // GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
diff --git a/python/setup.py b/python/setup.py
index 696bde2..ff67b89 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -209,6 +209,18 @@
extra_compile_args = []
+ message_extra_link_args = None
+ api_implementation_link_args = None
+ if "darwin" in sys.platform:
+ if sys.version_info[0] == 2:
+ message_init_symbol = 'init_message'
+ api_implementation_init_symbol = 'init_api_implementation'
+ else:
+ message_init_symbol = 'PyInit__message'
+ api_implementation_init_symbol = 'PyInit__api_implementation'
+ message_extra_link_args = ['-Wl,-exported_symbol,_%s' % message_init_symbol]
+ api_implementation_link_args = ['-Wl,-exported_symbol,_%s' % api_implementation_init_symbol]
+
if sys.platform != 'win32':
extra_compile_args.append('-Wno-write-strings')
extra_compile_args.append('-Wno-invalid-offsetof')
@@ -259,6 +271,7 @@
include_dirs=[".", "../src"],
libraries=libraries,
extra_objects=extra_objects,
+ extra_link_args=message_extra_link_args,
library_dirs=['../src/.libs'],
extra_compile_args=extra_compile_args,
),
@@ -266,6 +279,7 @@
"google.protobuf.internal._api_implementation",
glob.glob('google/protobuf/internal/api_implementation.cc'),
extra_compile_args=extra_compile_args + ['-DPYTHON_PROTO2_CPP_IMPL_V2'],
+ extra_link_args=api_implementation_link_args,
),
])
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
diff --git a/ruby/Gemfile b/ruby/Gemfile
index fa75df1..76b23ad 100644
--- a/ruby/Gemfile
+++ b/ruby/Gemfile
@@ -1,3 +1,5 @@
source 'https://rubygems.org'
gemspec
+
+gem "irb", "~> 1.1", "< 1.2.0" if RUBY_VERSION < "2.5"
diff --git a/ruby/Rakefile b/ruby/Rakefile
index 3e3da05..11397b0 100644
--- a/ruby/Rakefile
+++ b/ruby/Rakefile
@@ -24,6 +24,12 @@
google/protobuf/compiler/plugin.proto
]
+if system('../src/protoc --version')
+ protoc_command = '../src/protoc'
+else
+ protoc_command = 'protoc'
+end
+
genproto_output = []
# We won't have access to .. from within docker, but the proto files
@@ -34,7 +40,7 @@
output_file = "lib/" + proto_file.sub(/\.proto$/, "_pb.rb")
genproto_output << output_file
file output_file => input_file do |file_task|
- sh "../src/protoc -I../src --ruby_out=lib #{input_file}"
+ sh "#{protoc_command} -I../src --ruby_out=lib #{input_file}"
end
end
end
@@ -108,43 +114,43 @@
genproto_output << "tests/wrappers.rb"
file "tests/generated_code.rb" => "tests/generated_code.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/generated_code.proto"
+ sh "#{protoc_command} --ruby_out=. tests/generated_code.proto"
end
file "tests/generated_code_proto2.rb" => "tests/generated_code_proto2.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/generated_code_proto2.proto"
+ sh "#{protoc_command} --ruby_out=. tests/generated_code_proto2.proto"
end
file "tests/test_import.rb" => "tests/test_import.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/test_import.proto"
+ sh "#{protoc_command} --ruby_out=. tests/test_import.proto"
end
file "tests/test_import_proto2.rb" => "tests/test_import_proto2.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/test_import_proto2.proto"
+ sh "#{protoc_command} --ruby_out=. tests/test_import_proto2.proto"
end
file "tests/test_ruby_package.rb" => "tests/test_ruby_package.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/test_ruby_package.proto"
+ sh "#{protoc_command} --ruby_out=. tests/test_ruby_package.proto"
end
file "tests/test_ruby_package_proto2.rb" => "tests/test_ruby_package_proto2.proto" do |file_task|
- sh "../src/protoc --ruby_out=. tests/test_ruby_package_proto2.proto"
+ sh "#{protoc_command} --ruby_out=. tests/test_ruby_package_proto2.proto"
end
file "tests/basic_test.rb" => "tests/basic_test.proto" do |file_task|
- sh "../src/protoc --experimental_allow_proto3_optional -I../src -I. --ruby_out=. tests/basic_test.proto"
+ sh "#{protoc_command} --experimental_allow_proto3_optional -I../src -I. --ruby_out=. tests/basic_test.proto"
end
file "tests/basic_test_proto2.rb" => "tests/basic_test_proto2.proto" do |file_task|
- sh "../src/protoc -I../src -I. --ruby_out=. tests/basic_test_proto2.proto"
+ sh "#{protoc_command} -I../src -I. --ruby_out=. tests/basic_test_proto2.proto"
end
file "tests/multi_level_nesting_test.rb" => "tests/multi_level_nesting_test.proto" do |file_task|
- sh "../src/protoc -I../src -I. --ruby_out=. tests/multi_level_nesting_test.proto"
+ sh "#{protoc_command} -I../src -I. --ruby_out=. tests/multi_level_nesting_test.proto"
end
file "tests/wrappers.rb" => "../src/google/protobuf/wrappers.proto" do |file_task|
- sh "../src/protoc -I../src -I. --ruby_out=tests ../src/google/protobuf/wrappers.proto"
+ sh "#{protoc_command} -I../src -I. --ruby_out=tests ../src/google/protobuf/wrappers.proto"
end
task :genproto => genproto_output
diff --git a/ruby/ext/google/protobuf_c/extconf.rb b/ruby/ext/google/protobuf_c/extconf.rb
index ec17787..eaab4db 100755
--- a/ruby/ext/google/protobuf_c/extconf.rb
+++ b/ruby/ext/google/protobuf_c/extconf.rb
@@ -17,4 +17,5 @@
$objs = ["protobuf.o", "convert.o", "defs.o", "message.o",
"repeated_field.o", "map.o", "ruby-upb.o", "wrap_memcpy.o"]
+find_header('third_party/wyhash/wyhash.h', '../../../..')
create_makefile("google/protobuf_c")
diff --git a/ruby/ext/google/protobuf_c/message.c b/ruby/ext/google/protobuf_c/message.c
index 1eb0cb7..ffdae6a 100644
--- a/ruby/ext/google/protobuf_c/message.c
+++ b/ruby/ext/google/protobuf_c/message.c
@@ -734,7 +734,10 @@
*/
static VALUE Message_hash(VALUE _self) {
Message* self = ruby_to_Message(_self);
- return INT2FIX(Message_Hash(self->msg, self->msgdef, 0));
+ uint64_t hash_value = Message_Hash(self->msg, self->msgdef, 0);
+ // RUBY_FIXNUM_MAX should be one less than a power of 2.
+ assert((RUBY_FIXNUM_MAX & (RUBY_FIXNUM_MAX + 1)) == 0);
+ return INT2FIX(hash_value & RUBY_FIXNUM_MAX);
}
/*
diff --git a/ruby/ext/google/protobuf_c/protobuf.c b/ruby/ext/google/protobuf_c/protobuf.c
index 19917fe..b657fa3 100644
--- a/ruby/ext/google/protobuf_c/protobuf.c
+++ b/ruby/ext/google/protobuf_c/protobuf.c
@@ -238,8 +238,16 @@
// We use WeakMap for the cache. For Ruby <2.7 we also need a secondary Hash
// to store WeakMap keys because Ruby <2.7 WeakMap doesn't allow non-finalizable
// keys.
+//
+// We also need the secondary Hash if sizeof(long) < sizeof(VALUE), because this
+// means it may not be possible to fit a pointer into a Fixnum. Keys are
+// pointers, and if they fit into a Fixnum, Ruby doesn't collect them, but if
+// they overflow and require allocating a Bignum, they could get collected
+// prematurely, thus removing the cache entry. This happens on 64-bit Windows,
+// on which pointers are 64 bits but longs are 32 bits. In this case, we enable
+// the secondary Hash to hold the keys and prevent them from being collected.
-#if RUBY_API_VERSION_CODE >= 20700
+#if RUBY_API_VERSION_CODE >= 20700 && SIZEOF_LONG >= SIZEOF_VALUE
#define USE_SECONDARY_MAP 0
#else
#define USE_SECONDARY_MAP 1
@@ -326,7 +334,7 @@
VALUE ret = rb_hash_lookup(secondary_map, key);
if (ret == Qnil && create) {
SecondaryMap_MaybeGC();
- ret = rb_eval_string("Object.new");
+ ret = rb_class_new_instance(0, NULL, rb_cObject);
rb_hash_aset(secondary_map, key, ret);
}
return ret;
@@ -336,11 +344,9 @@
// Requires: secondary_map_mutex is held by this thread iff create == true.
static VALUE ObjectCache_GetKey(const void* key, bool create) {
- char buf[sizeof(key)];
- memcpy(&buf, &key, sizeof(key));
- intptr_t key_int = (intptr_t)key;
- PBRUBY_ASSERT((key_int & 3) == 0);
- VALUE ret = LL2NUM(key_int >> 2);
+ VALUE key_val = (VALUE)key;
+ PBRUBY_ASSERT((key_val & 3) == 0);
+ VALUE ret = LL2NUM(key_val >> 2);
#if USE_SECONDARY_MAP
ret = SecondaryMap_Get(ret, create);
#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index e0c6680..766cf73 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -150,6 +150,7 @@
google/protobuf/compiler/csharp/csharp_generator.h \
google/protobuf/compiler/csharp/csharp_names.h \
google/protobuf/compiler/java/java_generator.h \
+ google/protobuf/compiler/java/java_kotlin_generator.h \
google/protobuf/compiler/java/java_names.h \
google/protobuf/compiler/js/js_generator.h \
google/protobuf/compiler/js/well_known_types_embed.h \
@@ -345,6 +346,8 @@
google/protobuf/compiler/cpp/cpp_options.h \
google/protobuf/compiler/cpp/cpp_padding_optimizer.cc \
google/protobuf/compiler/cpp/cpp_padding_optimizer.h \
+ google/protobuf/compiler/cpp/cpp_parse_function_generator.cc \
+ google/protobuf/compiler/cpp/cpp_parse_function_generator.h \
google/protobuf/compiler/cpp/cpp_primitive_field.cc \
google/protobuf/compiler/cpp/cpp_primitive_field.h \
google/protobuf/compiler/cpp/cpp_service.cc \
@@ -374,6 +377,7 @@
google/protobuf/compiler/java/java_generator_factory.h \
google/protobuf/compiler/java/java_helpers.cc \
google/protobuf/compiler/java/java_helpers.h \
+ google/protobuf/compiler/java/java_kotlin_generator.cc \
google/protobuf/compiler/java/java_map_field.cc \
google/protobuf/compiler/java/java_map_field.h \
google/protobuf/compiler/java/java_map_field_lite.cc \
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index 5ecf63f..867cc37 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -110,12 +110,12 @@
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_type_url().empty()) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
- GetArena());
+ GetArenaForAllocation());
}
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
- GetArena());
+ GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
}
@@ -132,7 +132,7 @@
}
void Any::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -211,7 +211,7 @@
(void) cached_has_bits;
// string type_url = 1;
- if (this->type_url().size() > 0) {
+ if (!this->type_url().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -221,7 +221,7 @@
}
// bytes value = 2;
- if (this->value().size() > 0) {
+ if (!this->value().empty()) {
target = stream->WriteBytesMaybeAliased(
2, this->_internal_value(), target);
}
@@ -243,14 +243,14 @@
(void) cached_has_bits;
// string type_url = 1;
- if (this->type_url().size() > 0) {
+ if (!this->type_url().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_type_url());
}
// bytes value = 2;
- if (this->value().size() > 0) {
+ if (!this->value().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->_internal_value());
@@ -287,10 +287,10 @@
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
- if (from.type_url().size() > 0) {
+ if (!from.type_url().empty()) {
_internal_set_type_url(from._internal_type_url());
}
- if (from.value().size() > 0) {
+ if (!from.value().empty()) {
_internal_set_value(from._internal_value());
}
}
@@ -315,9 +315,17 @@
void Any::InternalSwap(Any* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- type_url_.Swap(&other->type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &type_url_, GetArenaForAllocation(),
+ &other->type_url_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &value_, GetArenaForAllocation(),
+ &other->value_, other->GetArenaForAllocation()
+ );
}
::PROTOBUF_NAMESPACE_ID::Metadata Any::GetMetadata() const {
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 81aebe8..64424ed 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -65,7 +65,7 @@
// ===================================================================
-class PROTOBUF_EXPORT Any PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Any final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ {
public:
inline Any() : Any(nullptr) {}
@@ -83,8 +83,9 @@
return *this;
}
inline Any& operator=(Any&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -148,7 +149,7 @@
}
inline void Swap(Any* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -156,14 +157,14 @@
}
void UnsafeArenaSwap(Any* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Any* New() const final {
- return CreateMaybeMessage<Any>(nullptr);
+ return new Any();
}
Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -183,8 +184,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Any* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -214,11 +215,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_type_url();
- std::string* release_type_url();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_type_url();
void set_allocated_type_url(std::string* type_url);
private:
const std::string& _internal_type_url() const;
- void _internal_set_type_url(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const std::string& value);
std::string* _internal_mutable_type_url();
public:
@@ -228,11 +229,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_value();
- std::string* release_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_value();
void set_allocated_value(std::string* value);
private:
const std::string& _internal_value() const;
- void _internal_set_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value);
std::string* _internal_mutable_value();
public:
@@ -269,10 +270,10 @@
return _internal_type_url();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Any::set_type_url(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Any::set_type_url(ArgT0&& arg0, ArgT... args) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
}
inline std::string* Any::mutable_type_url() {
@@ -284,15 +285,15 @@
}
inline void Any::_internal_set_type_url(const std::string& value) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Any::_internal_mutable_type_url() {
- return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Any::release_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Any.type_url)
- return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Any::set_allocated_type_url(std::string* type_url) {
if (type_url != nullptr) {
@@ -301,7 +302,7 @@
}
type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
}
@@ -314,10 +315,10 @@
return _internal_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Any::set_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Any::set_value(ArgT0&& arg0, ArgT... args) {
- value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Any.value)
}
inline std::string* Any::mutable_value() {
@@ -329,15 +330,15 @@
}
inline void Any::_internal_set_value(const std::string& value) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Any::_internal_mutable_value() {
- return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Any::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Any.value)
- return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Any::set_allocated_value(std::string* value) {
if (value != nullptr) {
@@ -346,7 +347,7 @@
}
value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
}
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index 0f4facd..1879c60 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -173,7 +173,7 @@
options_.Clear();
}
void Api::clear_source_context() {
- if (GetArena() == nullptr && source_context_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
}
source_context_ = nullptr;
@@ -196,12 +196,12 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_version().empty()) {
version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_);
@@ -228,7 +228,7 @@
}
void Api::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
version_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete source_context_;
@@ -255,7 +255,7 @@
mixins_.Clear();
name_.ClearToEmpty();
version_.ClearToEmpty();
- if (GetArena() == nullptr && source_context_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
}
source_context_ = nullptr;
@@ -368,7 +368,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -394,7 +394,7 @@
}
// string version = 4;
- if (this->version().size() > 0) {
+ if (!this->version().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_version().data(), static_cast<int>(this->_internal_version().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -464,14 +464,14 @@
}
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
}
// string version = 4;
- if (this->version().size() > 0) {
+ if (!this->version().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_version());
@@ -524,10 +524,10 @@
methods_.MergeFrom(from.methods_);
options_.MergeFrom(from.options_);
mixins_.MergeFrom(from.mixins_);
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
- if (from.version().size() > 0) {
+ if (!from.version().empty()) {
_internal_set_version(from._internal_version());
}
if (from.has_source_context()) {
@@ -558,12 +558,20 @@
void Api::InternalSwap(Api* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
methods_.InternalSwap(&other->methods_);
options_.InternalSwap(&other->options_);
mixins_.InternalSwap(&other->mixins_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- version_.Swap(&other->version_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &version_, GetArenaForAllocation(),
+ &other->version_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Api, syntax_)
+ sizeof(Api::syntax_)
@@ -601,17 +609,17 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_request_type_url().empty()) {
request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(),
- GetArena());
+ GetArenaForAllocation());
}
response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_response_type_url().empty()) {
response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(),
- GetArena());
+ GetArenaForAllocation());
}
::memcpy(&request_streaming_, &from.request_streaming_,
static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@@ -636,7 +644,7 @@
}
void Method::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
request_type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
response_type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -765,7 +773,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -775,7 +783,7 @@
}
// string request_type_url = 2;
- if (this->request_type_url().size() > 0) {
+ if (!this->request_type_url().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_request_type_url().data(), static_cast<int>(this->_internal_request_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -791,7 +799,7 @@
}
// string response_type_url = 4;
- if (this->response_type_url().size() > 0) {
+ if (!this->response_type_url().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_response_type_url().data(), static_cast<int>(this->_internal_response_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -845,21 +853,21 @@
}
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
}
// string request_type_url = 2;
- if (this->request_type_url().size() > 0) {
+ if (!this->request_type_url().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_request_type_url());
}
// string response_type_url = 4;
- if (this->response_type_url().size() > 0) {
+ if (!this->response_type_url().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_response_type_url());
@@ -913,13 +921,13 @@
(void) cached_has_bits;
options_.MergeFrom(from.options_);
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
- if (from.request_type_url().size() > 0) {
+ if (!from.request_type_url().empty()) {
_internal_set_request_type_url(from._internal_request_type_url());
}
- if (from.response_type_url().size() > 0) {
+ if (!from.response_type_url().empty()) {
_internal_set_response_type_url(from._internal_response_type_url());
}
if (from.request_streaming() != 0) {
@@ -953,11 +961,23 @@
void Method::InternalSwap(Method* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- request_type_url_.Swap(&other->request_type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- response_type_url_.Swap(&other->response_type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &request_type_url_, GetArenaForAllocation(),
+ &other->request_type_url_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &response_type_url_, GetArenaForAllocation(),
+ &other->response_type_url_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Method, syntax_)
+ sizeof(Method::syntax_)
@@ -990,12 +1010,12 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_root().empty()) {
root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(),
- GetArena());
+ GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
}
@@ -1012,7 +1032,7 @@
}
void Mixin::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
root_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -1092,7 +1112,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1102,7 +1122,7 @@
}
// string root = 2;
- if (this->root().size() > 0) {
+ if (!this->root().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_root().data(), static_cast<int>(this->_internal_root().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1128,14 +1148,14 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
}
// string root = 2;
- if (this->root().size() > 0) {
+ if (!this->root().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_root());
@@ -1172,10 +1192,10 @@
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
- if (from.root().size() > 0) {
+ if (!from.root().empty()) {
_internal_set_root(from._internal_root());
}
}
@@ -1200,9 +1220,17 @@
void Mixin::InternalSwap(Mixin* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- root_.Swap(&other->root_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &root_, GetArenaForAllocation(),
+ &other->root_, other->GetArenaForAllocation()
+ );
}
::PROTOBUF_NAMESPACE_ID::Metadata Mixin::GetMetadata() const {
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 13e42d1..3e76ee6 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -75,7 +75,7 @@
// ===================================================================
-class PROTOBUF_EXPORT Api PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Api final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ {
public:
inline Api() : Api(nullptr) {}
@@ -93,8 +93,9 @@
return *this;
}
inline Api& operator=(Api&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -125,7 +126,7 @@
}
inline void Swap(Api* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -133,14 +134,14 @@
}
void UnsafeArenaSwap(Api* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Api* New() const final {
- return CreateMaybeMessage<Api>(nullptr);
+ return new Api();
}
Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -160,8 +161,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Api* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -250,11 +251,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -264,11 +265,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_version(ArgT0&& arg0, ArgT... args);
std::string* mutable_version();
- std::string* release_version();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_version();
void set_allocated_version(std::string* version);
private:
const std::string& _internal_version() const;
- void _internal_set_version(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_version(const std::string& value);
std::string* _internal_mutable_version();
public:
@@ -279,7 +280,7 @@
public:
void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
- PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
private:
@@ -318,7 +319,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Method PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Method final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ {
public:
inline Method() : Method(nullptr) {}
@@ -336,8 +337,9 @@
return *this;
}
inline Method& operator=(Method&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -368,7 +370,7 @@
}
inline void Swap(Method* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -376,14 +378,14 @@
}
void UnsafeArenaSwap(Method* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Method* New() const final {
- return CreateMaybeMessage<Method>(nullptr);
+ return new Method();
}
Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -403,8 +405,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Method* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -457,11 +459,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -471,11 +473,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_request_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_request_type_url();
- std::string* release_request_type_url();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_request_type_url();
void set_allocated_request_type_url(std::string* request_type_url);
private:
const std::string& _internal_request_type_url() const;
- void _internal_set_request_type_url(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_request_type_url(const std::string& value);
std::string* _internal_mutable_request_type_url();
public:
@@ -485,11 +487,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_response_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_response_type_url();
- std::string* release_response_type_url();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_response_type_url();
void set_allocated_response_type_url(std::string* response_type_url);
private:
const std::string& _internal_response_type_url() const;
- void _internal_set_response_type_url(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_response_type_url(const std::string& value);
std::string* _internal_mutable_response_type_url();
public:
@@ -539,7 +541,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Mixin PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Mixin final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ {
public:
inline Mixin() : Mixin(nullptr) {}
@@ -557,8 +559,9 @@
return *this;
}
inline Mixin& operator=(Mixin&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -589,7 +592,7 @@
}
inline void Swap(Mixin* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -597,14 +600,14 @@
}
void UnsafeArenaSwap(Mixin* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Mixin* New() const final {
- return CreateMaybeMessage<Mixin>(nullptr);
+ return new Mixin();
}
Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -624,8 +627,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Mixin* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -655,11 +658,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -669,11 +672,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_root(ArgT0&& arg0, ArgT... args);
std::string* mutable_root();
- std::string* release_root();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_root();
void set_allocated_root(std::string* root);
private:
const std::string& _internal_root() const;
- void _internal_set_root(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_root(const std::string& value);
std::string* _internal_mutable_root();
public:
@@ -709,10 +712,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Api::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Api::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Api.name)
}
inline std::string* Api::mutable_name() {
@@ -724,15 +727,15 @@
}
inline void Api::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Api::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Api::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Api::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -741,7 +744,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
}
@@ -829,10 +832,10 @@
return _internal_version();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Api::set_version(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Api::set_version(ArgT0&& arg0, ArgT... args) {
- version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Api.version)
}
inline std::string* Api::mutable_version() {
@@ -844,15 +847,15 @@
}
inline void Api::_internal_set_version(const std::string& value) {
- version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Api::_internal_mutable_version() {
- return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return version_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Api::release_version() {
// @@protoc_insertion_point(field_release:google.protobuf.Api.version)
- return version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return version_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Api::set_allocated_version(std::string* version) {
if (version != nullptr) {
@@ -861,7 +864,7 @@
}
version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
}
@@ -883,7 +886,7 @@
}
inline void Api::unsafe_arena_set_allocated_source_context(
PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
}
source_context_ = source_context;
@@ -898,7 +901,7 @@
PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -913,7 +916,7 @@
inline PROTOBUF_NAMESPACE_ID::SourceContext* Api::_internal_mutable_source_context() {
if (source_context_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation());
source_context_ = p;
}
return source_context_;
@@ -923,13 +926,15 @@
return _internal_mutable_source_context();
}
inline void Api::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context)->GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
+ ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context));
if (message_arena != submessage_arena) {
source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, source_context, submessage_arena);
@@ -1014,10 +1019,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Method::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Method::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.name)
}
inline std::string* Method::mutable_name() {
@@ -1029,15 +1034,15 @@
}
inline void Method::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Method::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Method::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1046,7 +1051,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
}
@@ -1059,10 +1064,10 @@
return _internal_request_type_url();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Method::set_request_type_url(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Method::set_request_type_url(ArgT0&& arg0, ArgT... args) {
- request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
}
inline std::string* Method::mutable_request_type_url() {
@@ -1074,15 +1079,15 @@
}
inline void Method::_internal_set_request_type_url(const std::string& value) {
- request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_request_type_url() {
- return request_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return request_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Method::release_request_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url)
- return request_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return request_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Method::set_allocated_request_type_url(std::string* request_type_url) {
if (request_type_url != nullptr) {
@@ -1091,7 +1096,7 @@
}
request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
}
@@ -1124,10 +1129,10 @@
return _internal_response_type_url();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Method::set_response_type_url(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Method::set_response_type_url(ArgT0&& arg0, ArgT... args) {
- response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
}
inline std::string* Method::mutable_response_type_url() {
@@ -1139,15 +1144,15 @@
}
inline void Method::_internal_set_response_type_url(const std::string& value) {
- response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Method::_internal_mutable_response_type_url() {
- return response_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return response_type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Method::release_response_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url)
- return response_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return response_type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Method::set_allocated_response_type_url(std::string* response_type_url) {
if (response_type_url != nullptr) {
@@ -1156,7 +1161,7 @@
}
response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
}
@@ -1249,10 +1254,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Mixin::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Mixin::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
}
inline std::string* Mixin::mutable_name() {
@@ -1264,15 +1269,15 @@
}
inline void Mixin::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Mixin::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Mixin::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Mixin.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Mixin::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1281,7 +1286,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
}
@@ -1294,10 +1299,10 @@
return _internal_root();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Mixin::set_root(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Mixin::set_root(ArgT0&& arg0, ArgT... args) {
- root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
}
inline std::string* Mixin::mutable_root() {
@@ -1309,15 +1314,15 @@
}
inline void Mixin::_internal_set_root(const std::string& value) {
- root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Mixin::_internal_mutable_root() {
- return root_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return root_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Mixin::release_root() {
// @@protoc_insertion_point(field_release:google.protobuf.Mixin.root)
- return root_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return root_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Mixin::set_allocated_root(std::string* root) {
if (root != nullptr) {
@@ -1326,7 +1331,7 @@
}
root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
}
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index 8b5c7f1..f84e505 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -93,8 +93,8 @@
template <typename Type>
class GenericTypeHandler; // defined in repeated_field.h
-PROTOBUF_ALWAYS_INLINE
-inline void* AlignTo(void* ptr, size_t align) {
+inline PROTOBUF_ALWAYS_INLINE
+void* AlignTo(void* ptr, size_t align) {
return reinterpret_cast<void*>(
(reinterpret_cast<uintptr_t>(ptr) + align - 1) & (~align + 1));
}
@@ -399,6 +399,16 @@
template <typename T>
class InternalHelper {
+ public:
+ // Provides access to protected GetOwningArena to generated messages.
+ static Arena* GetOwningArena(const T* p) { return p->GetOwningArena(); }
+
+ // Provides access to protected GetArenaForAllocation to generated messages.
+ static Arena* GetArenaForAllocation(const T* p) {
+ return p->GetArenaForAllocation();
+ }
+
+ private:
template <typename U>
static char DestructorSkippable(const typename U::DestructorSkippable_*);
template <typename U>
@@ -439,6 +449,10 @@
return new (ptr) T(std::forward<Args>(args)...);
}
+ static T* New() {
+ return new T(nullptr);
+ }
+
static Arena* GetArena(const T* p) { return p->GetArena(); }
friend class Arena;
@@ -490,7 +504,9 @@
InternalHelper<T>::is_arena_constructable::value,
"CreateMessage can only construct types that are ArenaConstructable");
if (arena == NULL) {
- return new T();
+ // Generated arena constructor T(Arena*) is protected. Call via
+ // InternalHelper.
+ return InternalHelper<T>::New();
} else {
return arena->DoCreateMessage<T>();
}
@@ -618,7 +634,6 @@
new (arena->AllocateInternal(sizeof(T), alignof(T), destructor,
RTTI_TYPE_ID(T)))
T(std::forward<Args>(args)...);
- result->SetOwningArena(arena);
return result;
}
}
@@ -646,7 +661,6 @@
PROTOBUF_ALWAYS_INLINE void OwnInternal(T* object, std::true_type) {
if (object != NULL) {
impl_.AddCleanup(object, &internal::arena_delete_object<MessageLite>);
- object->SetOwningArena(this);
}
}
template <typename T>
@@ -680,6 +694,25 @@
return nullptr;
}
+ template <typename T>
+ PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArena(const T* value) {
+ return GetOwningArenaInternal(
+ value, std::is_convertible<T*, MessageLite*>());
+ }
+
+ // Implementation for GetOwningArena(). All and only message objects have
+ // GetOwningArena() method.
+ template <typename T>
+ PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal(
+ const T* value, std::true_type) {
+ return InternalHelper<T>::GetOwningArena(value);
+ }
+ template <typename T>
+ PROTOBUF_ALWAYS_INLINE static Arena* GetOwningArenaInternal(
+ const T* value, std::false_type) {
+ return nullptr;
+ }
+
// For friends of arena.
void* AllocateAligned(size_t n, size_t align = 8) {
if (align <= 8) {
diff --git a/src/google/protobuf/arena_test_util.h b/src/google/protobuf/arena_test_util.h
index 8ceab91..33f5cf4 100644
--- a/src/google/protobuf/arena_test_util.h
+++ b/src/google/protobuf/arena_test_util.h
@@ -92,6 +92,33 @@
} capture_alloc;
};
+// Owns the internal T only if it's not owned by an arena.
+// T needs to be arena constructible and destructor skippable.
+template <typename T>
+class ArenaHolder {
+ public:
+ explicit ArenaHolder(Arena* arena)
+ : field_(Arena::CreateMessage<T>(arena)),
+ owned_by_arena_(arena != nullptr) {
+ GOOGLE_DCHECK(google::protobuf::Arena::is_arena_constructable<T>::value);
+ GOOGLE_DCHECK(google::protobuf::Arena::is_destructor_skippable<T>::value);
+ }
+
+ ~ArenaHolder() {
+ if (!owned_by_arena_) {
+ delete field_;
+ }
+ }
+
+ T* get() { return field_; }
+ T* operator->() { return field_; }
+ T& operator*() { return *field_; }
+
+ private:
+ T* field_;
+ bool owned_by_arena_;
+};
+
} // namespace internal
} // namespace protobuf
} // namespace google
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h
index a9eb5de..75c1667 100644
--- a/src/google/protobuf/arenastring.h
+++ b/src/google/protobuf/arenastring.h
@@ -223,11 +223,11 @@
}
// Basic accessors.
- const std::string& Get() const PROTOBUF_NDEBUG_INLINE {
+ PROTOBUF_NDEBUG_INLINE const std::string& Get() const {
// Unconditionally mask away the tag.
return *tagged_ptr_.Get();
}
- const std::string* GetPointer() const PROTOBUF_NDEBUG_INLINE {
+ PROTOBUF_NDEBUG_INLINE const std::string* GetPointer() const {
// Unconditionally mask away the tag.
return tagged_ptr_.Get();
}
@@ -241,10 +241,10 @@
// Own()'d by any arena. If the field is not set, this returns NULL. The
// caller retains ownership. Clears this field back to NULL state. Used to
// implement release_<field>() methods on generated classes.
- std::string* Release(const std::string* default_value,
- ::google::protobuf::Arena* arena);
- std::string* ReleaseNonDefault(const std::string* default_value,
- ::google::protobuf::Arena* arena);
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* Release(
+ const std::string* default_value, ::google::protobuf::Arena* arena);
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* ReleaseNonDefault(
+ const std::string* default_value, ::google::protobuf::Arena* arena);
// Takes a std::string that is heap-allocated, and takes ownership. The
// std::string's destructor is registered with the arena. Used to implement
@@ -255,8 +255,9 @@
// Swaps internal pointers. Arena-safety semantics: this is guarded by the
// logic in Swap()/UnsafeArenaSwap() at the message level, so this method is
// 'unsafe' if called directly.
- inline void Swap(ArenaStringPtr* other, const std::string* default_value,
- Arena* arena) PROTOBUF_NDEBUG_INLINE;
+ inline PROTOBUF_NDEBUG_INLINE static void InternalSwap(
+ const std::string* default_value, ArenaStringPtr* rhs, Arena* rhs_arena,
+ ArenaStringPtr* lhs, Arena* lhs_arena);
// Frees storage (if not on an arena).
void Destroy(const std::string* default_value, ::google::protobuf::Arena* arena);
@@ -340,36 +341,28 @@
tagged_ptr_.Set(const_cast<std::string*>(value));
}
-inline void ArenaStringPtr::Swap(ArenaStringPtr* other,
- const std::string* default_value,
- Arena* arena) {
-#ifndef NDEBUG
- // For debug builds, we swap the contents of the string, rather than the
- // std::string instances themselves. This invalidates previously taken const
- // references that are (per our documentation) invalidated by calling Swap()
- // on the message.
- //
- // If both strings are the default_value, swapping is uninteresting.
- // Otherwise, we use ArenaStringPtr::Mutable() to access the std::string, to
- // ensure that we do not try to mutate default_value itself.
- if (IsDefault(default_value) && other->IsDefault(default_value)) {
- return;
- }
-
- if (default_value == nullptr) {
- // If we have non-empty default, then `default_value` is null and we can't
- // call Mutable the same way. Just do the regular swap.
- std::swap(tagged_ptr_, other->tagged_ptr_);
- } else {
- std::string* this_ptr = Mutable(EmptyDefault{}, arena);
- std::string* other_ptr = other->Mutable(EmptyDefault{}, arena);
-
- this_ptr->swap(*other_ptr);
- }
-#else
+inline PROTOBUF_NDEBUG_INLINE void ArenaStringPtr::InternalSwap( //
+ const std::string* default_value, //
+ ArenaStringPtr* rhs, Arena* rhs_arena, //
+ ArenaStringPtr* lhs, Arena* lhs_arena) {
(void)default_value;
- (void)arena;
- std::swap(tagged_ptr_, other->tagged_ptr_);
+ std::swap(lhs_arena, rhs_arena);
+ std::swap(lhs->tagged_ptr_, rhs->tagged_ptr_);
+#if 0 // TODO(b/186650244): renable this
+#ifndef NDEBUG
+ auto force_realloc = [default_value](ArenaStringPtr* p, Arena* arena) {
+ if (p->IsDefault(default_value)) return;
+ std::string* old_value = p->tagged_ptr_.Get();
+ std::string* new_value =
+ p->IsDonatedString()
+ ? Arena::Create<std::string>(arena, *old_value)
+ : Arena::Create<std::string>(arena, std::move(*old_value));
+ if (arena == nullptr) delete old_value;
+ p->tagged_ptr_.Set(new_value);
+ };
+ force_realloc(lhs, lhs_arena);
+ force_realloc(rhs, rhs_arena);
+#endif
#endif
}
diff --git a/src/google/protobuf/arenastring_unittest.cc b/src/google/protobuf/arenastring_unittest.cc
index bd4b4d8..db988af 100644
--- a/src/google/protobuf/arenastring_unittest.cc
+++ b/src/google/protobuf/arenastring_unittest.cc
@@ -54,121 +54,100 @@
using internal::ArenaStringPtr;
-static std::string WrapString(const char* value) { return value; }
-
using EmptyDefault = ArenaStringPtr::EmptyDefault;
const internal::LazyString nonempty_default{{{"default", 7}}, {nullptr}};
+const std::string* empty_default = &internal::GetEmptyString();
-// Test ArenaStringPtr with arena == NULL.
-TEST(ArenaStringPtrTest, ArenaStringPtrOnHeap) {
+class SingleArena : public testing::TestWithParam<bool> {
+ public:
+ std::unique_ptr<Arena> GetArena() {
+ if (this->GetParam()) return nullptr;
+ return std::unique_ptr<Arena>(new Arena());
+ }
+};
+
+INSTANTIATE_TEST_SUITE_P(ArenaString, SingleArena, testing::Bool());
+
+TEST_P(SingleArena, GetSet) {
+ auto arena = GetArena();
ArenaStringPtr field;
- const std::string* empty_default = &internal::GetEmptyString();
field.UnsafeSetDefault(empty_default);
- EXPECT_EQ(std::string(""), field.Get());
- field.Set(empty_default, WrapString("Test short"), NULL);
- EXPECT_EQ(std::string("Test short"), field.Get());
- field.Set(empty_default, WrapString("Test long long long long value"), NULL);
- EXPECT_EQ(std::string("Test long long long long value"), field.Get());
- field.Set(empty_default, std::string(""), NULL);
- field.Destroy(empty_default, NULL);
-
- ArenaStringPtr field2;
- field2.UnsafeSetDefault(empty_default);
- std::string* mut = field2.Mutable(EmptyDefault{}, NULL);
- EXPECT_EQ(mut, field2.Mutable(EmptyDefault{}, NULL));
- EXPECT_EQ(mut, &field2.Get());
- EXPECT_NE(empty_default, mut);
- EXPECT_EQ(std::string(""), *mut);
- *mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(std::string("Test long long long long value"), field2.Get());
- field2.Destroy(empty_default, NULL);
-
- ArenaStringPtr field3;
- field3.UnsafeSetDefault(nullptr);
- mut = field3.Mutable(nonempty_default, NULL);
- EXPECT_EQ(mut, field3.Mutable(nonempty_default, NULL));
- EXPECT_EQ(mut, &field3.Get());
- EXPECT_NE(nullptr, mut);
- EXPECT_EQ(std::string("default"), *mut);
- *mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(std::string("Test long long long long value"), field3.Get());
- field3.Destroy(nullptr, NULL);
+ EXPECT_EQ("", field.Get());
+ field.Set(empty_default, "Test short", arena.get());
+ EXPECT_EQ("Test short", field.Get());
+ field.Set(empty_default, "Test long long long long value", arena.get());
+ EXPECT_EQ("Test long long long long value", field.Get());
+ field.Set(empty_default, "", arena.get());
+ field.Destroy(empty_default, arena.get());
}
-TEST(ArenaStringPtrTest, ArenaStringPtrOnArena) {
- Arena arena;
+TEST_P(SingleArena, MutableAccessor) {
+ auto arena = GetArena();
ArenaStringPtr field;
const std::string* empty_default = &internal::GetEmptyString();
field.UnsafeSetDefault(empty_default);
- EXPECT_EQ(std::string(""), field.Get());
- field.Set(empty_default, WrapString("Test short"), &arena);
- EXPECT_EQ(std::string("Test short"), field.Get());
- field.Set(empty_default, WrapString("Test long long long long value"),
- &arena);
- EXPECT_EQ(std::string("Test long long long long value"), field.Get());
- field.Set(empty_default, std::string(""), &arena);
- field.Destroy(empty_default, &arena);
- ArenaStringPtr field2;
- field2.UnsafeSetDefault(empty_default);
- std::string* mut = field2.Mutable(EmptyDefault{}, &arena);
- EXPECT_EQ(mut, field2.Mutable(EmptyDefault{}, &arena));
- EXPECT_EQ(mut, &field2.Get());
+ std::string* mut = field.Mutable(EmptyDefault{}, arena.get());
+ EXPECT_EQ(mut, field.Mutable(EmptyDefault{}, arena.get()));
+ EXPECT_EQ(mut, &field.Get());
EXPECT_NE(empty_default, mut);
- EXPECT_EQ(std::string(""), *mut);
+ EXPECT_EQ("", *mut);
*mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(std::string("Test long long long long value"), field2.Get());
- field2.Destroy(empty_default, &arena);
-
- ArenaStringPtr field3;
- field3.UnsafeSetDefault(nullptr);
- mut = field3.Mutable(nonempty_default, &arena);
- EXPECT_EQ(mut, field3.Mutable(nonempty_default, &arena));
- EXPECT_EQ(mut, &field3.Get());
- EXPECT_NE(nullptr, mut);
- EXPECT_EQ(std::string("default"), *mut);
- *mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(std::string("Test long long long long value"), field3.Get());
- field3.Destroy(nullptr, &arena);
+ EXPECT_EQ("Test long long long long value", field.Get());
+ field.Destroy(empty_default, arena.get());
}
-TEST(ArenaStringPtrTest, ArenaStringPtrOnArenaNoSSO) {
- Arena arena;
+TEST_P(SingleArena, NullDefault) {
+ auto arena = GetArena();
+
ArenaStringPtr field;
- const std::string* empty_default = &internal::GetEmptyString();
- field.UnsafeSetDefault(empty_default);
- EXPECT_EQ(std::string(""), field.Get());
-
- // Avoid triggering the SSO optimization by setting the string to something
- // larger than the internal buffer.
- field.Set(empty_default, WrapString("Test long long long long value"),
- &arena);
- EXPECT_EQ(std::string("Test long long long long value"), field.Get());
- field.Set(empty_default, std::string(""), &arena);
- field.Destroy(empty_default, &arena);
-
- ArenaStringPtr field2;
- field2.UnsafeSetDefault(empty_default);
- std::string* mut = field2.Mutable(EmptyDefault{}, &arena);
- EXPECT_EQ(mut, field2.Mutable(EmptyDefault{}, &arena));
- EXPECT_EQ(mut, &field2.Get());
- EXPECT_NE(empty_default, mut);
- EXPECT_EQ(std::string(""), *mut);
- *mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(std::string("Test long long long long value"), field2.Get());
- field2.Destroy(empty_default, &arena);
-
- ArenaStringPtr field3;
- field3.UnsafeSetDefault(nullptr);
- mut = field3.Mutable(nonempty_default, &arena);
- EXPECT_EQ(mut, field3.Mutable(nonempty_default, &arena));
- EXPECT_EQ(mut, &field3.Get());
+ field.UnsafeSetDefault(nullptr);
+ std::string* mut = field.Mutable(nonempty_default, arena.get());
+ EXPECT_EQ(mut, field.Mutable(nonempty_default, arena.get()));
+ EXPECT_EQ(mut, &field.Get());
EXPECT_NE(nullptr, mut);
- EXPECT_EQ(std::string("default"), *mut);
+ EXPECT_EQ("default", *mut);
*mut = "Test long long long long value"; // ensure string allocates storage
- EXPECT_EQ(std::string("Test long long long long value"), field3.Get());
- field3.Destroy(nullptr, &arena);
+ EXPECT_EQ("Test long long long long value", field.Get());
+ field.Destroy(nullptr, arena.get());
+}
+
+class DualArena : public testing::TestWithParam<std::tuple<bool, bool>> {
+ public:
+ std::unique_ptr<Arena> GetLhsArena() {
+ if (std::get<0>(this->GetParam())) return nullptr;
+ return std::unique_ptr<Arena>(new Arena());
+ }
+ std::unique_ptr<Arena> GetRhsArena() {
+ if (std::get<1>(this->GetParam())) return nullptr;
+ return std::unique_ptr<Arena>(new Arena());
+ }
+};
+
+INSTANTIATE_TEST_SUITE_P(ArenaString, DualArena,
+ testing::Combine(testing::Bool(), testing::Bool()));
+
+TEST_P(DualArena, Swap) {
+ auto lhs_arena = GetLhsArena();
+ ArenaStringPtr lhs;
+ lhs.UnsafeSetDefault(empty_default);
+ ArenaStringPtr rhs;
+ rhs.UnsafeSetDefault(empty_default);
+
+ {
+ auto rhs_arena = GetRhsArena();
+ lhs.Set(empty_default, "lhs value that has some heft", lhs_arena.get());
+ rhs.Set(empty_default, "rhs value that has some heft", rhs_arena.get());
+ ArenaStringPtr::InternalSwap(empty_default, //
+ &lhs, lhs_arena.get(), //
+ &rhs, rhs_arena.get());
+ EXPECT_EQ("rhs value that has some heft", lhs.Get());
+ EXPECT_EQ("lhs value that has some heft", rhs.Get());
+ lhs.Destroy(empty_default, rhs_arena.get());
+ }
+ EXPECT_EQ("lhs value that has some heft", rhs.Get());
+ rhs.Destroy(empty_default, lhs_arena.get());
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_generator.cc b/src/google/protobuf/compiler/cpp/cpp_generator.cc
index 2c45ca8..a1cd06d 100644
--- a/src/google/protobuf/compiler/cpp/cpp_generator.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_generator.cc
@@ -108,6 +108,18 @@
file_options.table_driven_parsing = true;
} else if (options[i].first == "table_driven_serialization") {
file_options.table_driven_serialization = true;
+ } else if (options[i].first == "experimental_tail_call_table_mode") {
+ if (options[i].second == "never") {
+ file_options.tctable_mode = Options::kTCTableNever;
+ } else if (options[i].second == "guarded") {
+ file_options.tctable_mode = Options::kTCTableGuarded;
+ } else if (options[i].second == "always") {
+ file_options.tctable_mode = Options::kTCTableAlways;
+ } else {
+ *error = "Unknown value for experimental_tail_call_table_mode: " +
+ options[i].second;
+ return false;
+ }
} else {
*error = "Unknown generator option: " + options[i].first;
return false;
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index ceecb95..66f6359 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -206,10 +206,6 @@
(*variables)[type] = IntTypeName(options, type);
}
-bool HasInternalAccessors(const FieldOptions::CType ctype) {
- return ctype == FieldOptions::STRING || ctype == FieldOptions::CORD;
-}
-
} // namespace
void SetCommonVars(const Options& options,
@@ -652,28 +648,21 @@
}
}
-std::string Int64ToString(const std::string& macro_prefix, int64_t number) {
+static std::string Int64ToString(int64_t number) {
if (number == std::numeric_limits<int64_t>::min()) {
// This needs to be special-cased, see explanation here:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52661
- return StrCat(macro_prefix, "_LONGLONG(", number + 1, ") - 1");
+ return StrCat("int64_t{", number + 1, "} - 1");
}
- return StrCat(macro_prefix, "_LONGLONG(", number, ")");
+ return StrCat("int64_t{", number, "}");
}
-std::string UInt64ToString(const std::string& macro_prefix, uint64_t number) {
- return StrCat(macro_prefix, "_ULONGLONG(", number, ")");
+static std::string UInt64ToString(uint64_t number) {
+ return StrCat("uint64_t{", number, "u}");
}
std::string DefaultValue(const FieldDescriptor* field) {
- switch (field->cpp_type()) {
- case FieldDescriptor::CPPTYPE_INT64:
- return Int64ToString("GG", field->default_value_int64());
- case FieldDescriptor::CPPTYPE_UINT64:
- return UInt64ToString("GG", field->default_value_uint64());
- default:
- return DefaultValue(Options(), field);
- }
+ return DefaultValue(Options(), field);
}
std::string DefaultValue(const Options& options, const FieldDescriptor* field) {
@@ -683,9 +672,9 @@
case FieldDescriptor::CPPTYPE_UINT32:
return StrCat(field->default_value_uint32()) + "u";
case FieldDescriptor::CPPTYPE_INT64:
- return Int64ToString("PROTOBUF", field->default_value_int64());
+ return Int64ToString(field->default_value_int64());
case FieldDescriptor::CPPTYPE_UINT64:
- return UInt64ToString("PROTOBUF", field->default_value_uint64());
+ return UInt64ToString(field->default_value_uint64());
case FieldDescriptor::CPPTYPE_DOUBLE: {
double value = field->default_value_double();
if (value == std::numeric_limits<double>::infinity()) {
@@ -1026,13 +1015,13 @@
const Options& options) {
if (field->file()->syntax() == FileDescriptor::SYNTAX_PROTO3 &&
FieldEnforceUtf8(field, options)) {
- return STRICT;
+ return Utf8CheckMode::kStrict;
} else if (GetOptimizeFor(field->file(), options) !=
FileOptions::LITE_RUNTIME &&
FileUtf8Verification(field->file(), options)) {
- return VERIFY;
+ return Utf8CheckMode::kVerify;
} else {
- return NONE;
+ return Utf8CheckMode::kNone;
}
}
@@ -1043,7 +1032,7 @@
const char* verify_function,
const Formatter& format) {
switch (GetUtf8CheckMode(field, options)) {
- case STRICT: {
+ case Utf8CheckMode::kStrict: {
if (for_parse) {
format("DO_(");
}
@@ -1063,7 +1052,7 @@
format.Outdent();
break;
}
- case VERIFY: {
+ case Utf8CheckMode::kVerify: {
format("::$proto_ns$::internal::WireFormat::$1$(\n", verify_function);
format.Indent();
format(parameters);
@@ -1076,7 +1065,7 @@
format.Outdent();
break;
}
- case NONE:
+ case Utf8CheckMode::kNone:
break;
}
}
@@ -1349,523 +1338,6 @@
}
}
-class ParseLoopGenerator {
- public:
- ParseLoopGenerator(int num_hasbits, const Options& options,
- MessageSCCAnalyzer* scc_analyzer, io::Printer* printer)
- : scc_analyzer_(scc_analyzer),
- options_(options),
- format_(printer),
- num_hasbits_(num_hasbits) {}
-
- void GenerateParserLoop(const Descriptor* descriptor) {
- format_.Set("classname", ClassName(descriptor));
- format_.Set("p_ns", "::" + ProtobufNamespace(options_));
- format_.Set("pi_ns",
- StrCat("::", ProtobufNamespace(options_), "::internal"));
- format_.Set("GOOGLE_PROTOBUF", MacroPrefix(options_));
- std::map<std::string, std::string> vars;
- SetCommonVars(options_, &vars);
- SetUnknkownFieldsVariable(descriptor, options_, &vars);
- format_.AddMap(vars);
-
- std::vector<const FieldDescriptor*> ordered_fields;
- for (auto field : FieldRange(descriptor)) {
- if (!IsFieldStripped(field, options_)) {
- ordered_fields.push_back(field);
- }
- }
- std::sort(ordered_fields.begin(), ordered_fields.end(),
- [](const FieldDescriptor* a, const FieldDescriptor* b) {
- return a->number() < b->number();
- });
-
- format_(
- "const char* $classname$::_InternalParse(const char* ptr, "
- "$pi_ns$::ParseContext* ctx) {\n"
- "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure\n");
- format_.Indent();
- int hasbits_size = 0;
- if (num_hasbits_ > 0) {
- hasbits_size = (num_hasbits_ + 31) / 32;
- }
- // For now only optimize small hasbits.
- if (hasbits_size != 1) hasbits_size = 0;
- if (hasbits_size) {
- format_("_Internal::HasBits has_bits{};\n");
- format_.Set("has_bits", "has_bits");
- } else {
- format_.Set("has_bits", "_has_bits_");
- }
-
- GenerateParseLoop(descriptor, ordered_fields);
- format_.Outdent();
- format_("success:\n");
- if (hasbits_size) format_(" _has_bits_.Or(has_bits);\n");
-
- format_(
- " return ptr;\n"
- "failure:\n"
- " ptr = nullptr;\n"
- " goto success;\n"
- "#undef CHK_\n"
- "}\n");
- }
-
- private:
- MessageSCCAnalyzer* scc_analyzer_;
- const Options& options_;
- Formatter format_;
- int num_hasbits_;
-
- using WireFormat = internal::WireFormat;
- using WireFormatLite = internal::WireFormatLite;
-
- void GenerateArenaString(const FieldDescriptor* field) {
- if (HasHasbit(field)) {
- format_("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
- }
- std::string default_string =
- field->default_value_string().empty()
- ? "::" + ProtobufNamespace(options_) +
- "::internal::GetEmptyStringAlreadyInited()"
- : QualifiedClassName(field->containing_type(), options_) +
- "::" + MakeDefaultName(field) + ".get()";
- format_(
- "if (arena != nullptr) {\n"
- " ptr = ctx->ReadArenaString(ptr, &$1$_, arena);\n"
- "} else {\n"
- " ptr = "
- "$pi_ns$::InlineGreedyStringParser($1$_.MutableNoArenaNoDefault(&$2$"
- "), ptr, ctx);"
- "\n}\n"
- "const std::string* str = &$1$_.Get(); (void)str;\n",
- FieldName(field), default_string);
- }
-
- void GenerateStrings(const FieldDescriptor* field, bool check_utf8) {
- FieldOptions::CType ctype = FieldOptions::STRING;
- if (!options_.opensource_runtime) {
- // Open source doesn't support other ctypes;
- ctype = field->options().ctype();
- }
- if (!field->is_repeated() && !options_.opensource_runtime &&
- GetOptimizeFor(field->file(), options_) != FileOptions::LITE_RUNTIME &&
- // For now only use arena string for strings with empty defaults.
- field->default_value_string().empty() &&
- !field->real_containing_oneof() && ctype == FieldOptions::STRING) {
- GenerateArenaString(field);
- } else {
- std::string name;
- switch (ctype) {
- case FieldOptions::STRING:
- name = "GreedyStringParser";
- break;
- case FieldOptions::CORD:
- name = "CordParser";
- break;
- case FieldOptions::STRING_PIECE:
- name = "StringPieceParser";
- break;
- }
- format_(
- "auto str = $1$$2$_$3$();\n"
- "ptr = $pi_ns$::Inline$4$(str, ptr, ctx);\n",
- HasInternalAccessors(ctype) ? "_internal_" : "",
- field->is_repeated() && !field->is_packable() ? "add" : "mutable",
- FieldName(field), name);
- }
- if (!check_utf8) return; // return if this is a bytes field
- auto level = GetUtf8CheckMode(field, options_);
- switch (level) {
- case NONE:
- return;
- case VERIFY:
- format_("#ifndef NDEBUG\n");
- break;
- case STRICT:
- format_("CHK_(");
- break;
- }
- std::string field_name;
- field_name = "nullptr";
- if (HasDescriptorMethods(field->file(), options_)) {
- field_name = StrCat("\"", field->full_name(), "\"");
- }
- format_("$pi_ns$::VerifyUTF8(str, $1$)", field_name);
- switch (level) {
- case NONE:
- return;
- case VERIFY:
- format_(
- ";\n"
- "#endif // !NDEBUG\n");
- break;
- case STRICT:
- format_(");\n");
- break;
- }
- }
-
- void GenerateLengthDelim(const FieldDescriptor* field) {
- if (field->is_packable()) {
- std::string enum_validator;
- if (field->type() == FieldDescriptor::TYPE_ENUM &&
- !HasPreservingUnknownEnumSemantics(field)) {
- enum_validator =
- StrCat(", ", QualifiedClassName(field->enum_type(), options_),
- "_IsValid, &_internal_metadata_, ", field->number());
- format_(
- "ptr = "
- "$pi_ns$::Packed$1$Parser<$unknown_fields_type$>(_internal_mutable_"
- "$2$(), ptr, "
- "ctx$3$);\n",
- DeclaredTypeMethodName(field->type()), FieldName(field),
- enum_validator);
- } else {
- format_(
- "ptr = $pi_ns$::Packed$1$Parser(_internal_mutable_$2$(), ptr, "
- "ctx$3$);\n",
- DeclaredTypeMethodName(field->type()), FieldName(field),
- enum_validator);
- }
- } else {
- auto field_type = field->type();
- switch (field_type) {
- case FieldDescriptor::TYPE_STRING:
- GenerateStrings(field, true /* utf8 */);
- break;
- case FieldDescriptor::TYPE_BYTES:
- GenerateStrings(field, false /* utf8 */);
- break;
- case FieldDescriptor::TYPE_MESSAGE: {
- if (field->is_map()) {
- const FieldDescriptor* val =
- field->message_type()->FindFieldByName("value");
- GOOGLE_CHECK(val);
- if (val->type() == FieldDescriptor::TYPE_ENUM &&
- !HasPreservingUnknownEnumSemantics(field)) {
- format_(
- "auto object = "
- "::$proto_ns$::internal::InitEnumParseWrapper<$unknown_"
- "fields_type$>("
- "&$1$_, $2$_IsValid, $3$, &_internal_metadata_);\n"
- "ptr = ctx->ParseMessage(&object, ptr);\n",
- FieldName(field), QualifiedClassName(val->enum_type()),
- field->number());
- } else {
- format_("ptr = ctx->ParseMessage(&$1$_, ptr);\n",
- FieldName(field));
- }
- } else if (IsLazy(field, options_)) {
- if (field->real_containing_oneof()) {
- format_(
- "if (!_internal_has_$1$()) {\n"
- " clear_$2$();\n"
- " $2$_.$1$_ = ::$proto_ns$::Arena::CreateMessage<\n"
- " $pi_ns$::LazyField>(GetArena());\n"
- " set_has_$1$();\n"
- "}\n"
- "ptr = ctx->ParseMessage($2$_.$1$_, ptr);\n",
- FieldName(field), field->containing_oneof()->name());
- } else if (HasHasbit(field)) {
- format_(
- "_Internal::set_has_$1$(&$has_bits$);\n"
- "ptr = ctx->ParseMessage(&$1$_, ptr);\n",
- FieldName(field));
- } else {
- format_("ptr = ctx->ParseMessage(&$1$_, ptr);\n",
- FieldName(field));
- }
- } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
- if (!field->is_repeated()) {
- format_(
- "ptr = ctx->ParseMessage(_Internal::mutable_$1$(this), "
- "ptr);\n",
- FieldName(field));
- } else {
- format_(
- "ptr = ctx->ParseMessage($1$_.AddWeak(reinterpret_cast<const "
- "::$proto_ns$::MessageLite*>($2$::_$3$_default_instance_ptr_)"
- "), ptr);\n",
- FieldName(field), Namespace(field->message_type(), options_),
- ClassName(field->message_type()));
- }
- } else if (IsWeak(field, options_)) {
- format_(
- "{\n"
- " auto* default_ = &reinterpret_cast<const Message&>($1$);\n"
- " ptr = ctx->ParseMessage(_weak_field_map_.MutableMessage($2$,"
- " default_), ptr);\n"
- "}\n",
- QualifiedDefaultInstanceName(field->message_type(), options_),
- field->number());
- } else {
- format_("ptr = ctx->ParseMessage(_internal_$1$_$2$(), ptr);\n",
- field->is_repeated() ? "add" : "mutable", FieldName(field));
- }
- break;
- }
- default:
- GOOGLE_LOG(FATAL) << "Illegal combination for length delimited wiretype "
- << " filed type is " << field->type();
- }
- }
- }
-
- // Convert a 1 or 2 byte varint into the equivalent value upon a direct load.
- static uint32_t SmallVarintValue(uint32_t x) {
- GOOGLE_DCHECK(x < 128 * 128);
- if (x >= 128) x += (x & 0xFF80) + 128;
- return x;
- }
-
- static bool ShouldRepeat(const FieldDescriptor* descriptor,
- internal::WireFormatLite::WireType wiretype) {
- constexpr int kMaxTwoByteFieldNumber = 16 * 128;
- return descriptor->number() < kMaxTwoByteFieldNumber &&
- descriptor->is_repeated() &&
- (!descriptor->is_packable() ||
- wiretype != internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
- }
-
- void GenerateFieldBody(internal::WireFormatLite::WireType wiretype,
- const FieldDescriptor* field) {
- uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype);
- switch (wiretype) {
- case WireFormatLite::WIRETYPE_VARINT: {
- std::string type = PrimitiveTypeName(options_, field->cpp_type());
- std::string prefix = field->is_repeated() ? "add" : "set";
- if (field->type() == FieldDescriptor::TYPE_ENUM) {
- format_(
- "$uint64$ val = $pi_ns$::ReadVarint64(&ptr);\n"
- "CHK_(ptr);\n");
- if (!HasPreservingUnknownEnumSemantics(field)) {
- format_("if (PROTOBUF_PREDICT_TRUE($1$_IsValid(val))) {\n",
- QualifiedClassName(field->enum_type(), options_));
- format_.Indent();
- }
- format_("_internal_$1$_$2$(static_cast<$3$>(val));\n", prefix,
- FieldName(field),
- QualifiedClassName(field->enum_type(), options_));
- if (!HasPreservingUnknownEnumSemantics(field)) {
- format_.Outdent();
- format_(
- "} else {\n"
- " $pi_ns$::WriteVarint($1$, val, mutable_unknown_fields());\n"
- "}\n",
- field->number());
- }
- } else {
- std::string size = (field->type() == FieldDescriptor::TYPE_SINT32 ||
- field->type() == FieldDescriptor::TYPE_UINT32)
- ? "32"
- : "64";
- std::string zigzag;
- if ((field->type() == FieldDescriptor::TYPE_SINT32 ||
- field->type() == FieldDescriptor::TYPE_SINT64)) {
- zigzag = "ZigZag";
- }
- if (field->is_repeated() || field->real_containing_oneof()) {
- std::string prefix = field->is_repeated() ? "add" : "set";
- format_(
- "_internal_$1$_$2$($pi_ns$::ReadVarint$3$$4$(&ptr));\n"
- "CHK_(ptr);\n",
- prefix, FieldName(field), zigzag, size);
- } else {
- if (HasHasbit(field)) {
- format_("_Internal::set_has_$1$(&$has_bits$);\n",
- FieldName(field));
- }
- format_(
- "$1$_ = $pi_ns$::ReadVarint$2$$3$(&ptr);\n"
- "CHK_(ptr);\n",
- FieldName(field), zigzag, size);
- }
- }
- break;
- }
- case WireFormatLite::WIRETYPE_FIXED32:
- case WireFormatLite::WIRETYPE_FIXED64: {
- std::string type = PrimitiveTypeName(options_, field->cpp_type());
- if (field->is_repeated() || field->real_containing_oneof()) {
- std::string prefix = field->is_repeated() ? "add" : "set";
- format_(
- "_internal_$1$_$2$($pi_ns$::UnalignedLoad<$3$>(ptr));\n"
- "ptr += sizeof($3$);\n",
- prefix, FieldName(field), type);
- } else {
- if (HasHasbit(field)) {
- format_("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
- }
- format_(
- "$1$_ = $pi_ns$::UnalignedLoad<$2$>(ptr);\n"
- "ptr += sizeof($2$);\n",
- FieldName(field), type);
- }
- break;
- }
- case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: {
- GenerateLengthDelim(field);
- format_("CHK_(ptr);\n");
- break;
- }
- case WireFormatLite::WIRETYPE_START_GROUP: {
- format_(
- "ptr = ctx->ParseGroup(_internal_$1$_$2$(), ptr, $3$);\n"
- "CHK_(ptr);\n",
- field->is_repeated() ? "add" : "mutable", FieldName(field), tag);
- break;
- }
- case WireFormatLite::WIRETYPE_END_GROUP: {
- GOOGLE_LOG(FATAL) << "Can't have end group field\n";
- break;
- }
- } // switch (wire_type)
- }
-
- // Returns the tag for this field and in case of repeated packable fields,
- // sets a fallback tag in fallback_tag_ptr.
- static uint32_t ExpectedTag(const FieldDescriptor* field,
- uint32_t* fallback_tag_ptr) {
- uint32_t expected_tag;
- if (field->is_packable()) {
- auto expected_wiretype = WireFormat::WireTypeForFieldType(field->type());
- expected_tag =
- WireFormatLite::MakeTag(field->number(), expected_wiretype);
- GOOGLE_CHECK(expected_wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
- auto fallback_wiretype = WireFormatLite::WIRETYPE_LENGTH_DELIMITED;
- uint32_t fallback_tag =
- WireFormatLite::MakeTag(field->number(), fallback_wiretype);
-
- if (field->is_packed()) std::swap(expected_tag, fallback_tag);
- *fallback_tag_ptr = fallback_tag;
- } else {
- auto expected_wiretype = WireFormat::WireTypeForField(field);
- expected_tag =
- WireFormatLite::MakeTag(field->number(), expected_wiretype);
- }
- return expected_tag;
- }
-
- void GenerateParseLoop(
- const Descriptor* descriptor,
- const std::vector<const FieldDescriptor*>& ordered_fields) {
- format_(
- "while (!ctx->Done(&ptr)) {\n"
- " $uint32$ tag;\n"
- " ptr = $pi_ns$::ReadTag(ptr, &tag);\n");
- if (!ordered_fields.empty()) format_(" switch (tag >> 3) {\n");
-
- format_.Indent();
- format_.Indent();
-
- for (const auto* field : ordered_fields) {
- PrintFieldComment(format_, field);
- format_("case $1$:\n", field->number());
- format_.Indent();
- uint32_t fallback_tag = 0;
- uint32_t expected_tag = ExpectedTag(field, &fallback_tag);
- format_(
- "if (PROTOBUF_PREDICT_TRUE(static_cast<$uint8$>(tag) == $1$)) {\n",
- expected_tag & 0xFF);
- format_.Indent();
- auto wiretype = WireFormatLite::GetTagWireType(expected_tag);
- uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype);
- int tag_size = io::CodedOutputStream::VarintSize32(tag);
- bool is_repeat = ShouldRepeat(field, wiretype);
- if (is_repeat) {
- format_(
- "ptr -= $1$;\n"
- "do {\n"
- " ptr += $1$;\n",
- tag_size);
- format_.Indent();
- }
- GenerateFieldBody(wiretype, field);
- if (is_repeat) {
- format_.Outdent();
- format_(
- " if (!ctx->DataAvailable(ptr)) break;\n"
- "} while ($pi_ns$::ExpectTag<$1$>(ptr));\n",
- tag);
- }
- format_.Outdent();
- if (fallback_tag) {
- format_("} else if (static_cast<$uint8$>(tag) == $1$) {\n",
- fallback_tag & 0xFF);
- format_.Indent();
- GenerateFieldBody(WireFormatLite::GetTagWireType(fallback_tag), field);
- format_.Outdent();
- }
- format_.Outdent();
- format_(
- " } else goto handle_unusual;\n"
- " continue;\n");
- } // for loop over ordered fields
-
- // Default case
- if (!ordered_fields.empty()) format_("default: {\n");
- if (!ordered_fields.empty()) format_("handle_unusual:\n");
- format_(
- " if ((tag == 0) || ((tag & 7) == 4)) {\n"
- " CHK_(ptr);\n"
- " ctx->SetLastTag(tag);\n"
- " goto success;\n"
- " }\n");
- if (IsMapEntryMessage(descriptor)) {
- format_(" continue;\n");
- } else {
- if (descriptor->extension_range_count() > 0) {
- format_("if (");
- for (int i = 0; i < descriptor->extension_range_count(); i++) {
- const Descriptor::ExtensionRange* range =
- descriptor->extension_range(i);
- if (i > 0) format_(" ||\n ");
-
- uint32_t start_tag = WireFormatLite::MakeTag(
- range->start, static_cast<WireFormatLite::WireType>(0));
- uint32_t end_tag = WireFormatLite::MakeTag(
- range->end, static_cast<WireFormatLite::WireType>(0));
-
- if (range->end > FieldDescriptor::kMaxNumber) {
- format_("($1$u <= tag)", start_tag);
- } else {
- format_("($1$u <= tag && tag < $2$u)", start_tag, end_tag);
- }
- }
- format_(") {\n");
- format_(
- " ptr = _extensions_.ParseField(tag, ptr,\n"
- " internal_default_instance(), &_internal_metadata_, ctx);\n"
- " CHK_(ptr != nullptr);\n"
- " continue;\n"
- "}\n");
- }
- format_(
- " ptr = UnknownFieldParse(tag,\n"
- " _internal_metadata_.mutable_unknown_fields<$unknown_"
- "fields_type$>(),\n"
- " ptr, ctx);\n"
- " CHK_(ptr != nullptr);\n"
- " continue;\n");
- }
- if (!ordered_fields.empty()) format_("}\n"); // default case
- format_.Outdent();
- format_.Outdent();
- if (!ordered_fields.empty()) format_(" } // switch\n");
- format_("} // while\n");
- }
-};
-
-void GenerateParserLoop(const Descriptor* descriptor, int num_hasbits,
- const Options& options,
- MessageSCCAnalyzer* scc_analyzer,
- io::Printer* printer) {
- ParseLoopGenerator generator(num_hasbits, options, scc_analyzer, printer);
- generator.GenerateParserLoop(descriptor);
-}
-
static bool HasExtensionFromFile(const Message& msg, const FileDescriptor* file,
const Options& options,
bool* has_opt_codesize_extension) {
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h
index 43faf1c..e9c7b64 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.h
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h
@@ -59,7 +59,7 @@
namespace compiler {
namespace cpp {
-inline std::string ProtobufNamespace(const Options& options) {
+inline std::string ProtobufNamespace(const Options& /* options */) {
return "PROTOBUF_NAMESPACE_ID";
}
@@ -67,12 +67,12 @@
return options.opensource_runtime ? "GOOGLE_PROTOBUF" : "GOOGLE_PROTOBUF";
}
-inline std::string DeprecatedAttribute(const Options& options,
+inline std::string DeprecatedAttribute(const Options& /* options */,
const FieldDescriptor* d) {
return d->options().deprecated() ? "PROTOBUF_DEPRECATED " : "";
}
-inline std::string DeprecatedAttribute(const Options& options,
+inline std::string DeprecatedAttribute(const Options& /* options */,
const EnumValueDescriptor* d) {
return d->options().deprecated() ? "PROTOBUF_DEPRECATED_ENUM " : "";
}
@@ -220,9 +220,6 @@
// Return the code that evaluates to the number when compiled.
std::string Int32ToString(int number);
-// Return the code that evaluates to the number when compiled.
-std::string Int64ToString(const Options& options, int64_t number);
-
// Get code that evaluates to the field's default value.
std::string DefaultValue(const Options& options, const FieldDescriptor* field);
@@ -345,7 +342,7 @@
!options.opensource_runtime;
}
-inline bool IsFieldUsed(const FieldDescriptor* field, const Options& options) {
+inline bool IsFieldUsed(const FieldDescriptor* /* field */, const Options& /* options */) {
return true;
}
@@ -418,8 +415,8 @@
std::string UnderscoresToCamelCase(const std::string& input,
bool cap_next_letter);
-inline bool HasFieldPresence(const FileDescriptor* file) {
- return file->syntax() != FileDescriptor::SYNTAX_PROTO3;
+inline bool IsProto3(const FileDescriptor* file) {
+ return file->syntax() == FileDescriptor::SYNTAX_PROTO3;
}
inline bool HasHasbit(const FieldDescriptor* field) {
@@ -713,8 +710,8 @@
std::vector<int> path;
descriptor->GetLocationPath(&path);
GeneratedCodeInfo::Annotation annotation;
- for (int i = 0; i < path.size(); ++i) {
- annotation.add_path(path[i]);
+ for (int index: path) {
+ annotation.add_path(index);
}
annotation.set_source_file(descriptor->file()->name());
return annotation.SerializeAsString();
@@ -746,21 +743,21 @@
void ChangeTo(const std::string& name) {
std::vector<std::string> new_stack_ =
Split(name, "::", true);
- int len = std::min(name_stack_.size(), new_stack_.size());
- int common_idx = 0;
+ size_t len = std::min(name_stack_.size(), new_stack_.size());
+ size_t common_idx = 0;
while (common_idx < len) {
if (name_stack_[common_idx] != new_stack_[common_idx]) break;
common_idx++;
}
- for (int i = name_stack_.size() - 1; i >= common_idx; i--) {
- if (name_stack_[i] == "PROTOBUF_NAMESPACE_ID") {
+ for (auto it = name_stack_.crbegin(); it != name_stack_.crend() - common_idx; ++it) {
+ if (*it == "PROTOBUF_NAMESPACE_ID") {
printer_->Print("PROTOBUF_NAMESPACE_CLOSE\n");
} else {
- printer_->Print("} // namespace $ns$\n", "ns", name_stack_[i]);
+ printer_->Print("} // namespace $ns$\n", "ns", *it);
}
}
name_stack_.swap(new_stack_);
- for (int i = common_idx; i < name_stack_.size(); i++) {
+ for (size_t i = common_idx; i < name_stack_.size(); ++i) {
if (name_stack_[i] == "PROTOBUF_NAMESPACE_ID") {
printer_->Print("PROTOBUF_NAMESPACE_OPEN\n");
} else {
@@ -774,10 +771,10 @@
std::vector<std::string> name_stack_;
};
-enum Utf8CheckMode {
- STRICT = 0, // Parsing will fail if non UTF-8 data is in string fields.
- VERIFY = 1, // Only log an error but parsing will succeed.
- NONE = 2, // No UTF-8 check.
+enum class Utf8CheckMode {
+ kStrict = 0, // Parsing will fail if non UTF-8 data is in string fields.
+ kVerify = 1, // Only log an error but parsing will succeed.
+ kNone = 2, // No UTF-8 check.
};
Utf8CheckMode GetUtf8CheckMode(const FieldDescriptor* field,
@@ -865,10 +862,6 @@
inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; }
-void GenerateParserLoop(const Descriptor* descriptor, int num_hasbits,
- const Options& options,
- MessageSCCAnalyzer* scc_analyzer, io::Printer* printer);
-
PROTOC_EXPORT std::string StripProto(const std::string& filename);
} // namespace cpp
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index c9c30e0..4d735c3 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -157,7 +157,7 @@
void MapFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.Swap(&other->$name$_);\n");
+ format("$name$_.InternalSwap(&other->$name$_);\n");
}
void MapFieldGenerator::GenerateCopyConstructorCode(
@@ -229,7 +229,10 @@
if (utf8_check) {
format(
"struct Utf8Check {\n"
- " static void Check(ConstPtr p) {\n");
+ " static void Check(ConstPtr p) {\n"
+ // p may be unused when GetUtf8CheckMode evaluates to kNone,
+ // thus disabling the validation.
+ " (void)p;\n");
format.Indent();
format.Indent();
if (string_key) {
@@ -300,6 +303,19 @@
}
}
+bool MapFieldGenerator::GenerateArenaDestructorCode(
+ io::Printer* printer) const {
+ Formatter format(printer, variables_);
+ if (HasDescriptorMethods(descriptor_->file(), options_)) {
+ // _this is the object being destructed (we are inside a static method
+ // here).
+ format("_this->$name$_. ~MapField();\n");
+ return true;
+ } else {
+ return false;
+ }
+}
+
} // namespace cpp
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.h b/src/google/protobuf/compiler/cpp/cpp_map_field.h
index 149e8a3..33dec91 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.h
@@ -58,6 +58,7 @@
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const;
void GenerateByteSize(io::Printer* printer) const;
void GenerateConstinitInitializer(io::Printer* printer) const;
+ bool GenerateArenaDestructorCode(io::Printer* printer) const override;
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index e91a497..8e91103 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -48,6 +48,7 @@
#include <google/protobuf/compiler/cpp/cpp_field.h>
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_padding_optimizer.h>
+#include <google/protobuf/compiler/cpp/cpp_parse_function_generator.h>
#include <google/protobuf/descriptor.pb.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/printer.h>
@@ -214,7 +215,7 @@
// if non-zero (numeric) or non-empty (string).
if (!field->is_repeated() && !field->containing_oneof()) {
if (field->cpp_type() == FieldDescriptor::CPPTYPE_STRING) {
- format("if ($prefix$$name$().size() > 0) {\n");
+ format("if (!$prefix$$name$().empty()) {\n");
} else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
// Message fields still have has_$name$() methods.
format("if ($prefix$has_$name$()) {\n");
@@ -237,7 +238,7 @@
// Does the given field have a has_$name$() method?
bool HasHasMethod(const FieldDescriptor* field) {
- if (HasFieldPresence(field->file())) {
+ if (!IsProto3(field->file())) {
// In proto1/proto2, every field has a has_$name$() method.
return true;
}
@@ -276,7 +277,7 @@
bool HasPrivateHasMethod(const FieldDescriptor* field) {
// Only for oneofs in message types with no field presence. has_$name$(),
// based on the oneof case, is still useful internally for generated code.
- return (!HasFieldPresence(field->file()) && field->real_containing_oneof());
+ return IsProto3(field->file()) && field->real_containing_oneof();
}
// TODO(ckennelly): Cull these exclusions if/when these protos do not have
@@ -570,6 +571,7 @@
variables_["classtype"] = QualifiedClassName(descriptor_, options);
variables_["full_name"] = descriptor_->full_name();
variables_["superclass"] = SuperClassName(descriptor_, options_);
+ SetUnknkownFieldsVariable(descriptor_, options_, &variables_);
// Compute optimized field order to be used for layout and initialization
// purposes.
@@ -609,6 +611,8 @@
}
table_driven_ = TableDrivenParsingEnabled(descriptor_, options_);
+ parse_function_generator_.reset(new ParseFunctionGenerator(
+ descriptor_, max_has_bit_index_, options_, scc_analyzer_));
}
MessageGenerator::~MessageGenerator() = default;
@@ -985,9 +989,8 @@
void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
Formatter format(printer, variables_);
- format.Set("class_final", ShouldMarkClassAsFinal(descriptor_, options_)
- ? "PROTOBUF_FINAL"
- : "");
+ format.Set("class_final",
+ ShouldMarkClassAsFinal(descriptor_, options_) ? "final" : "");
if (IsMapEntryMessage(descriptor_)) {
std::map<std::string, std::string> vars;
@@ -1017,8 +1020,8 @@
"$classname$*>(&_$classname$_default_instance_); }\n");
auto utf8_check = GetUtf8CheckMode(descriptor_->field(0), options_);
if (descriptor_->field(0)->type() == FieldDescriptor::TYPE_STRING &&
- utf8_check != NONE) {
- if (utf8_check == STRICT) {
+ utf8_check != Utf8CheckMode::kNone) {
+ if (utf8_check == Utf8CheckMode::kStrict) {
format(
" static bool ValidateKey(std::string* s) {\n"
" return ::$proto_ns$::internal::WireFormatLite::"
@@ -1027,7 +1030,7 @@
" }\n",
descriptor_->field(0)->full_name());
} else {
- GOOGLE_CHECK_EQ(utf8_check, VERIFY);
+ GOOGLE_CHECK(utf8_check == Utf8CheckMode::kVerify);
format(
" static bool ValidateKey(std::string* s) {\n"
"#ifndef NDEBUG\n"
@@ -1046,8 +1049,8 @@
format(" static bool ValidateKey(void*) { return true; }\n");
}
if (descriptor_->field(1)->type() == FieldDescriptor::TYPE_STRING &&
- utf8_check != NONE) {
- if (utf8_check == STRICT) {
+ utf8_check != Utf8CheckMode::kNone) {
+ if (utf8_check == Utf8CheckMode::kStrict) {
format(
" static bool ValidateValue(std::string* s) {\n"
" return ::$proto_ns$::internal::WireFormatLite::"
@@ -1056,7 +1059,7 @@
" }\n",
descriptor_->field(1)->full_name());
} else {
- GOOGLE_CHECK_EQ(utf8_check, VERIFY);
+ GOOGLE_CHECK(utf8_check == Utf8CheckMode::kVerify);
format(
" static bool ValidateValue(std::string* s) {\n"
"#ifndef NDEBUG\n"
@@ -1108,8 +1111,9 @@
" return *this;\n"
"}\n"
"inline $classname$& operator=($classname$&& from) noexcept {\n"
- " if (GetArena() == from.GetArena()) {\n"
- " if (this != &from) InternalSwap(&from);\n"
+ " if (this == &from) return *this;\n"
+ " if (GetOwningArena() == from.GetOwningArena()) {\n"
+ " InternalSwap(&from);\n"
" } else {\n"
" CopyFrom(from);\n"
" }\n"
@@ -1125,9 +1129,6 @@
"\n");
}
- std::map<std::string, std::string> vars;
- SetUnknkownFieldsVariable(descriptor_, options_, &vars);
- format.AddMap(vars);
if (PublicUnknownFieldsAccessors(descriptor_)) {
format(
"inline const $unknown_fields_type$& unknown_fields() const {\n"
@@ -1273,7 +1274,7 @@
"}\n"
"inline void Swap($classname$* other) {\n"
" if (other == this) return;\n"
- " if (GetArena() == other->GetArena()) {\n"
+ " if (GetOwningArena() == other->GetOwningArena()) {\n"
" InternalSwap(other);\n"
" } else {\n"
" ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);\n"
@@ -1281,7 +1282,7 @@
"}\n"
"void UnsafeArenaSwap($classname$* other) {\n"
" if (other == this) return;\n"
- " $DCHK$(GetArena() == other->GetArena());\n"
+ " $DCHK$(GetOwningArena() == other->GetOwningArena());\n"
" InternalSwap(other);\n"
"}\n");
@@ -1290,7 +1291,7 @@
"// implements Message ----------------------------------------------\n"
"\n"
"inline $classname$* New() const final {\n"
- " return CreateMaybeMessage<$classname$>(nullptr);\n"
+ " return new $classname$();\n"
"}\n"
"\n"
"$classname$* New(::$proto_ns$::Arena* arena) const final {\n"
@@ -1323,9 +1324,11 @@
"PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear()$ clear_final$;\n"
"bool IsInitialized() const final;\n"
"\n"
- "size_t ByteSizeLong() const final;\n"
- "const char* _InternalParse(const char* ptr, "
- "::$proto_ns$::internal::ParseContext* ctx) final;\n"
+ "size_t ByteSizeLong() const final;\n");
+
+ parse_function_generator_->GenerateMethodDecls(printer);
+
+ format(
"$uint8$* _InternalSerialize(\n"
" $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) "
"const final;\n");
@@ -1340,8 +1343,8 @@
format(
"int GetCachedSize() const final { return _cached_size_.Get(); }"
"\n\nprivate:\n"
- "inline void SharedCtor();\n"
- "inline void SharedDtor();\n"
+ "void SharedCtor();\n"
+ "void SharedDtor();\n"
"void SetCachedSize(int size) const$ full_final$;\n"
"void InternalSwap($classname$* other);\n");
@@ -1981,7 +1984,7 @@
GenerateClear(printer);
format("\n");
- GenerateMergeFromCodedStream(printer);
+ parse_function_generator_->GenerateMethodImpls(printer);
format("\n");
GenerateSerializeWithCachedSizesToArray(printer);
@@ -2316,7 +2319,7 @@
format("void $classname$::SharedDtor() {\n");
format.Indent();
- format("$DCHK$(GetArena() == nullptr);\n");
+ format("$DCHK$(GetArenaForAllocation() == nullptr);\n");
// Write the destructors for each field except oneof members.
// optimized_order_ does not contain oneof fields.
for (auto field : optimized_order_) {
@@ -2896,15 +2899,13 @@
if (HasGeneratedMethods(descriptor_->file(), options_)) {
if (descriptor_->extension_range_count() > 0) {
- format("_extensions_.Swap(&other->_extensions_);\n");
+ format("_extensions_.InternalSwap(&other->_extensions_);\n");
}
std::map<std::string, std::string> vars;
SetUnknkownFieldsVariable(descriptor_, options_, &vars);
format.AddMap(vars);
- format(
- "_internal_metadata_.Swap<$unknown_fields_type$>(&other->_internal_"
- "metadata_);\n");
+ format("_internal_metadata_.InternalSwap(&other->_internal_metadata_);\n");
if (!has_bit_indices_.empty()) {
for (int i = 0; i < HasBitsSize(); ++i) {
@@ -3241,24 +3242,6 @@
format("}\n");
}
-void MessageGenerator::GenerateMergeFromCodedStream(io::Printer* printer) {
- std::map<std::string, std::string> vars = variables_;
- SetUnknkownFieldsVariable(descriptor_, options_, &vars);
- Formatter format(printer, vars);
- if (descriptor_->options().message_set_wire_format()) {
- // Special-case MessageSet.
- format(
- "const char* $classname$::_InternalParse(const char* ptr,\n"
- " ::$proto_ns$::internal::ParseContext* ctx) {\n"
- " return _extensions_.ParseMessageSet(ptr, \n"
- " internal_default_instance(), &_internal_metadata_, ctx);\n"
- "}\n");
- return;
- }
- GenerateParserLoop(descriptor_, max_has_bit_index_, options_, scc_analyzer_,
- printer);
-}
-
void MessageGenerator::GenerateSerializeOneofFields(
io::Printer* printer, const std::vector<const FieldDescriptor*>& fields) {
Formatter format(printer, variables_);
@@ -3410,7 +3393,7 @@
LazySerializerEmitter(MessageGenerator* mg, io::Printer* printer)
: mg_(mg),
format_(printer),
- eager_(!HasFieldPresence(mg->descriptor_->file())),
+ eager_(IsProto3(mg->descriptor_->file())),
cached_has_bit_index_(kNoHasbit) {}
~LazySerializerEmitter() { Flush(); }
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.h b/src/google/protobuf/compiler/cpp/cpp_message.h
index cb1d77c..339d6e7 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.h
+++ b/src/google/protobuf/compiler/cpp/cpp_message.h
@@ -44,6 +44,7 @@
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
#include <google/protobuf/compiler/cpp/cpp_message_layout_helper.h>
#include <google/protobuf/compiler/cpp/cpp_options.h>
+#include <google/protobuf/compiler/cpp/cpp_parse_function_generator.h>
namespace google {
namespace protobuf {
@@ -133,7 +134,6 @@
// Generate standard Message methods.
void GenerateClear(io::Printer* printer);
void GenerateOneofClear(io::Printer* printer);
- void GenerateMergeFromCodedStream(io::Printer* printer);
void GenerateSerializeWithCachedSizes(io::Printer* printer);
void GenerateSerializeWithCachedSizesToArray(io::Printer* printer);
void GenerateSerializeWithCachedSizesBody(io::Printer* printer);
@@ -204,6 +204,7 @@
bool table_driven_;
std::unique_ptr<MessageLayoutHelper> message_layout_helper_;
+ std::unique_ptr<ParseFunctionGenerator> parse_function_generator_;
MessageSCCAnalyzer* scc_analyzer_;
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
index 7bad24c..fc7aa4a 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -109,7 +109,8 @@
format(
"$deprecated_attr$const $type$& ${1$$name$$}$() const { "
"__builtin_trap(); }\n"
- "$deprecated_attr$$type$* ${1$$release_name$$}$() { "
+ "PROTOBUF_FUTURE_MUST_USE_RESULT $deprecated_attr$$type$* "
+ "${1$$release_name$$}$() { "
"__builtin_trap(); }\n"
"$deprecated_attr$$type$* ${1$mutable_$name$$}$() { "
"__builtin_trap(); }\n"
@@ -125,7 +126,8 @@
}
format(
"$deprecated_attr$const $type$& ${1$$name$$}$() const;\n"
- "$deprecated_attr$$type$* ${1$$release_name$$}$();\n"
+ "PROTOBUF_FUTURE_MUST_USE_RESULT $deprecated_attr$$type$* "
+ "${1$$release_name$$}$();\n"
"$deprecated_attr$$type$* ${1$mutable_$name$$}$();\n"
"$deprecated_attr$void ${1$set_allocated_$name$$}$"
"($type$* $name$);\n",
@@ -172,7 +174,7 @@
"$annotate_accessor$"
// If we're not on an arena, free whatever we were holding before.
// (If we are on arena, we can just forget the earlier pointer.)
- " if (GetArena() == nullptr) {\n"
+ " if (GetArenaForAllocation() == nullptr) {\n"
" delete reinterpret_cast<::$proto_ns$::MessageLite*>($name$_);\n"
" }\n");
if (implicit_weak_field_) {
@@ -197,7 +199,7 @@
" $clear_hasbit$\n"
" $type$* temp = $casted_member$;\n"
" $name$_ = nullptr;\n"
- " if (GetArena() != nullptr) {\n"
+ " if (GetArenaForAllocation() != nullptr) {\n"
" temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n"
" }\n"
" return temp;\n"
@@ -217,7 +219,7 @@
"$type_reference_function$"
" $set_hasbit$\n"
" if ($name$_ == nullptr) {\n"
- " auto* p = CreateMaybeMessage<$type$>(GetArena());\n");
+ " auto* p = CreateMaybeMessage<$type$>(GetArenaForAllocation());\n");
if (implicit_weak_field_) {
format(" $name$_ = reinterpret_cast<::$proto_ns$::MessageLite*>(p);\n");
} else {
@@ -238,7 +240,7 @@
format(
"inline void $classname$::set_allocated_$name$($type$* $name$) {\n"
"$annotate_accessor$"
- " ::$proto_ns$::Arena* message_arena = GetArena();\n");
+ " ::$proto_ns$::Arena* message_arena = GetArenaForAllocation();\n");
format(" if (message_arena == nullptr) {\n");
if (IsCrossFileMessage(descriptor_)) {
format(
@@ -254,12 +256,15 @@
// isn't defined in this file.
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " "
- "reinterpret_cast<::$proto_ns$::MessageLite*>($name$)->GetArena();\n");
+ " ::$proto_ns$::Arena::InternalHelper<\n"
+ " ::$proto_ns$::MessageLite>::GetOwningArena(\n"
+ " reinterpret_cast<::$proto_ns$::MessageLite*>("
+ "$name$));\n");
} else {
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " ::$proto_ns$::Arena::GetArena($name$);\n");
+ " ::$proto_ns$::Arena::InternalHelper<$type$>::GetOwningArena("
+ "$name$);\n");
}
format(
" if (message_arena != submessage_arena) {\n"
@@ -320,7 +325,7 @@
format(
"::$proto_ns$::MessageLite*\n"
"$classname$::_Internal::mutable_$name$($classname$* msg) {\n");
- if (HasFieldPresence(descriptor_->file())) {
+ if (HasHasbit(descriptor_)) {
format(" msg->$set_hasbit$\n");
}
format(
@@ -328,11 +333,12 @@
" if ($type_default_instance_ptr$ == nullptr) {\n"
" msg->$name$_ = ::$proto_ns$::Arena::CreateMessage<\n"
" ::$proto_ns$::internal::ImplicitWeakMessage>(\n"
- " msg->GetArena());\n"
+ " msg->GetArenaForAllocation());\n"
" } else {\n"
- " msg->$name$_ = reinterpret_cast<const "
- "::$proto_ns$::MessageLite*>(\n"
- " $type_default_instance_ptr$)->New(msg->GetArena());\n"
+ " msg->$name$_ = \n"
+ " reinterpret_cast<const ::$proto_ns$::MessageLite*>(\n"
+ " $type_default_instance_ptr$)->New(\n"
+ " msg->GetArenaForAllocation());\n"
" }\n"
" }\n"
" return msg->$name$_;\n"
@@ -353,11 +359,11 @@
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
- if (!HasFieldPresence(descriptor_->file())) {
+ if (!HasHasbit(descriptor_)) {
// If we don't have has-bits, message presence is indicated only by ptr !=
// NULL. Thus on clear, we need to delete the object.
format(
- "if (GetArena() == nullptr && $name$_ != nullptr) {\n"
+ "if (GetArenaForAllocation() == nullptr && $name$_ != nullptr) {\n"
" delete $name$_;\n"
"}\n"
"$name$_ = nullptr;\n");
@@ -371,11 +377,11 @@
GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
Formatter format(printer, variables_);
- if (!HasFieldPresence(descriptor_->file())) {
+ if (!HasHasbit(descriptor_)) {
// If we don't have has-bits, message presence is indicated only by ptr !=
// NULL. Thus on clear, we need to delete the object.
format(
- "if (GetArena() == nullptr && $name$_ != nullptr) {\n"
+ "if (GetArenaForAllocation() == nullptr && $name$_ != nullptr) {\n"
" delete $name$_;\n"
"}\n"
"$name$_ = nullptr;\n");
@@ -489,7 +495,7 @@
format(
"void $classname$::set_allocated_$name$($type$* $name$) {\n"
"$annotate_accessor$"
- " ::$proto_ns$::Arena* message_arena = GetArena();\n"
+ " ::$proto_ns$::Arena* message_arena = GetArenaForAllocation();\n"
" clear_$oneof_name$();\n"
" if ($name$) {\n");
if (descriptor_->file() != descriptor_->message_type()->file()) {
@@ -497,12 +503,15 @@
// isn't defined in this file.
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " "
- "reinterpret_cast<::$proto_ns$::MessageLite*>($name$)->GetArena();\n");
+ " ::$proto_ns$::Arena::InternalHelper<\n"
+ " ::$proto_ns$::MessageLite>::GetOwningArena(\n"
+ " reinterpret_cast<::$proto_ns$::MessageLite*>("
+ "$name$));\n");
} else {
format(
" ::$proto_ns$::Arena* submessage_arena =\n"
- " ::$proto_ns$::Arena::GetArena($name$);\n");
+ " ::$proto_ns$::Arena::InternalHelper<"
+ "$type$>::GetOwningArena($name$);\n");
}
format(
" if (message_arena != submessage_arena) {\n"
@@ -526,7 +535,7 @@
" if (_internal_has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
" $type$* temp = $field_member$;\n"
- " if (GetArena() != nullptr) {\n"
+ " if (GetArenaForAllocation() != nullptr) {\n"
" temp = ::$proto_ns$::internal::DuplicateIfNonNull(temp);\n"
" }\n"
" $field_member$ = nullptr;\n"
@@ -578,7 +587,8 @@
" if (!_internal_has_$name$()) {\n"
" clear_$oneof_name$();\n"
" set_has_$name$();\n"
- " $field_member$ = CreateMaybeMessage< $type$ >(GetArena());\n"
+ " $field_member$ = CreateMaybeMessage< $type$ "
+ ">(GetArenaForAllocation());\n"
" }\n"
" return $field_member$;\n"
"}\n"
@@ -595,7 +605,7 @@
Formatter format(printer, variables_);
format(
- "if (GetArena() == nullptr) {\n"
+ "if (GetArenaForAllocation() == nullptr) {\n"
" delete $field_member$;\n"
"}\n");
}
diff --git a/src/google/protobuf/compiler/cpp/cpp_options.h b/src/google/protobuf/compiler/cpp/cpp_options.h
index 92b5548..7aa3985 100644
--- a/src/google/protobuf/compiler/cpp/cpp_options.h
+++ b/src/google/protobuf/compiler/cpp/cpp_options.h
@@ -69,6 +69,11 @@
std::string annotation_pragma_name;
std::string annotation_guard_name;
const AccessInfoMap* access_info_map = nullptr;
+ enum {
+ kTCTableNever,
+ kTCTableGuarded,
+ kTCTableAlways
+ } tctable_mode = kTCTableNever;
};
} // namespace cpp
diff --git a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
new file mode 100644
index 0000000..5dc370c
--- /dev/null
+++ b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
@@ -0,0 +1,617 @@
+// 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 <google/protobuf/compiler/cpp/cpp_parse_function_generator.h>
+
+#include <google/protobuf/wire_format.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace cpp {
+
+namespace {
+using google::protobuf::internal::WireFormat;
+using google::protobuf::internal::WireFormatLite;
+
+std::vector<const FieldDescriptor*> GetOrderedFields(
+ const Descriptor* descriptor, const Options& options) {
+ std::vector<const FieldDescriptor*> ordered_fields;
+ for (auto field : FieldRange(descriptor)) {
+ if (!IsFieldStripped(field, options)) {
+ ordered_fields.push_back(field);
+ }
+ }
+ std::sort(ordered_fields.begin(), ordered_fields.end(),
+ [](const FieldDescriptor* a, const FieldDescriptor* b) {
+ return a->number() < b->number();
+ });
+ return ordered_fields;
+}
+
+bool HasInternalAccessors(const FieldOptions::CType ctype) {
+ return ctype == FieldOptions::STRING || ctype == FieldOptions::CORD;
+}
+
+bool IsTCTableEnabled(const Options& options) {
+ return options.tctable_mode == Options::kTCTableAlways;
+}
+bool IsTCTableGuarded(const Options& options) {
+ return options.tctable_mode == Options::kTCTableGuarded;
+}
+bool IsTCTableDisabled(const Options& options) {
+ return options.tctable_mode == Options::kTCTableNever;
+}
+
+} // namespace
+
+ParseFunctionGenerator::ParseFunctionGenerator(const Descriptor* descriptor,
+ int num_hasbits,
+ const Options& options,
+ MessageSCCAnalyzer* scc_analyzer)
+ : descriptor_(descriptor),
+ scc_analyzer_(scc_analyzer),
+ options_(options),
+ num_hasbits_(num_hasbits) {
+ SetCommonVars(options_, &variables_);
+ SetUnknkownFieldsVariable(descriptor_, options_, &variables_);
+ variables_["classname"] = ClassName(descriptor, false);
+}
+
+void ParseFunctionGenerator::GenerateMethodDecls(io::Printer* printer) {
+ Formatter format(printer, variables_);
+ if (IsTCTableGuarded(options_)) {
+ format.Outdent();
+ format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n");
+ format.Indent();
+ }
+ if (IsTCTableGuarded(options_) || IsTCTableEnabled(options_)) {
+ format.Outdent();
+ format("#error Tail Call Table parsing not yet implemented.\n");
+ format.Indent();
+ }
+ if (IsTCTableGuarded(options_)) {
+ format.Outdent();
+ format("#else\n");
+ format.Indent();
+ }
+ if (IsTCTableGuarded(options_) || IsTCTableDisabled(options_)) {
+ format(
+ "const char* _InternalParse(const char* ptr, "
+ "::$proto_ns$::internal::ParseContext* ctx) final;\n");
+ }
+ if (IsTCTableGuarded(options_)) {
+ format.Outdent();
+ format("#endif\n");
+ format.Indent();
+ }
+}
+
+void ParseFunctionGenerator::GenerateMethodImpls(io::Printer* printer) {
+ Formatter format(printer, variables_);
+ if (descriptor_->options().message_set_wire_format()) {
+ // Special-case MessageSet.
+ format(
+ "const char* $classname$::_InternalParse(const char* ptr,\n"
+ " ::$proto_ns$::internal::ParseContext* ctx) {\n"
+ " return _extensions_.ParseMessageSet(ptr, \n"
+ " internal_default_instance(), &_internal_metadata_, ctx);\n"
+ "}\n");
+ return;
+ }
+ if (IsTCTableGuarded(options_)) {
+ format("#ifdef PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n");
+ }
+ if (IsTCTableGuarded(options_) || IsTCTableEnabled(options_)) {
+ format("#error Tail Call Table parsing not yet implemented.\n");
+ }
+ if (IsTCTableGuarded(options_)) {
+ format("#else // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n");
+ }
+ if (IsTCTableGuarded(options_) || IsTCTableDisabled(options_)) {
+ GenerateLoopingParseFunction(format);
+ }
+ if (IsTCTableGuarded(options_)) {
+ format("#endif // PROTOBUF_TAIL_CALL_TABLE_PARSER_ENABLED\n");
+ }
+}
+
+void ParseFunctionGenerator::GenerateLoopingParseFunction(Formatter& format) {
+ format(
+ "const char* $classname$::_InternalParse(const char* ptr, "
+ "::$proto_ns$::internal::ParseContext* ctx) {\n"
+ "#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure\n");
+ format.Indent();
+ int hasbits_size = 0;
+ if (num_hasbits_ > 0) {
+ hasbits_size = (num_hasbits_ + 31) / 32;
+ }
+ // For now only optimize small hasbits.
+ if (hasbits_size != 1) hasbits_size = 0;
+ if (hasbits_size) {
+ format("_Internal::HasBits has_bits{};\n");
+ format.Set("has_bits", "has_bits");
+ } else {
+ format.Set("has_bits", "_has_bits_");
+ }
+ format.Set("continue", "continue");
+ format("while (!ctx->Done(&ptr)) {\n");
+ format.Indent();
+
+ GenerateParseIterationBody(format, descriptor_,
+ GetOrderedFields(descriptor_, options_));
+
+ format.Outdent();
+ format("} // while\n");
+
+ format.Outdent();
+ format("success:\n");
+ if (hasbits_size) format(" _has_bits_.Or(has_bits);\n");
+
+ format(
+ " return ptr;\n"
+ "failure:\n"
+ " ptr = nullptr;\n"
+ " goto success;\n"
+ "#undef CHK_\n"
+ "}\n");
+}
+
+void ParseFunctionGenerator::GenerateArenaString(Formatter& format,
+ const FieldDescriptor* field) {
+ if (HasHasbit(field)) {
+ format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
+ }
+ std::string default_string =
+ field->default_value_string().empty()
+ ? "::" + ProtobufNamespace(options_) +
+ "::internal::GetEmptyStringAlreadyInited()"
+ : QualifiedClassName(field->containing_type(), options_) +
+ "::" + MakeDefaultName(field) + ".get()";
+ format(
+ "if (arena != nullptr) {\n"
+ " ptr = ctx->ReadArenaString(ptr, &$1$_, arena);\n"
+ "} else {\n"
+ " ptr = ::$proto_ns$::internal::InlineGreedyStringParser("
+ "$1$_.MutableNoArenaNoDefault(&$2$), ptr, ctx);\n"
+ "}\n"
+ "const std::string* str = &$1$_.Get(); (void)str;\n",
+ FieldName(field), default_string);
+}
+
+void ParseFunctionGenerator::GenerateStrings(Formatter& format,
+ const FieldDescriptor* field,
+ bool check_utf8) {
+ FieldOptions::CType ctype = FieldOptions::STRING;
+ if (!options_.opensource_runtime) {
+ // Open source doesn't support other ctypes;
+ ctype = field->options().ctype();
+ }
+ if (!field->is_repeated() && !options_.opensource_runtime &&
+ GetOptimizeFor(field->file(), options_) != FileOptions::LITE_RUNTIME &&
+ // For now only use arena string for strings with empty defaults.
+ field->default_value_string().empty() &&
+ !field->real_containing_oneof() && ctype == FieldOptions::STRING) {
+ GenerateArenaString(format, field);
+ } else {
+ std::string name;
+ switch (ctype) {
+ case FieldOptions::STRING:
+ name = "GreedyStringParser";
+ break;
+ case FieldOptions::CORD:
+ name = "CordParser";
+ break;
+ case FieldOptions::STRING_PIECE:
+ name = "StringPieceParser";
+ break;
+ }
+ format(
+ "auto str = $1$$2$_$3$();\n"
+ "ptr = ::$proto_ns$::internal::Inline$4$(str, ptr, ctx);\n",
+ HasInternalAccessors(ctype) ? "_internal_" : "",
+ field->is_repeated() && !field->is_packable() ? "add" : "mutable",
+ FieldName(field), name);
+ }
+ if (!check_utf8) return; // return if this is a bytes field
+ auto level = GetUtf8CheckMode(field, options_);
+ switch (level) {
+ case Utf8CheckMode::kNone:
+ return;
+ case Utf8CheckMode::kVerify:
+ format("#ifndef NDEBUG\n");
+ break;
+ case Utf8CheckMode::kStrict:
+ format("CHK_(");
+ break;
+ }
+ std::string field_name;
+ field_name = "nullptr";
+ if (HasDescriptorMethods(field->file(), options_)) {
+ field_name = StrCat("\"", field->full_name(), "\"");
+ }
+ format("::$proto_ns$::internal::VerifyUTF8(str, $1$)", field_name);
+ switch (level) {
+ case Utf8CheckMode::kNone:
+ return;
+ case Utf8CheckMode::kVerify:
+ format(
+ ";\n"
+ "#endif // !NDEBUG\n");
+ break;
+ case Utf8CheckMode::kStrict:
+ format(");\n");
+ break;
+ }
+}
+
+void ParseFunctionGenerator::GenerateLengthDelim(Formatter& format,
+ const FieldDescriptor* field) {
+ if (field->is_packable()) {
+ std::string enum_validator;
+ if (field->type() == FieldDescriptor::TYPE_ENUM &&
+ !HasPreservingUnknownEnumSemantics(field)) {
+ enum_validator =
+ StrCat(", ", QualifiedClassName(field->enum_type(), options_),
+ "_IsValid, &_internal_metadata_, ", field->number());
+ format(
+ "ptr = "
+ "::$proto_ns$::internal::Packed$1$Parser<$unknown_fields_type$>("
+ "_internal_mutable_$2$(), ptr, ctx$3$);\n",
+ DeclaredTypeMethodName(field->type()), FieldName(field),
+ enum_validator);
+ } else {
+ format(
+ "ptr = ::$proto_ns$::internal::Packed$1$Parser("
+ "_internal_mutable_$2$(), ptr, ctx$3$);\n",
+ DeclaredTypeMethodName(field->type()), FieldName(field),
+ enum_validator);
+ }
+ } else {
+ auto field_type = field->type();
+ switch (field_type) {
+ case FieldDescriptor::TYPE_STRING:
+ GenerateStrings(format, field, true /* utf8 */);
+ break;
+ case FieldDescriptor::TYPE_BYTES:
+ GenerateStrings(format, field, false /* utf8 */);
+ break;
+ case FieldDescriptor::TYPE_MESSAGE: {
+ if (field->is_map()) {
+ const FieldDescriptor* val =
+ field->message_type()->FindFieldByName("value");
+ GOOGLE_CHECK(val);
+ if (val->type() == FieldDescriptor::TYPE_ENUM &&
+ !HasPreservingUnknownEnumSemantics(field)) {
+ format(
+ "auto object = "
+ "::$proto_ns$::internal::InitEnumParseWrapper<$unknown_"
+ "fields_type$>("
+ "&$1$_, $2$_IsValid, $3$, &_internal_metadata_);\n"
+ "ptr = ctx->ParseMessage(&object, ptr);\n",
+ FieldName(field), QualifiedClassName(val->enum_type()),
+ field->number());
+ } else {
+ format("ptr = ctx->ParseMessage(&$1$_, ptr);\n", FieldName(field));
+ }
+ } else if (IsLazy(field, options_)) {
+ if (field->real_containing_oneof()) {
+ format(
+ "if (!_internal_has_$1$()) {\n"
+ " clear_$2$();\n"
+ " $2$_.$1$_ = ::$proto_ns$::Arena::CreateMessage<\n"
+ " ::$proto_ns$::internal::LazyField>("
+ "GetArenaForAllocation());\n"
+ " set_has_$1$();\n"
+ "}\n"
+ "ptr = ctx->ParseMessage($2$_.$1$_, ptr);\n",
+ FieldName(field), field->containing_oneof()->name());
+ } else if (HasHasbit(field)) {
+ format(
+ "_Internal::set_has_$1$(&$has_bits$);\n"
+ "ptr = ctx->ParseMessage(&$1$_, ptr);\n",
+ FieldName(field));
+ } else {
+ format("ptr = ctx->ParseMessage(&$1$_, ptr);\n", FieldName(field));
+ }
+ } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
+ if (!field->is_repeated()) {
+ format(
+ "ptr = ctx->ParseMessage(_Internal::mutable_$1$(this), "
+ "ptr);\n",
+ FieldName(field));
+ } else {
+ format(
+ "ptr = ctx->ParseMessage($1$_.AddWeak(reinterpret_cast<const "
+ "::$proto_ns$::MessageLite*>($2$::_$3$_default_instance_ptr_)"
+ "), ptr);\n",
+ FieldName(field), Namespace(field->message_type(), options_),
+ ClassName(field->message_type()));
+ }
+ } else if (IsWeak(field, options_)) {
+ format(
+ "{\n"
+ " auto* default_ = &reinterpret_cast<const Message&>($1$);\n"
+ " ptr = ctx->ParseMessage(_weak_field_map_.MutableMessage($2$,"
+ " default_), ptr);\n"
+ "}\n",
+ QualifiedDefaultInstanceName(field->message_type(), options_),
+ field->number());
+ } else {
+ format("ptr = ctx->ParseMessage(_internal_$1$_$2$(), ptr);\n",
+ field->is_repeated() ? "add" : "mutable", FieldName(field));
+ }
+ break;
+ }
+ default:
+ GOOGLE_LOG(FATAL) << "Illegal combination for length delimited wiretype "
+ << " filed type is " << field->type();
+ }
+ }
+}
+
+static bool ShouldRepeat(const FieldDescriptor* descriptor,
+ WireFormatLite::WireType wiretype) {
+ constexpr int kMaxTwoByteFieldNumber = 16 * 128;
+ return descriptor->number() < kMaxTwoByteFieldNumber &&
+ descriptor->is_repeated() &&
+ (!descriptor->is_packable() ||
+ wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
+}
+
+void ParseFunctionGenerator::GenerateFieldBody(
+ Formatter& format, WireFormatLite::WireType wiretype,
+ const FieldDescriptor* field) {
+ uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype);
+ switch (wiretype) {
+ case WireFormatLite::WIRETYPE_VARINT: {
+ std::string type = PrimitiveTypeName(options_, field->cpp_type());
+ std::string prefix = field->is_repeated() ? "add" : "set";
+ if (field->type() == FieldDescriptor::TYPE_ENUM) {
+ format(
+ "$uint64$ val = ::$proto_ns$::internal::ReadVarint64(&ptr);\n"
+ "CHK_(ptr);\n");
+ if (!HasPreservingUnknownEnumSemantics(field)) {
+ format("if (PROTOBUF_PREDICT_TRUE($1$_IsValid(val))) {\n",
+ QualifiedClassName(field->enum_type(), options_));
+ format.Indent();
+ }
+ format("_internal_$1$_$2$(static_cast<$3$>(val));\n", prefix,
+ FieldName(field),
+ QualifiedClassName(field->enum_type(), options_));
+ if (!HasPreservingUnknownEnumSemantics(field)) {
+ format.Outdent();
+ format(
+ "} else {\n"
+ " ::$proto_ns$::internal::WriteVarint("
+ "$1$, val, mutable_unknown_fields());\n"
+ "}\n",
+ field->number());
+ }
+ } else {
+ std::string size = (field->type() == FieldDescriptor::TYPE_SINT32 ||
+ field->type() == FieldDescriptor::TYPE_UINT32)
+ ? "32"
+ : "64";
+ std::string zigzag;
+ if ((field->type() == FieldDescriptor::TYPE_SINT32 ||
+ field->type() == FieldDescriptor::TYPE_SINT64)) {
+ zigzag = "ZigZag";
+ }
+ if (field->is_repeated() || field->real_containing_oneof()) {
+ std::string prefix = field->is_repeated() ? "add" : "set";
+ format(
+ "_internal_$1$_$2$("
+ "::$proto_ns$::internal::ReadVarint$3$$4$(&ptr));\n"
+ "CHK_(ptr);\n",
+ prefix, FieldName(field), zigzag, size);
+ } else {
+ if (HasHasbit(field)) {
+ format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
+ }
+ format(
+ "$1$_ = ::$proto_ns$::internal::ReadVarint$2$$3$(&ptr);\n"
+ "CHK_(ptr);\n",
+ FieldName(field), zigzag, size);
+ }
+ }
+ break;
+ }
+ case WireFormatLite::WIRETYPE_FIXED32:
+ case WireFormatLite::WIRETYPE_FIXED64: {
+ std::string type = PrimitiveTypeName(options_, field->cpp_type());
+ if (field->is_repeated() || field->real_containing_oneof()) {
+ std::string prefix = field->is_repeated() ? "add" : "set";
+ format(
+ "_internal_$1$_$2$("
+ "::$proto_ns$::internal::UnalignedLoad<$3$>(ptr));\n"
+ "ptr += sizeof($3$);\n",
+ prefix, FieldName(field), type);
+ } else {
+ if (HasHasbit(field)) {
+ format("_Internal::set_has_$1$(&$has_bits$);\n", FieldName(field));
+ }
+ format(
+ "$1$_ = ::$proto_ns$::internal::UnalignedLoad<$2$>(ptr);\n"
+ "ptr += sizeof($2$);\n",
+ FieldName(field), type);
+ }
+ break;
+ }
+ case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: {
+ GenerateLengthDelim(format, field);
+ format("CHK_(ptr);\n");
+ break;
+ }
+ case WireFormatLite::WIRETYPE_START_GROUP: {
+ format(
+ "ptr = ctx->ParseGroup(_internal_$1$_$2$(), ptr, $3$);\n"
+ "CHK_(ptr);\n",
+ field->is_repeated() ? "add" : "mutable", FieldName(field), tag);
+ break;
+ }
+ case WireFormatLite::WIRETYPE_END_GROUP: {
+ GOOGLE_LOG(FATAL) << "Can't have end group field\n";
+ break;
+ }
+ } // switch (wire_type)
+}
+
+// Returns the tag for this field and in case of repeated packable fields,
+// sets a fallback tag in fallback_tag_ptr.
+static uint32_t ExpectedTag(const FieldDescriptor* field,
+ uint32_t* fallback_tag_ptr) {
+ uint32_t expected_tag;
+ if (field->is_packable()) {
+ auto expected_wiretype = WireFormat::WireTypeForFieldType(field->type());
+ expected_tag = WireFormatLite::MakeTag(field->number(), expected_wiretype);
+ GOOGLE_CHECK(expected_wiretype != WireFormatLite::WIRETYPE_LENGTH_DELIMITED);
+ auto fallback_wiretype = WireFormatLite::WIRETYPE_LENGTH_DELIMITED;
+ uint32_t fallback_tag =
+ WireFormatLite::MakeTag(field->number(), fallback_wiretype);
+
+ if (field->is_packed()) std::swap(expected_tag, fallback_tag);
+ *fallback_tag_ptr = fallback_tag;
+ } else {
+ auto expected_wiretype = WireFormat::WireTypeForField(field);
+ expected_tag = WireFormatLite::MakeTag(field->number(), expected_wiretype);
+ }
+ return expected_tag;
+}
+
+void ParseFunctionGenerator::GenerateParseIterationBody(
+ Formatter& format, const Descriptor* descriptor,
+ const std::vector<const FieldDescriptor*>& ordered_fields) {
+ format(
+ "$uint32$ tag;\n"
+ "ptr = ::$proto_ns$::internal::ReadTag(ptr, &tag);\n");
+ if (!ordered_fields.empty()) format("switch (tag >> 3) {\n");
+
+ format.Indent();
+
+ for (const auto* field : ordered_fields) {
+ PrintFieldComment(format, field);
+ format("case $1$:\n", field->number());
+ format.Indent();
+ uint32_t fallback_tag = 0;
+ uint32_t expected_tag = ExpectedTag(field, &fallback_tag);
+ format("if (PROTOBUF_PREDICT_TRUE(static_cast<$uint8$>(tag) == $1$)) {\n",
+ expected_tag & 0xFF);
+ format.Indent();
+ auto wiretype = WireFormatLite::GetTagWireType(expected_tag);
+ uint32_t tag = WireFormatLite::MakeTag(field->number(), wiretype);
+ int tag_size = io::CodedOutputStream::VarintSize32(tag);
+ bool is_repeat = ShouldRepeat(field, wiretype);
+ if (is_repeat) {
+ format(
+ "ptr -= $1$;\n"
+ "do {\n"
+ " ptr += $1$;\n",
+ tag_size);
+ format.Indent();
+ }
+ GenerateFieldBody(format, wiretype, field);
+ if (is_repeat) {
+ format.Outdent();
+ format(
+ " if (!ctx->DataAvailable(ptr)) break;\n"
+ "} while (::$proto_ns$::internal::ExpectTag<$1$>(ptr));\n",
+ tag);
+ }
+ format.Outdent();
+ if (fallback_tag) {
+ format("} else if (static_cast<$uint8$>(tag) == $1$) {\n",
+ fallback_tag & 0xFF);
+ format.Indent();
+ GenerateFieldBody(format, WireFormatLite::GetTagWireType(fallback_tag),
+ field);
+ format.Outdent();
+ }
+ format.Outdent();
+ format(
+ " } else goto handle_unusual;\n"
+ " $continue$;\n");
+ } // for loop over ordered fields
+
+ // Default case
+ if (!ordered_fields.empty()) format("default: {\n");
+ if (!ordered_fields.empty()) format("handle_unusual:\n");
+ format(
+ " if ((tag == 0) || ((tag & 7) == 4)) {\n"
+ " CHK_(ptr);\n"
+ " ctx->SetLastTag(tag);\n"
+ " goto success;\n"
+ " }\n");
+ if (IsMapEntryMessage(descriptor)) {
+ format(" $continue$;\n");
+ } else {
+ if (descriptor->extension_range_count() > 0) {
+ format("if (");
+ for (int i = 0; i < descriptor->extension_range_count(); i++) {
+ const Descriptor::ExtensionRange* range =
+ descriptor->extension_range(i);
+ if (i > 0) format(" ||\n ");
+
+ uint32_t start_tag = WireFormatLite::MakeTag(
+ range->start, static_cast<WireFormatLite::WireType>(0));
+ uint32_t end_tag = WireFormatLite::MakeTag(
+ range->end, static_cast<WireFormatLite::WireType>(0));
+
+ if (range->end > FieldDescriptor::kMaxNumber) {
+ format("($1$u <= tag)", start_tag);
+ } else {
+ format("($1$u <= tag && tag < $2$u)", start_tag, end_tag);
+ }
+ }
+ format(") {\n");
+ format(
+ " ptr = _extensions_.ParseField(tag, ptr,\n"
+ " internal_default_instance(), &_internal_metadata_, ctx);\n"
+ " CHK_(ptr != nullptr);\n"
+ " $continue$;\n"
+ "}\n");
+ }
+ format(
+ " ptr = UnknownFieldParse(tag,\n"
+ " _internal_metadata_.mutable_unknown_fields<$unknown_"
+ "fields_type$>(),\n"
+ " ptr, ctx);\n"
+ " CHK_(ptr != nullptr);\n"
+ " $continue$;\n");
+ }
+ if (!ordered_fields.empty()) format("}\n"); // default case
+ format.Outdent();
+ if (!ordered_fields.empty()) format("} // switch\n");
+}
+
+} // namespace cpp
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
diff --git a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
new file mode 100644
index 0000000..704af4a
--- /dev/null
+++ b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
@@ -0,0 +1,103 @@
+// 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.
+
+#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__
+#define GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <google/protobuf/compiler/cpp/cpp_helpers.h>
+#include <google/protobuf/compiler/cpp/cpp_options.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/wire_format_lite.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace cpp {
+
+// ParseFunctionGenerator generates the _InternalParse function for a message
+// (and any associated supporting members).
+class ParseFunctionGenerator {
+ public:
+ ParseFunctionGenerator(const Descriptor* descriptor, int num_hasbits,
+ const Options& options,
+ MessageSCCAnalyzer* scc_analyzer);
+
+ // Emits class-level method declarations to `printer`:
+ void GenerateMethodDecls(io::Printer* printer);
+
+ // Emits out-of-class method implementation definitions to `printer`:
+ void GenerateMethodImpls(io::Printer* printer);
+
+ private:
+ // Returns the proto runtime internal namespace.
+ std::string pi_ns();
+
+ // Generates a looping `_InternalParse` function.
+ void GenerateLoopingParseFunction(Formatter& format);
+
+ // Generates parsing code for an `ArenaString` field.
+ void GenerateArenaString(Formatter& format, const FieldDescriptor* field);
+
+ // Generates parsing code for a string-typed field.
+ void GenerateStrings(Formatter& format, const FieldDescriptor* field,
+ bool check_utf8);
+
+ // Generates parsing code for a length-delimited field (strings, messages,
+ // etc.).
+ void GenerateLengthDelim(Formatter& format, const FieldDescriptor* field);
+
+ // Generates the parsing code for a known field.
+ void GenerateFieldBody(Formatter& format,
+ google::protobuf::internal::WireFormatLite::WireType wiretype,
+ const FieldDescriptor* field);
+
+ // Generates code to parse the next field from the input stream.
+ void GenerateParseIterationBody(
+ Formatter& format, const Descriptor* descriptor,
+ const std::vector<const FieldDescriptor*>& ordered_fields);
+
+ const Descriptor* descriptor_;
+ MessageSCCAnalyzer* scc_analyzer_;
+ const Options& options_;
+ std::map<std::string, std::string> variables_;
+ int num_hasbits_;
+};
+
+} // namespace cpp
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
+
+#endif // GOOGLE_PROTOBUF_COMPILER_CPP_PARSE_FUNCTION_GENERATOR_H__
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index dc9d9b8..c68a090 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -162,14 +162,16 @@
descriptor_);
format(
"$deprecated_attr$std::string* ${1$mutable_$name$$}$();\n"
- "$deprecated_attr$std::string* ${1$$release_name$$}$();\n"
+ "PROTOBUF_FUTURE_MUST_USE_RESULT $deprecated_attr$std::string* "
+ "${1$$release_name$$}$();\n"
"$deprecated_attr$void ${1$set_allocated_$name$$}$(std::string* "
"$name$);\n",
descriptor_);
format(
"private:\n"
"const std::string& _internal_$name$() const;\n"
- "void _internal_set_$name$(const std::string& value);\n"
+ "inline PROTOBUF_ALWAYS_INLINE void "
+ "_internal_set_$name$(const std::string& value);\n"
"std::string* _internal_mutable_$name$();\n"
"public:\n");
@@ -196,12 +198,12 @@
" return _internal_$name$();\n"
"}\n"
"template <typename ArgT0, typename... ArgT>\n"
- "PROTOBUF_ALWAYS_INLINE\n"
- "inline void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
+ "inline PROTOBUF_ALWAYS_INLINE\n"
+ "void $classname$::set_$name$(ArgT0&& arg0, ArgT... args) {\n"
"$annotate_accessor$"
" $set_hasbit$\n"
" $name$_.$setter$($default_value_tag$, static_cast<ArgT0 &&>(arg0),"
- " args..., GetArena());\n"
+ " args..., GetArenaForAllocation());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline std::string* $classname$::mutable_$name$() {\n"
@@ -215,12 +217,13 @@
"inline void $classname$::_internal_set_$name$(const std::string& "
"value) {\n"
" $set_hasbit$\n"
- " $name$_.Set($default_value_tag$, value, GetArena());\n"
+ " $name$_.Set($default_value_tag$, value, GetArenaForAllocation());\n"
"}\n");
format(
"inline std::string* $classname$::_internal_mutable_$name$() {\n"
" $set_hasbit$\n"
- " return $name$_.Mutable($default_variable_or_tag$, GetArena());\n"
+ " return $name$_.Mutable($default_variable_or_tag$, "
+ "GetArenaForAllocation());\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
"$annotate_accessor$"
@@ -232,9 +235,11 @@
" return nullptr;\n"
" }\n"
" $clear_hasbit$\n"
- " return $name$_.ReleaseNonDefault($init_value$, GetArena());\n");
+ " return $name$_.ReleaseNonDefault($init_value$, "
+ "GetArenaForAllocation());\n");
} else {
- format(" return $name$_.Release($init_value$, GetArena());\n");
+ format(
+ " return $name$_.Release($init_value$, GetArenaForAllocation());\n");
}
format(
@@ -247,7 +252,7 @@
" $clear_hasbit$\n"
" }\n"
" $name$_.SetAllocated($init_value$, $name$,\n"
- " GetArena());\n"
+ " GetArenaForAllocation());\n"
" // @@protoc_insertion_point(field_set_allocated:$full_name$)\n"
"}\n");
}
@@ -268,7 +273,8 @@
if (descriptor_->default_value_string().empty()) {
format("$name$_.ClearToEmpty();\n");
} else {
- format("$name$_.ClearToDefault($lazy_variable$, GetArena());\n");
+ format(
+ "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n");
}
}
@@ -294,7 +300,8 @@
} else {
// Clear to a non-empty default is more involved, as we try to use the
// Arena if one is present and may need to reallocate the string.
- format("$name$_.ClearToDefault($lazy_variable$, GetArena());\n ");
+ format(
+ "$name$_.ClearToDefault($lazy_variable$, GetArenaForAllocation());\n ");
}
}
@@ -306,7 +313,12 @@
void StringFieldGenerator::GenerateSwappingCode(io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$name$_.Swap(&other->$name$_, $init_value$, GetArena());\n");
+ format(
+ "::$proto_ns$::internal::ArenaStringPtr::InternalSwap(\n"
+ " $init_value$,\n"
+ " &$name$_, GetArenaForAllocation(),\n"
+ " &other->$name$_, other->GetArenaForAllocation()\n"
+ ");\n");
}
void StringFieldGenerator::GenerateConstructorCode(io::Printer* printer) const {
@@ -330,7 +342,7 @@
// TODO(gpike): improve this
format(
"$name$_.Set($default_value_tag$, from._internal_$name$(), \n"
- " GetArena());\n");
+ " GetArenaForAllocation());\n");
format.Outdent();
format("}\n");
@@ -405,7 +417,7 @@
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" $field_member$.$setter$($default_value_tag$,"
- " static_cast<ArgT0 &&>(arg0), args..., GetArena());\n"
+ " static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());\n"
" // @@protoc_insertion_point(field_set:$full_name$)\n"
"}\n"
"inline std::string* $classname$::mutable_$name$() {\n"
@@ -426,7 +438,8 @@
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
- " $field_member$.Set($default_value_tag$, value, GetArena());\n"
+ " $field_member$.Set($default_value_tag$, value, "
+ "GetArenaForAllocation());\n"
"}\n");
format(
"inline std::string* $classname$::_internal_mutable_$name$() {\n"
@@ -436,14 +449,15 @@
" $field_member$.UnsafeSetDefault($init_value$);\n"
" }\n"
" return $field_member$.Mutable(\n"
- " $default_variable_or_tag$, GetArena());\n"
+ " $default_variable_or_tag$, GetArenaForAllocation());\n"
"}\n"
"inline std::string* $classname$::$release_name$() {\n"
"$annotate_accessor$"
" // @@protoc_insertion_point(field_release:$full_name$)\n"
" if (_internal_has_$name$()) {\n"
" clear_has_$oneof_name$();\n"
- " return $field_member$.ReleaseNonDefault($init_value$, GetArena());\n"
+ " return $field_member$.ReleaseNonDefault($init_value$, "
+ "GetArenaForAllocation());\n"
" } else {\n"
" return nullptr;\n"
" }\n"
@@ -456,7 +470,7 @@
" if ($name$ != nullptr) {\n"
" set_has_$name$();\n"
" $field_member$.UnsafeSetDefault($name$);\n"
- " ::$proto_ns$::Arena* arena = GetArena();\n"
+ " ::$proto_ns$::Arena* arena = GetArenaForAllocation();\n"
" if (arena != nullptr) {\n"
" arena->Own($name$);\n"
" }\n"
@@ -468,7 +482,9 @@
void StringOneofFieldGenerator::GenerateClearingCode(
io::Printer* printer) const {
Formatter format(printer, variables_);
- format("$field_member$.Destroy($default_value_tag$, GetArena());\n");
+ format(
+ "$field_member$.Destroy($default_value_tag$, "
+ "GetArenaForAllocation());\n");
}
void StringOneofFieldGenerator::GenerateMessageClearingCode(
diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.inc b/src/google/protobuf/compiler/cpp/cpp_unittest.inc
index a717f99..08206c2 100644
--- a/src/google/protobuf/compiler/cpp/cpp_unittest.inc
+++ b/src/google/protobuf/compiler/cpp/cpp_unittest.inc
@@ -205,9 +205,6 @@
TEST(GENERATED_MESSAGE_TEST_NAME, ExtremeSmallIntegerDefault) {
const UNITTEST::TestExtremeDefaultValues& extreme_default =
UNITTEST::TestExtremeDefaultValues::default_instance();
- EXPECT_EQ(~0x7fffffff, std::numeric_limits<int32_t>::min());
- EXPECT_EQ(PROTOBUF_LONGLONG(~0x7fffffffffffffff),
- std::numeric_limits<int64_t>::min());
EXPECT_EQ(std::numeric_limits<int32_t>::min(),
extreme_default.really_small_int32());
EXPECT_EQ(std::numeric_limits<int64_t>::min(),
diff --git a/src/google/protobuf/compiler/importer.h b/src/google/protobuf/compiler/importer.h
index db4a876..6cdae8a 100644
--- a/src/google/protobuf/compiler/importer.h
+++ b/src/google/protobuf/compiler/importer.h
@@ -202,8 +202,8 @@
virtual void AddError(const std::string& filename, int line, int column,
const std::string& message) = 0;
- virtual void AddWarning(const std::string& filename, int line, int column,
- const std::string& message) {}
+ virtual void AddWarning(const std::string& /* filename */, int /* line */, int /* column */,
+ const std::string& /* message */) {}
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MultiFileErrorCollector);
diff --git a/src/google/protobuf/compiler/java/java_enum_field.cc b/src/google/protobuf/compiler/java/java_enum_field.cc
index 9a0799e..e68eb77 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field.cc
@@ -63,6 +63,7 @@
(*variables)["type"] =
name_resolver->GetImmutableClassName(descriptor->enum_type());
+ (*variables)["kt_type"] = (*variables)["type"];
(*variables)["mutable_type"] =
name_resolver->GetMutableClassName(descriptor->enum_type());
(*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver);
@@ -76,6 +77,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["on_changed"] = "onChanged();";
// Use deprecated valueOf() method to be compatible with old generated code
// for v2.5.0/v2.6.1.
@@ -270,6 +276,34 @@
printer->Annotate("{", "}", descriptor_);
}
+void ImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ if (HasHazzer(descriptor_)) {
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+ }
+}
+
void ImmutableEnumFieldGenerator::GenerateFieldBuilderInitializationCode(
io::Printer* printer) const {
// noop for enums
@@ -1037,6 +1071,98 @@
"}\n");
}
+void RepeatedImmutableEnumFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: $kt_type$) {\n"
+ " add(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " addAll(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
std::string RepeatedImmutableEnumFieldGenerator::GetBoxedType() const {
return name_resolver_->GetImmutableClassName(descriptor_->enum_type());
}
diff --git a/src/google/protobuf/compiler/java/java_enum_field.h b/src/google/protobuf/compiler/java/java_enum_field.h
index 95c7db5..a8cd033 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.h
+++ b/src/google/protobuf/compiler/java/java_enum_field.h
@@ -80,6 +80,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -138,6 +139,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
index 8403f95..dd442fe 100644
--- a/src/google/protobuf/compiler/java/java_enum_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
@@ -70,6 +70,7 @@
(*variables)["type"] =
name_resolver->GetImmutableClassName(descriptor->enum_type());
+ (*variables)["kt_type"] = (*variables)["type"];
(*variables)["mutable_type"] =
name_resolver->GetMutableClassName(descriptor->enum_type());
(*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver);
@@ -83,6 +84,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["required"] = descriptor->is_required() ? "true" : "false";
if (HasHasbit(descriptor)) {
@@ -275,6 +281,34 @@
printer->Annotate("{", "}", descriptor_);
}
+void ImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ if (HasHazzer(descriptor_)) {
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+ }
+}
+
void ImmutableEnumFieldLiteGenerator::GenerateInitializationCode(
io::Printer* printer) const {
if (!IsDefaultValueJavaDefault(descriptor_)) {
@@ -774,6 +808,98 @@
printer->Print(variables_, "$name$_ = emptyIntList();\n");
}
+void RepeatedImmutableEnumFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: $kt_type$) {\n"
+ " add(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " addAll(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
std::string RepeatedImmutableEnumFieldLiteGenerator::GetBoxedType() const {
return name_resolver_->GetImmutableClassName(descriptor_->enum_type());
}
diff --git a/src/google/protobuf/compiler/java/java_enum_field_lite.h b/src/google/protobuf/compiler/java/java_enum_field_lite.h
index fbc1127..99249fe 100644
--- a/src/google/protobuf/compiler/java/java_enum_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_enum_field_lite.h
@@ -73,6 +73,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -118,6 +119,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_field.cc b/src/google/protobuf/compiler/java/java_field.cc
index 2f775a6..db5a332 100644
--- a/src/google/protobuf/compiler/java/java_field.cc
+++ b/src/google/protobuf/compiler/java/java_field.cc
@@ -258,6 +258,11 @@
// empty string.
(*variables)["{"] = "";
(*variables)["}"] = "";
+ (*variables)["kt_name"] =
+ IsForbiddenKotlin(info->name) ? info->name + "_" : info->name;
+ (*variables)["kt_capitalized_name"] = IsForbiddenKotlin(info->name)
+ ? info->capitalized_name + "_"
+ : info->capitalized_name;
}
void SetCommonOneofVariables(const FieldDescriptor* descriptor,
diff --git a/src/google/protobuf/compiler/java/java_field.h b/src/google/protobuf/compiler/java/java_field.h
index df6c38d..a7c995c 100644
--- a/src/google/protobuf/compiler/java/java_field.h
+++ b/src/google/protobuf/compiler/java/java_field.h
@@ -84,6 +84,7 @@
virtual void GenerateSerializedSizeCode(io::Printer* printer) const = 0;
virtual void GenerateFieldBuilderInitializationCode(
io::Printer* printer) const = 0;
+ virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0;
virtual void GenerateEqualsCode(io::Printer* printer) const = 0;
virtual void GenerateHashCode(io::Printer* printer) const = 0;
@@ -106,6 +107,7 @@
virtual void GenerateInitializationCode(io::Printer* printer) const = 0;
virtual void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const = 0;
+ virtual void GenerateKotlinDslMembers(io::Printer* printer) const = 0;
virtual std::string GetBoxedType() const = 0;
diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc
index 5cdb00d..e8801a1 100644
--- a/src/google/protobuf/compiler/java/java_file.cc
+++ b/src/google/protobuf/compiler/java/java_file.cc
@@ -675,6 +675,53 @@
}
}
+std::string FileGenerator::GetKotlinClassname() {
+ return name_resolver_->GetFileClassName(file_, immutable_api_, true);
+}
+
+void FileGenerator::GenerateKotlinSiblings(
+ const std::string& package_dir, GeneratorContext* context,
+ std::vector<std::string>* file_list,
+ std::vector<std::string>* annotation_list) {
+ for (int i = 0; i < file_->message_type_count(); i++) {
+ const Descriptor* descriptor = file_->message_type(i);
+ MessageGenerator* generator = message_generators_[i].get();
+ auto open_file = [context](const string& filename) {
+ return std::unique_ptr<io::ZeroCopyOutputStream>(context->Open(filename));
+ };
+ std::string filename = package_dir + descriptor->name() + "Kt.kt";
+ file_list->push_back(filename);
+ std::string info_full_path = filename + ".pb.meta";
+ GeneratedCodeInfo annotations;
+ io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
+ &annotations);
+ auto output = open_file(filename);
+ io::Printer printer(
+ output.get(), '$',
+ options_.annotate_code ? &annotation_collector : nullptr);
+
+ printer.Print(
+ "//Generated by the protocol buffer compiler. DO NOT EDIT!\n"
+ "// source: $filename$\n"
+ "\n",
+ "filename", descriptor->file()->name());
+ if (!java_package_.empty()) {
+ printer.Print(
+ "package $package$;\n"
+ "\n",
+ "package", java_package_);
+ }
+
+ generator->GenerateKotlinMembers(&printer);
+ generator->GenerateTopLevelKotlinMembers(&printer);
+
+ if (options_.annotate_code) {
+ auto info_output = open_file(info_full_path);
+ annotations.SerializeToZeroCopyStream(info_output.get());
+ annotation_list->push_back(info_full_path);
+ }
+ }
+}
bool FileGenerator::ShouldIncludeDependency(const FileDescriptor* descriptor,
bool immutable_api) {
diff --git a/src/google/protobuf/compiler/java/java_file.h b/src/google/protobuf/compiler/java/java_file.h
index 9f1f719..71ee3e8 100644
--- a/src/google/protobuf/compiler/java/java_file.h
+++ b/src/google/protobuf/compiler/java/java_file.h
@@ -78,6 +78,11 @@
void Generate(io::Printer* printer);
+ std::string GetKotlinClassname();
+ void GenerateKotlinSiblings(const std::string& package_dir,
+ GeneratorContext* generator_context,
+ std::vector<std::string>* file_list,
+ std::vector<std::string>* annotation_list);
// If we aren't putting everything into one file, this will write all the
// files other than the outer file (i.e. one for each message, enum, and
diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc
index e32b6e3..1020043 100644
--- a/src/google/protobuf/compiler/java/java_helpers.cc
+++ b/src/google/protobuf/compiler/java/java_helpers.cc
@@ -91,6 +91,17 @@
"transient", "try", "void", "volatile", "while",
});
+// Names that should be avoided as field names in Kotlin.
+// All Kotlin hard keywords are in this list.
+const std::unordered_set<std::string>* kKotlinForbiddenNames =
+ new std::unordered_set<std::string>({
+ "as", "as?", "break", "class", "continue", "do", "else",
+ "false", "for", "fun", "if", "in", "!in", "interface",
+ "is", "!is", "null", "object", "package", "return", "super",
+ "this", "throw", "true", "try", "typealias", "typeof", "val",
+ "var", "when", "while",
+ });
+
bool IsForbidden(const std::string& field_name) {
for (int i = 0; i < GOOGLE_ARRAYSIZE(kForbiddenWordList); ++i) {
if (field_name == kForbiddenWordList[i]) {
@@ -156,6 +167,38 @@
StrCat(enum_verifier_string, terminating_string).c_str());
}
+std::string ToCamelCase(const std::string& input, bool lower_first) {
+ bool capitalize_next = !lower_first;
+ std::string result;
+ result.reserve(input.size());
+
+ for (char i : input) {
+ if (i == '_') {
+ capitalize_next = true;
+ } else if (capitalize_next) {
+ result.push_back(ToUpperCh(i));
+ capitalize_next = false;
+ } else {
+ result.push_back(i);
+ }
+ }
+
+ // Lower-case the first letter.
+ if (lower_first && !result.empty()) {
+ result[0] = ToLowerCh(result[0]);
+ }
+
+ return result;
+}
+
+char ToUpperCh(char ch) {
+ return (ch >= 'a' && ch <= 'z') ? (ch - 'a' + 'A') : ch;
+}
+
+char ToLowerCh(char ch) {
+ return (ch >= 'A' && ch <= 'Z') ? (ch - 'A' + 'a') : ch;
+}
+
std::string UnderscoresToCamelCase(const std::string& input,
bool cap_next_letter) {
GOOGLE_CHECK(!input.empty());
@@ -217,6 +260,10 @@
return name;
}
+bool IsForbiddenKotlin(const std::string& field_name) {
+ return kKotlinForbiddenNames->find(field_name) !=
+ kKotlinForbiddenNames->end();
+}
std::string UniqueFileScopeIdentifier(const Descriptor* descriptor) {
return "static_" + StringReplace(descriptor->full_name(), ".", "_", true);
@@ -423,6 +470,35 @@
return BoxedPrimitiveTypeName(GetJavaType(descriptor));
}
+const char* KotlinTypeName(JavaType type) {
+ switch (type) {
+ case JAVATYPE_INT:
+ return "kotlin.Int";
+ case JAVATYPE_LONG:
+ return "kotlin.Long";
+ case JAVATYPE_FLOAT:
+ return "kotlin.Float";
+ case JAVATYPE_DOUBLE:
+ return "kotlin.Double";
+ case JAVATYPE_BOOLEAN:
+ return "kotlin.Boolean";
+ case JAVATYPE_STRING:
+ return "kotlin.String";
+ case JAVATYPE_BYTES:
+ return "com.google.protobuf.ByteString";
+ case JAVATYPE_ENUM:
+ return NULL;
+ case JAVATYPE_MESSAGE:
+ return NULL;
+
+ // No default because we want the compiler to complain if any new
+ // JavaTypes are added.
+ }
+
+ GOOGLE_LOG(FATAL) << "Can't get here.";
+ return NULL;
+}
+
std::string GetOneofStoredType(const FieldDescriptor* field) {
const JavaType javaType = GetJavaType(field);
diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h
index 5ede13c..13dd903 100644
--- a/src/google/protobuf/compiler/java/java_helpers.h
+++ b/src/google/protobuf/compiler/java/java_helpers.h
@@ -53,6 +53,7 @@
extern const char kThickSeparator[];
extern const char kThinSeparator[];
+bool IsForbiddenKotlin(const std::string& field_name);
// If annotation_file is non-empty, prints a javax.annotation.Generated
// annotation to the given Printer. annotation_file will be referenced in the
@@ -75,6 +76,13 @@
// Converts a name to camel-case. If cap_first_letter is true, capitalize the
// first letter.
+std::string ToCamelCase(const std::string& input, bool lower_first);
+
+char ToUpperCh(char ch);
+char ToLowerCh(char ch);
+
+// Converts a name to camel-case. If cap_first_letter is true, capitalize the
+// first letter.
std::string UnderscoresToCamelCase(const std::string& name,
bool cap_first_letter);
// Converts the field's name to camel-case, e.g. "foo_bar_baz" becomes
@@ -216,6 +224,9 @@
// types.
const char* BoxedPrimitiveTypeName(JavaType type);
+// Kotlin source does not distinguish between primitives and non-primitives,
+// but does use Kotlin-specific qualified types for them.
+const char* KotlinTypeName(JavaType type);
// Get the name of the java enum constant representing this type. E.g.,
// "INT32" for FieldDescriptor::TYPE_INT32. The enum constant's full
diff --git a/src/google/protobuf/compiler/java/java_kotlin_generator.cc b/src/google/protobuf/compiler/java/java_kotlin_generator.cc
new file mode 100644
index 0000000..5a5d198
--- /dev/null
+++ b/src/google/protobuf/compiler/java/java_kotlin_generator.cc
@@ -0,0 +1,130 @@
+#include <google/protobuf/compiler/java/java_kotlin_generator.h>
+
+#include <memory>
+
+#include <google/protobuf/compiler/java/java_file.h>
+#include <google/protobuf/compiler/java/java_helpers.h>
+#include <google/protobuf/compiler/java/java_options.h>
+
+#include <google/protobuf/stubs/strutil.h>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace java {
+
+KotlinGenerator::KotlinGenerator() {}
+KotlinGenerator::~KotlinGenerator() {}
+
+uint64_t KotlinGenerator::GetSupportedFeatures() const {
+ return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL;
+}
+
+bool KotlinGenerator::Generate(const FileDescriptor* file,
+ const std::string& parameter,
+ GeneratorContext* context,
+ std::string* error) const {
+ // -----------------------------------------------------------------
+ // parse generator options
+
+ std::vector<std::pair<std::string, std::string> > options;
+ ParseGeneratorParameter(parameter, &options);
+ Options file_options;
+
+ for (auto& option : options) {
+ if (option.first == "output_list_file") {
+ file_options.output_list_file = option.second;
+ } else if (option.first == "immutable") {
+ file_options.generate_immutable_code = true;
+ } else if (option.first == "mutable") {
+ *error = "Mutable not supported by Kotlin generator";
+ return false;
+ } else if (option.first == "shared") {
+ file_options.generate_shared_code = true;
+ } else if (option.first == "lite") {
+ file_options.enforce_lite = true;
+ } else if (option.first == "annotate_code") {
+ file_options.annotate_code = true;
+ } else if (option.first == "annotation_list_file") {
+ file_options.annotation_list_file = option.second;
+ } else {
+ *error = "Unknown generator option: " + option.first;
+ return false;
+ }
+ }
+
+ // By default we generate immutable code and shared code for immutable API.
+ if (!file_options.generate_immutable_code &&
+ !file_options.generate_shared_code) {
+ file_options.generate_immutable_code = true;
+ file_options.generate_shared_code = true;
+ }
+
+ std::vector<std::string> all_files;
+ std::vector<std::string> all_annotations;
+
+ std::unique_ptr<FileGenerator> file_generator(new FileGenerator(file, file_options, /* immutable_api = */ true));
+
+ if (!file_generator->Validate(error)) {
+ return false;
+ }
+
+ auto open_file = [context](const string& filename) {
+ return std::unique_ptr<io::ZeroCopyOutputStream>(context->Open(filename));
+ };
+ std::string package_dir = JavaPackageToDir(file_generator->java_package());
+ std::string kotlin_filename = package_dir;
+ kotlin_filename += file_generator->GetKotlinClassname();
+ kotlin_filename += ".kt";
+ all_files.push_back(kotlin_filename);
+ std::string info_full_path = kotlin_filename + ".pb.meta";
+ if (file_options.annotate_code) {
+ all_annotations.push_back(info_full_path);
+ }
+
+ // Generate main kotlin file.
+ auto output = open_file(kotlin_filename);
+ GeneratedCodeInfo annotations;
+ io::AnnotationProtoCollector<GeneratedCodeInfo> annotation_collector(
+ &annotations);
+ io::Printer printer(
+ output.get(), '$',
+ file_options.annotate_code ? &annotation_collector : nullptr);
+
+ file_generator->GenerateKotlinSiblings(package_dir, context, &all_files,
+ &all_annotations);
+
+ if (file_options.annotate_code) {
+ auto info_output = open_file(info_full_path);
+ annotations.SerializeToZeroCopyStream(info_output.get());
+ }
+
+ // Generate output list if requested.
+ if (!file_options.output_list_file.empty()) {
+ // Generate output list. This is just a simple text file placed in a
+ // deterministic location which lists the .kt files being generated.
+ auto srclist_raw_output = open_file(file_options.output_list_file);
+ io::Printer srclist_printer(srclist_raw_output.get(), '$');
+ for (auto& all_file : all_files) {
+ srclist_printer.Print("$filename$\n", "filename", all_file);
+ }
+ }
+
+ if (!file_options.annotation_list_file.empty()) {
+ // Generate output list. This is just a simple text file placed in a
+ // deterministic location which lists the .kt files being generated.
+ auto annotation_list_raw_output =
+ open_file(file_options.annotation_list_file);
+ io::Printer annotation_list_printer(annotation_list_raw_output.get(), '$');
+ for (auto& all_annotation : all_annotations) {
+ annotation_list_printer.Print("$filename$\n", "filename", all_annotation);
+ }
+ }
+
+ return true;
+}
+
+} // namespace java
+} // namespace compiler
+} //namespace protobuf
+} // namespace google
diff --git a/src/google/protobuf/compiler/java/java_kotlin_generator.h b/src/google/protobuf/compiler/java/java_kotlin_generator.h
new file mode 100644
index 0000000..db15353
--- /dev/null
+++ b/src/google/protobuf/compiler/java/java_kotlin_generator.h
@@ -0,0 +1,40 @@
+#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H_
+#define GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H_
+
+#include <string>
+#include <google/protobuf/compiler/code_generator.h>
+
+#include <google/protobuf/port_def.inc>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace java {
+
+// CodeGenerator implementation which generates Kotlin code. If you create your
+// own protocol compiler binary and you want it to support Kotlin output, you
+// can do so by registering an instance of this CodeGenerator with the
+// CommandLineInterface in your main() function.
+class PROTOC_EXPORT KotlinGenerator : public CodeGenerator {
+ public:
+ KotlinGenerator();
+ ~KotlinGenerator() override;
+
+ // implements CodeGenerator ----------------------------------------
+ bool Generate(const FileDescriptor* file, const std::string& parameter,
+ GeneratorContext* context, std::string* error) const override;
+
+ uint64_t GetSupportedFeatures() const override;
+
+ private:
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(KotlinGenerator);
+};
+
+} // namespace java
+} // namespace compiler
+} // namespace protobuf
+} // namespace google
+
+#include <google/protobuf/port_undef.inc>
+
+#endif // GOOGLE_PROTOBUF_COMPILER_JAVA_KOTLIN_GENERATOR_H_
diff --git a/src/google/protobuf/compiler/java/java_map_field.cc b/src/google/protobuf/compiler/java/java_map_field.cc
index 5db199d..a4ec2ff 100644
--- a/src/google/protobuf/compiler/java/java_map_field.cc
+++ b/src/google/protobuf/compiler/java/java_map_field.cc
@@ -69,6 +69,17 @@
}
}
+std::string KotlinTypeName(const FieldDescriptor* field,
+ ClassNameResolver* name_resolver) {
+ if (GetJavaType(field) == JAVATYPE_MESSAGE) {
+ return name_resolver->GetImmutableClassName(field->message_type());
+ } else if (GetJavaType(field) == JAVATYPE_ENUM) {
+ return name_resolver->GetImmutableClassName(field->enum_type());
+ } else {
+ return KotlinTypeName(GetJavaType(field));
+ }
+}
+
std::string WireType(const FieldDescriptor* field) {
return "com.google.protobuf.WireFormat.FieldType." +
std::string(FieldTypeName(field->type()));
@@ -91,6 +102,8 @@
(*variables)["key_type"] = TypeName(key, name_resolver, false);
std::string boxed_key_type = TypeName(key, name_resolver, true);
(*variables)["boxed_key_type"] = boxed_key_type;
+ (*variables)["kt_key_type"] = KotlinTypeName(key, name_resolver);
+ (*variables)["kt_value_type"] = KotlinTypeName(value, name_resolver);
// Used for calling the serialization function.
(*variables)["short_key_type"] =
boxed_key_type.substr(boxed_key_type.rfind('.') + 1);
@@ -136,6 +149,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["on_changed"] = "onChanged();";
// For repeated fields, one bit is used for whether the array is immutable
@@ -651,6 +669,87 @@
}
}
+void ImmutableMapFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " @JvmName(\"get$kt_capitalized_name$Map\")\n"
+ " get() = com.google.protobuf.kotlin.DslMap(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$Map$}$()\n"
+ " )\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@JvmName(\"put$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .put(key: $kt_key_type$, value: $kt_value_type$) {\n"
+ " $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"set$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .set(key: $kt_key_type$, value: $kt_value_type$) {\n"
+ " put(key, value)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"remove$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .remove(key: $kt_key_type$) {\n"
+ " $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"putAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) "
+ "{\n"
+ " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ " }\n");
+}
+
void ImmutableMapFieldGenerator::GenerateFieldBuilderInitializationCode(
io::Printer* printer) const {
// Nothing to initialize.
diff --git a/src/google/protobuf/compiler/java/java_map_field.h b/src/google/protobuf/compiler/java/java_map_field.h
index 2ff1f76..63b2577 100644
--- a/src/google/protobuf/compiler/java/java_map_field.h
+++ b/src/google/protobuf/compiler/java/java_map_field.h
@@ -62,6 +62,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_map_field_lite.cc b/src/google/protobuf/compiler/java/java_map_field_lite.cc
index 8db281d..023b4fc 100644
--- a/src/google/protobuf/compiler/java/java_map_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_map_field_lite.cc
@@ -71,6 +71,17 @@
}
}
+std::string KotlinTypeName(const FieldDescriptor* field,
+ ClassNameResolver* name_resolver) {
+ if (GetJavaType(field) == JAVATYPE_MESSAGE) {
+ return name_resolver->GetImmutableClassName(field->message_type());
+ } else if (GetJavaType(field) == JAVATYPE_ENUM) {
+ return name_resolver->GetImmutableClassName(field->enum_type());
+ } else {
+ return KotlinTypeName(GetJavaType(field));
+ }
+}
+
std::string WireType(const FieldDescriptor* field) {
return "com.google.protobuf.WireFormat.FieldType." +
std::string(FieldTypeName(field->type()));
@@ -92,6 +103,8 @@
(*variables)["key_type"] = TypeName(key, name_resolver, false);
(*variables)["boxed_key_type"] = TypeName(key, name_resolver, true);
+ (*variables)["kt_key_type"] = KotlinTypeName(key, name_resolver);
+ (*variables)["kt_value_type"] = KotlinTypeName(value, name_resolver);
(*variables)["key_wire_type"] = WireType(key);
(*variables)["key_default_value"] = DefaultValue(key, true, name_resolver);
// We use `x.getClass()` as a null check because it generates less bytecode
@@ -137,6 +150,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["default_entry"] =
(*variables)["capitalized_name"] + "DefaultEntryHolder.defaultEntry";
@@ -794,6 +812,87 @@
}
}
+void ImmutableMapFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " @JvmName(\"get$kt_capitalized_name$Map\")\n"
+ " get() = com.google.protobuf.kotlin.DslMap(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$Map$}$()\n"
+ " )\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@JvmName(\"put$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .put(key: $kt_key_type$, value: $kt_value_type$) {\n"
+ " $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"set$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .set(key: $kt_key_type$, value: $kt_value_type$) {\n"
+ " put(key, value)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"remove$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .remove(key: $kt_key_type$) {\n"
+ " $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"putAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) "
+ "{\n"
+ " $kt_dsl_builder$.${$putAll$capitalized_name$$}$(map)\n"
+ " }\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslMap"
+ "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " .clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ " }\n");
+}
+
void ImmutableMapFieldLiteGenerator::GenerateInitializationCode(
io::Printer* printer) const {
// Nothing to initialize.
diff --git a/src/google/protobuf/compiler/java/java_map_field_lite.h b/src/google/protobuf/compiler/java/java_map_field_lite.h
index 37aec06..62c162d 100644
--- a/src/google/protobuf/compiler/java/java_map_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_map_field_lite.h
@@ -55,6 +55,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc
index f2df25f..69528ec 100644
--- a/src/google/protobuf/compiler/java/java_message.cc
+++ b/src/google/protobuf/compiler/java/java_message.cc
@@ -211,9 +211,14 @@
" com.google.protobuf.GeneratedMessage$ver$.FieldAccessorTable\n"
" internal_$identifier$_fieldAccessorTable;\n");
+ // The following bytecode_estimate calculation logic must stay in sync with
+ // the similar logic in the GenerateFieldAccessorTableInitializer method below
+ // to make sure that the generated static final fields are initialized in the
+ // static initialization block directly.
+ //
// 6 bytes per field and oneof
*bytecode_estimate +=
- 10 + 6 * descriptor_->field_count() + 6 * oneofs_.size();
+ 10 + 6 * descriptor_->field_count() + 6 * descriptor_->oneof_decl_count();
}
int ImmutableMessageGenerator::GenerateFieldAccessorTableInitializer(
@@ -226,6 +231,10 @@
" new java.lang.String[] { ",
"identifier", UniqueFileScopeIdentifier(descriptor_), "ver",
GeneratedCodeVersionSuffix());
+ // All the bytecode_estimate calculation logic in this method must stay in
+ // sync with the similar logic in the GenerateFieldAccessorTable method
+ // above. See the corresponding comment in GenerateFieldAccessorTable for
+ // details.
for (int i = 0; i < descriptor_->field_count(); i++) {
const FieldDescriptor* field = descriptor_->field(i);
const FieldGeneratorInfo* info = context_->GetFieldGeneratorInfo(field);
@@ -1358,6 +1367,243 @@
}
}
+void ImmutableMessageGenerator::GenerateKotlinDsl(io::Printer* printer) const {
+ printer->Print(
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "@com.google.protobuf.kotlin.ProtoDslMarker\n");
+ printer->Print(
+ "class Dsl private constructor(\n"
+ " @kotlin.jvm.JvmField private val _builder: $message$.Builder\n"
+ ") {\n"
+ " companion object {\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " @kotlin.PublishedApi\n"
+ " internal fun _create(builder: $message$.Builder): Dsl = "
+ "Dsl(builder)\n"
+ " }\n"
+ "\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " @kotlin.PublishedApi\n"
+ " internal fun _build(): $message$ = _builder.build()\n",
+ "message", name_resolver_->GetClassName(descriptor_, true));
+
+ printer->Indent();
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ printer->Print("\n");
+ field_generators_.get(descriptor_->field(i))
+ .GenerateKotlinDslMembers(printer);
+ }
+
+ for (auto oneof : oneofs_) {
+ printer->Print(
+ "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
+ " @JvmName(\"get$oneof_capitalized_name$Case\")\n"
+ " get() = _builder.get$oneof_capitalized_name$Case()\n\n"
+ "fun clear$oneof_capitalized_name$() {\n"
+ " _builder.clear$oneof_capitalized_name$()\n"
+ "}\n",
+ "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name,
+ "oneof_capitalized_name",
+ context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "message",
+ name_resolver_->GetClassName(descriptor_, true));
+ }
+
+ if (descriptor_->extension_range_count() > 0) {
+ GenerateKotlinExtensions(printer);
+ }
+
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+void ImmutableMessageGenerator::GenerateKotlinMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> Unit): "
+ "$message$ "
+ "=\n"
+ " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() "
+ "}._build()\n",
+ "camelcase_name", name_resolver_->GetKotlinFactoryName(descriptor_),
+ "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_),
+ "message", name_resolver_->GetClassName(descriptor_, true));
+
+ printer->Print("object $name$Kt {\n", "name", descriptor_->name());
+ printer->Indent();
+ GenerateKotlinDsl(printer);
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ ImmutableMessageGenerator(descriptor_->nested_type(i), context_)
+ .GenerateKotlinMembers(printer);
+ }
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+void ImmutableMessageGenerator::GenerateTopLevelKotlinMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline fun $message$.copy(block: $message_kt$.Dsl.() -> Unit): "
+ "$message$ =\n"
+ " $message_kt$.Dsl._create(this.toBuilder()).apply { block() "
+ "}._build()\n",
+ "message", name_resolver_->GetClassName(descriptor_, true), "message_kt",
+ name_resolver_->GetKotlinExtensionsClassName(descriptor_));
+
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ ImmutableMessageGenerator(descriptor_->nested_type(i), context_)
+ .GenerateTopLevelKotlinMembers(printer);
+ }
+}
+
+void ImmutableMessageGenerator::GenerateKotlinExtensions(
+ io::Printer* printer) const {
+ std::string message_name = name_resolver_->GetClassName(descriptor_, true);
+
+ printer->Print(
+ "@Suppress(\"UNCHECKED_CAST\")\n"
+ "@kotlin.jvm.JvmSynthetic\n"
+ "operator fun <T> get(extension: "
+ "com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
+ " return if (extension.isRepeated) {\n"
+ " get(extension as com.google.protobuf.ExtensionLite<$message$, "
+ "List<*>>) as T\n"
+ " } else {\n"
+ " _builder.getExtension(extension)\n"
+ " }\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
+ "operator fun <E> get(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n"
+ "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n"
+ " return com.google.protobuf.kotlin.ExtensionList(extension, "
+ "_builder.getExtension(extension))\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "operator fun contains(extension: "
+ "com.google.protobuf.ExtensionLite<$message$, *>): "
+ "Boolean {\n"
+ " return _builder.hasExtension(extension)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "fun clear(extension: com.google.protobuf.ExtensionLite<$message$, *>) "
+ "{\n"
+ " _builder.clearExtension(extension)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.PublishedApi\n"
+ "internal fun <T> setExtension(extension: "
+ "com.google.protobuf.ExtensionLite<$message$, T>, "
+ "value: T) {\n"
+ " _builder.setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <T : Comparable<T>> set(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
+ " value: T\n"
+ ") {\n"
+ " setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun set(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, "
+ "com.google.protobuf.ByteString>,\n"
+ " value: com.google.protobuf.ByteString\n"
+ ") {\n"
+ " setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
+ " value: T\n"
+ ") {\n"
+ " setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.add(value: E) {\n"
+ " _builder.addExtension(this.extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.plusAssign"
+ "(value: E) {\n"
+ " add(value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.addAll(values: Iterable<E>) {\n"
+ " for (value in values) {\n"
+ " add(value)\n"
+ " }\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.plusAssign(values: "
+ "Iterable<E>) {\n"
+ " addAll(values)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.set(index: Int, value: "
+ "E) {\n"
+ " _builder.setExtension(this.extension, index, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline fun com.google.protobuf.kotlin.ExtensionList<*, "
+ "$message$>.clear() {\n"
+ " clear(extension)\n"
+ "}\n\n",
+ "message", message_name);
+}
+
void ImmutableMessageGenerator::GenerateAnyMethods(io::Printer* printer) {
printer->Print(
"private static String getTypeUrl(\n"
diff --git a/src/google/protobuf/compiler/java/java_message.h b/src/google/protobuf/compiler/java/java_message.h
index 87b9df5..50d7180 100644
--- a/src/google/protobuf/compiler/java/java_message.h
+++ b/src/google/protobuf/compiler/java/java_message.h
@@ -85,6 +85,9 @@
// Generate code to register all contained extensions with an
// ExtensionRegistry.
virtual void GenerateExtensionRegistrationCode(io::Printer* printer) = 0;
+ virtual void GenerateKotlinDsl(io::Printer* printer) const = 0;
+ virtual void GenerateKotlinMembers(io::Printer* printer) const = 0;
+ virtual void GenerateTopLevelKotlinMembers(io::Printer* printer) const = 0;
protected:
const Descriptor* descriptor_;
@@ -107,6 +110,9 @@
// Returns an estimate of the number of bytes the printed code will compile to
virtual int GenerateStaticVariableInitializers(io::Printer* printer);
+ void GenerateKotlinDsl(io::Printer* printer) const override;
+ void GenerateKotlinMembers(io::Printer* printer) const override;
+ void GenerateTopLevelKotlinMembers(io::Printer* printer) const override;
private:
void GenerateFieldAccessorTable(io::Printer* printer, int* bytecode_estimate);
@@ -128,6 +134,7 @@
void GenerateEqualsAndHashCode(io::Printer* printer);
void GenerateParser(io::Printer* printer);
void GenerateParsingConstructor(io::Printer* printer);
+ void GenerateKotlinExtensions(io::Printer* printer) const;
void GenerateAnyMethods(io::Printer* printer);
Context* context_;
diff --git a/src/google/protobuf/compiler/java/java_message_field.cc b/src/google/protobuf/compiler/java/java_message_field.cc
index f657c17..a6d5dfe 100644
--- a/src/google/protobuf/compiler/java/java_message_field.cc
+++ b/src/google/protobuf/compiler/java/java_message_field.cc
@@ -60,6 +60,7 @@
(*variables)["type"] =
name_resolver->GetImmutableClassName(descriptor->message_type());
+ (*variables)["kt_type"] = (*variables)["type"];
(*variables)["mutable_type"] =
name_resolver->GetMutableClassName(descriptor->message_type());
(*variables)["group_or_message"] =
@@ -69,6 +70,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["on_changed"] = "onChanged();";
(*variables)["ver"] = GeneratedCodeVersionSuffix();
(*variables)["get_parser"] =
@@ -407,6 +413,32 @@
"}\n");
}
+void ImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+}
+
void ImmutableMessageFieldGenerator::GenerateFieldBuilderInitializationCode(
io::Printer* printer) const {
if (HasHasbit(descriptor_)) {
@@ -1361,6 +1393,98 @@
return name_resolver_->GetImmutableClassName(descriptor_->message_type());
}
+void RepeatedImmutableMessageFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: $kt_type$) {\n"
+ " add(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " addAll(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
} // namespace java
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/java/java_message_field.h b/src/google/protobuf/compiler/java/java_message_field.h
index 36fa492..08c5e91 100644
--- a/src/google/protobuf/compiler/java/java_message_field.h
+++ b/src/google/protobuf/compiler/java/java_message_field.h
@@ -81,6 +81,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -146,6 +147,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_message_field_lite.cc b/src/google/protobuf/compiler/java/java_message_field_lite.cc
index 73f1bcf..adb91a3 100644
--- a/src/google/protobuf/compiler/java/java_message_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_field_lite.cc
@@ -61,6 +61,7 @@
(*variables)["type"] =
name_resolver->GetImmutableClassName(descriptor->message_type());
+ (*variables)["kt_type"] = (*variables)["type"];
(*variables)["mutable_type"] =
name_resolver->GetMutableClassName(descriptor->message_type());
(*variables)["group_or_message"] =
@@ -70,6 +71,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["required"] = descriptor->is_required() ? "true" : "false";
if (HasHasbit(descriptor)) {
@@ -277,6 +283,32 @@
printer->Annotate("{", "}", descriptor_);
}
+void ImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+}
+
void ImmutableMessageFieldLiteGenerator::GenerateFieldInfo(
io::Printer* printer, std::vector<uint16_t>* output) const {
WriteIntToUtf16CharSequence(descriptor_->number(), output);
@@ -751,6 +783,98 @@
return name_resolver_->GetImmutableClassName(descriptor_->message_type());
}
+void RepeatedImmutableMessageFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: $kt_type$) {\n"
+ " add(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " addAll(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
} // namespace java
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/java/java_message_field_lite.h b/src/google/protobuf/compiler/java/java_message_field_lite.h
index 8b935e6..af0129c 100644
--- a/src/google/protobuf/compiler/java/java_message_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_message_field_lite.h
@@ -73,6 +73,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -118,6 +119,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index cae9963..74ce6d6 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -724,6 +724,242 @@
}
}
+void ImmutableMessageLiteGenerator::GenerateKotlinDsl(
+ io::Printer* printer) const {
+ printer->Print(
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "@com.google.protobuf.kotlin.ProtoDslMarker\n");
+ printer->Print(
+ "class Dsl private constructor(\n"
+ " @kotlin.jvm.JvmField private val _builder: $message$.Builder\n"
+ ") {\n"
+ " companion object {\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " @kotlin.PublishedApi\n"
+ " internal fun _create(builder: $message$.Builder): Dsl = "
+ "Dsl(builder)\n"
+ " }\n"
+ "\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " @kotlin.PublishedApi\n"
+ " internal fun _build(): $message$ = _builder.build()\n",
+ "message", name_resolver_->GetClassName(descriptor_, true));
+
+ printer->Indent();
+
+ for (int i = 0; i < descriptor_->field_count(); i++) {
+ printer->Print("\n");
+ field_generators_.get(descriptor_->field(i))
+ .GenerateKotlinDslMembers(printer);
+ }
+
+ for (auto oneof : oneofs_) {
+ printer->Print(
+ "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
+ " @JvmName(\"get$oneof_capitalized_name$Case\")\n"
+ " get() = _builder.get$oneof_capitalized_name$Case()\n\n"
+ "fun clear$oneof_capitalized_name$() {\n"
+ " _builder.clear$oneof_capitalized_name$()\n"
+ "}\n",
+ "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name,
+ "oneof_capitalized_name",
+ context_->GetOneofGeneratorInfo(oneof)->capitalized_name, "message",
+ name_resolver_->GetClassName(descriptor_, true));
+ }
+
+ if (descriptor_->extension_range_count() > 0) {
+ GenerateKotlinExtensions(printer);
+ }
+
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+void ImmutableMessageLiteGenerator::GenerateKotlinMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> Unit): "
+ "$message$ =\n"
+ " $message_kt$.Dsl._create($message$.newBuilder()).apply { block() "
+ "}._build()\n",
+ "camelcase_name", name_resolver_->GetKotlinFactoryName(descriptor_),
+ "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_),
+ "message", name_resolver_->GetClassName(descriptor_, true));
+
+ printer->Print("object $name$Kt {\n", "name", descriptor_->name());
+ printer->Indent();
+ GenerateKotlinDsl(printer);
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_)
+ .GenerateKotlinMembers(printer);
+ }
+ printer->Outdent();
+ printer->Print("}\n");
+}
+
+void ImmutableMessageLiteGenerator::GenerateTopLevelKotlinMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ "inline fun $message$.copy(block: $message_kt$.Dsl.() -> Unit): "
+ "$message$ =\n"
+ " $message_kt$.Dsl._create(this.toBuilder()).apply { block() "
+ "}._build()\n",
+ "message", name_resolver_->GetClassName(descriptor_, true), "message_kt",
+ name_resolver_->GetKotlinExtensionsClassName(descriptor_));
+
+ for (int i = 0; i < descriptor_->nested_type_count(); i++) {
+ if (IsMapEntry(descriptor_->nested_type(i))) continue;
+ ImmutableMessageLiteGenerator(descriptor_->nested_type(i), context_)
+ .GenerateTopLevelKotlinMembers(printer);
+ }
+}
+
+void ImmutableMessageLiteGenerator::GenerateKotlinExtensions(
+ io::Printer* printer) const {
+ std::string message_name = name_resolver_->GetClassName(descriptor_, true);
+
+ printer->Print(
+ "@Suppress(\"UNCHECKED_CAST\")\n"
+ "@kotlin.jvm.JvmSynthetic\n"
+ "operator fun <T> get(extension: "
+ "com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
+ " return if (extension.isRepeated) {\n"
+ " get(extension as com.google.protobuf.ExtensionLite<$message$, "
+ "List<*>>) as T\n"
+ " } else {\n"
+ " _builder.getExtension(extension)\n"
+ " }\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
+ "operator fun <E> get(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n"
+ "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n"
+ " return com.google.protobuf.kotlin.ExtensionList(extension, "
+ "_builder.getExtension(extension))\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "operator fun contains(extension: "
+ "com.google.protobuf.ExtensionLite<$message$, *>): "
+ "Boolean {\n"
+ " return _builder.hasExtension(extension)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "fun clear(extension: com.google.protobuf.ExtensionLite<$message$, *>) "
+ "{\n"
+ " _builder.clearExtension(extension)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.PublishedApi\n"
+ "internal fun <T> setExtension(extension: "
+ "com.google.protobuf.ExtensionLite<$message$, T>, "
+ "value: T) {\n"
+ " _builder.setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <T : Comparable<T>> set(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
+ " value: T\n"
+ ") {\n"
+ " setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun set(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, "
+ "com.google.protobuf.ByteString>,\n"
+ " value: com.google.protobuf.ByteString\n"
+ ") {\n"
+ " setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
+ " extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
+ " value: T\n"
+ ") {\n"
+ " setExtension(extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.add(value: E) {\n"
+ " _builder.addExtension(this.extension, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.plusAssign"
+ "(value: E) {\n"
+ " add(value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.addAll(values: Iterable<E>) {\n"
+ " for (value in values) {\n"
+ " add(value)\n"
+ " }\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.plusAssign(values: "
+ "Iterable<E>) {\n"
+ " addAll(values)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+ "$message$>.set(index: Int, value: "
+ "E) {\n"
+ " _builder.setExtension(this.extension, index, value)\n"
+ "}\n\n",
+ "message", message_name);
+
+ printer->Print(
+ "@kotlin.jvm.JvmSynthetic\n"
+ "inline fun com.google.protobuf.kotlin.ExtensionList<*, "
+ "$message$>.clear() {\n"
+ " clear(extension)\n"
+ "}\n\n",
+ "message", message_name);
+}
+
} // namespace java
} // namespace compiler
} // namespace protobuf
diff --git a/src/google/protobuf/compiler/java/java_message_lite.h b/src/google/protobuf/compiler/java/java_message_lite.h
index 5290b1e..4dfa291 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.h
+++ b/src/google/protobuf/compiler/java/java_message_lite.h
@@ -56,6 +56,9 @@
virtual void GenerateStaticVariables(io::Printer* printer,
int* bytecode_estimate);
virtual int GenerateStaticVariableInitializers(io::Printer* printer);
+ void GenerateKotlinDsl(io::Printer* printer) const override;
+ void GenerateKotlinMembers(io::Printer* printer) const override;
+ void GenerateTopLevelKotlinMembers(io::Printer* printer) const override;
private:
void GenerateParseFromMethods(io::Printer* printer);
@@ -66,6 +69,7 @@
void GenerateParser(io::Printer* printer);
void GenerateConstructor(io::Printer* printer);
void GenerateDynamicMethodNewBuildMessageInfo(io::Printer* printer);
+ void GenerateKotlinExtensions(io::Printer* printer) const;
Context* context_;
ClassNameResolver* name_resolver_;
diff --git a/src/google/protobuf/compiler/java/java_name_resolver.cc b/src/google/protobuf/compiler/java/java_name_resolver.cc
index ed33dae..43c7db5 100644
--- a/src/google/protobuf/compiler/java/java_name_resolver.cc
+++ b/src/google/protobuf/compiler/java/java_name_resolver.cc
@@ -69,6 +69,16 @@
return StripPackageName(descriptor->full_name(), descriptor->file());
}
+std::string ClassNameWithoutPackageKotlin(const Descriptor* descriptor) {
+ std::string result = descriptor->name();
+ const Descriptor* temp = descriptor->containing_type();
+
+ while (temp) {
+ result = temp->name() + "Kt." + result;
+ temp = temp->containing_type();
+ }
+ return result;
+}
// Get the name of an enum's Java class without package name prefix.
std::string ClassNameWithoutPackage(const EnumDescriptor* descriptor,
@@ -316,6 +326,12 @@
descriptor->name();
}
+std::string ClassNameResolver::GetKotlinFactoryName(
+ const Descriptor* descriptor) {
+ std::string name = ToCamelCase(descriptor->name(), /* lower_first = */ true);
+ return IsForbiddenKotlin(name) ? name + "_" : name;
+}
+
std::string ClassNameResolver::GetJavaImmutableClassName(
const Descriptor* descriptor) {
return GetJavaClassFullName(ClassNameWithoutPackage(descriptor, true),
@@ -328,6 +344,12 @@
descriptor->file(), true);
}
+std::string ClassNameResolver::GetKotlinExtensionsClassName(
+ const Descriptor* descriptor) {
+ return GetClassFullName(ClassNameWithoutPackageKotlin(descriptor),
+ descriptor->file(), true, true, true);
+}
+
} // namespace java
} // namespace compiler
diff --git a/src/google/protobuf/compiler/java/java_name_resolver.h b/src/google/protobuf/compiler/java/java_name_resolver.h
index 8461df9..9717d92 100644
--- a/src/google/protobuf/compiler/java/java_name_resolver.h
+++ b/src/google/protobuf/compiler/java/java_name_resolver.h
@@ -115,6 +115,8 @@
// com.package.OuterClass$OuterMessage$InnerMessage
std::string GetJavaImmutableClassName(const Descriptor* descriptor);
std::string GetJavaImmutableClassName(const EnumDescriptor* descriptor);
+ std::string GetKotlinFactoryName(const Descriptor* descriptor);
+ std::string GetKotlinExtensionsClassName(const Descriptor* descriptor);
private:
// Get the full name of a Java class by prepending the Java package name
// or outer class name.
diff --git a/src/google/protobuf/compiler/java/java_primitive_field.cc b/src/google/protobuf/compiler/java/java_primitive_field.cc
index 65cc05a..2bc565c 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field.cc
@@ -68,6 +68,7 @@
(*variables)["type"] = PrimitiveTypeName(javaType);
(*variables)["boxed_type"] = BoxedPrimitiveTypeName(javaType);
+ (*variables)["kt_type"] = KotlinTypeName(javaType);
(*variables)["field_type"] = (*variables)["type"];
if (javaType == JAVATYPE_BOOLEAN || javaType == JAVATYPE_DOUBLE ||
@@ -129,6 +130,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
int fixed_size = FixedSize(GetType(descriptor));
if (fixed_size != -1) {
(*variables)["fixed_size"] = StrCat(fixed_size);
@@ -298,6 +304,33 @@
"}\n");
}
+void ImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ if (HasHazzer(descriptor_)) {
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+ }
+}
void ImmutablePrimitiveFieldGenerator::GenerateFieldBuilderInitializationCode(
io::Printer* printer) const {
@@ -793,6 +826,98 @@
printer->Annotate("{", "}", descriptor_);
}
+void RepeatedImmutablePrimitiveFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: $kt_type$) {\n"
+ " add(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " addAll(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
void RepeatedImmutablePrimitiveFieldGenerator::
GenerateFieldBuilderInitializationCode(io::Printer* printer) const {
// noop for primitives
diff --git a/src/google/protobuf/compiler/java/java_primitive_field.h b/src/google/protobuf/compiler/java/java_primitive_field.h
index db20750..56be916 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field.h
+++ b/src/google/protobuf/compiler/java/java_primitive_field.h
@@ -81,6 +81,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -139,6 +140,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
index 1932e99..cc589f3 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
@@ -74,6 +74,7 @@
JavaType javaType = GetJavaType(descriptor);
(*variables)["type"] = PrimitiveTypeName(javaType);
(*variables)["boxed_type"] = BoxedPrimitiveTypeName(javaType);
+ (*variables)["kt_type"] = KotlinTypeName(javaType);
(*variables)["field_type"] = (*variables)["type"];
(*variables)["default"] = ImmutableDefaultValue(descriptor, name_resolver);
(*variables)["capitalized_type"] =
@@ -137,6 +138,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
int fixed_size = FixedSize(GetType(descriptor));
if (fixed_size != -1) {
(*variables)["fixed_size"] = StrCat(fixed_size);
@@ -303,6 +309,33 @@
printer->Annotate("{", "}", descriptor_);
}
+void ImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ if (HasHazzer(descriptor_)) {
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+ }
+}
void ImmutablePrimitiveFieldLiteGenerator::GenerateFieldInfo(
io::Printer* printer, std::vector<uint16_t>* output) const {
@@ -615,6 +648,98 @@
printer->Annotate("{", "}", descriptor_);
}
+void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$ val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.jvm.JvmSynthetic\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: $kt_type$) {\n"
+ " add(value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
+ " addAll(values)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: $kt_type$) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
void RepeatedImmutablePrimitiveFieldLiteGenerator::GenerateFieldInfo(
io::Printer* printer, std::vector<uint16_t>* output) const {
WriteIntToUtf16CharSequence(descriptor_->number(), output);
diff --git a/src/google/protobuf/compiler/java/java_primitive_field_lite.h b/src/google/protobuf/compiler/java/java_primitive_field_lite.h
index 22a2557..b9fcacd 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_primitive_field_lite.h
@@ -73,6 +73,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -119,7 +120,8 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
-
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
+
std::string GetBoxedType() const;
private:
diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc
index 2e9a9e7..8d72d95 100644
--- a/src/google/protobuf/compiler/java/java_string_field.cc
+++ b/src/google/protobuf/compiler/java/java_string_field.cc
@@ -90,6 +90,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["on_changed"] = "onChanged();";
if (HasHasbit(descriptor)) {
@@ -367,6 +372,34 @@
"}\n");
}
+void ImmutableStringFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: kotlin.String\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ if (HasHazzer(descriptor_)) {
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+ }
+}
+
void ImmutableStringFieldGenerator::GenerateFieldBuilderInitializationCode(
io::Printer* printer) const {
// noop for primitives
@@ -916,6 +949,107 @@
"}\n");
}
+void RepeatedImmutableStringFieldGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ // property for List<String>
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER);
+ printer->Print(
+ variables_,
+ "val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ // List<String>.add(String)
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: kotlin.String) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}\n");
+
+ // List<String> += String
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: kotlin.String) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}\n");
+
+ // List<String>.addAll(Iterable<String>)
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<kotlin.String>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}\n");
+
+ // List<String> += Iterable<String>
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}\n");
+
+ // List<String>[Int] = String
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: kotlin.String) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
void RepeatedImmutableStringFieldGenerator::
GenerateFieldBuilderInitializationCode(io::Printer* printer) const {
// noop for primitives
diff --git a/src/google/protobuf/compiler/java/java_string_field.h b/src/google/protobuf/compiler/java/java_string_field.h
index 1c00ae8..6cc9126 100644
--- a/src/google/protobuf/compiler/java/java_string_field.h
+++ b/src/google/protobuf/compiler/java/java_string_field.h
@@ -81,6 +81,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -137,6 +138,7 @@
void GenerateFieldBuilderInitializationCode(io::Printer* printer) const;
void GenerateEqualsCode(io::Printer* printer) const;
void GenerateHashCode(io::Printer* printer) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.cc b/src/google/protobuf/compiler/java/java_string_field_lite.cc
index 63702c1..f22fc4b 100644
--- a/src/google/protobuf/compiler/java/java_string_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_string_field_lite.cc
@@ -86,6 +86,11 @@
// by the proto compiler
(*variables)["deprecation"] =
descriptor->options().deprecated() ? "@java.lang.Deprecated " : "";
+ (*variables)["kt_deprecation"] =
+ descriptor->options().deprecated()
+ ? "@kotlin.Deprecated(message = \"Field " + (*variables)["name"] +
+ " is deprecated\") "
+ : "";
(*variables)["required"] = descriptor->is_required() ? "true" : "false";
if (HasHasbit(descriptor)) {
@@ -304,6 +309,34 @@
printer->Annotate("{", "}", descriptor_);
}
+void ImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ WriteFieldDocComment(printer, descriptor_);
+ printer->Print(variables_,
+ "$kt_deprecation$var $kt_name$: kotlin.String\n"
+ " @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
+ " get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
+ " @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
+ " set(value) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(value)\n"
+ " }\n");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}\n");
+
+ if (HasHazzer(descriptor_)) {
+ WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
+ printer->Print(variables_,
+ "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ " return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+ "}\n");
+ }
+}
+
void ImmutableStringFieldLiteGenerator::GenerateFieldInfo(
io::Printer* printer, std::vector<uint16_t>* output) const {
WriteIntToUtf16CharSequence(descriptor_->number(), output);
@@ -704,6 +737,107 @@
printer->Annotate("{", "}", descriptor_);
}
+void RepeatedImmutableStringFieldLiteGenerator::GenerateKotlinDslMembers(
+ io::Printer* printer) const {
+ printer->Print(
+ variables_,
+ "/**\n"
+ " * An uninstantiable, behaviorless type to represent the field in\n"
+ " * generics.\n"
+ " */\n"
+ "@kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ " : com.google.protobuf.kotlin.DslProxy()\n");
+
+ // property for List<String>
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER);
+ printer->Print(
+ variables_,
+ "val $kt_name$: "
+ "com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
+ " @kotlin.OptIn"
+ "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
+ " get() = com.google.protobuf.kotlin.DslList(\n"
+ " $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+ " )\n");
+
+ // List<String>.add(String)
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "add(value: kotlin.String) {\n"
+ " $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+ "}\n");
+
+ // List<String> += String
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(value: kotlin.String) {\n"
+ " add(value)\n"
+ "}\n");
+
+ // List<String>.addAll(Iterable<String>)
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "addAll(values: kotlin.collections.Iterable<kotlin.String>) {\n"
+ " $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+ "}\n");
+
+ // List<String> += Iterable<String>
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_MULTI_ADDER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
+ "inline operator fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n"
+ " addAll(values)\n"
+ "}\n");
+
+ // List<String>[Int] = String
+ WriteFieldAccessorDocComment(printer, descriptor_, LIST_INDEXED_SETTER,
+ /* builder */ false);
+ printer->Print(
+ variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
+ "operator fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "set(index: kotlin.Int, value: kotlin.String) {\n"
+ " $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
+ "}");
+
+ WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
+ /* builder */ false);
+ printer->Print(variables_,
+ "@kotlin.jvm.JvmSynthetic\n"
+ "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
+ "fun com.google.protobuf.kotlin.DslList"
+ "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
+ "clear() {\n"
+ " $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
+ "}");
+}
+
void RepeatedImmutableStringFieldLiteGenerator::GenerateFieldInfo(
io::Printer* printer, std::vector<uint16_t>* output) const {
WriteIntToUtf16CharSequence(descriptor_->number(), output);
diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.h b/src/google/protobuf/compiler/java/java_string_field_lite.h
index 194a19d..c95256f 100644
--- a/src/google/protobuf/compiler/java/java_string_field_lite.h
+++ b/src/google/protobuf/compiler/java/java_string_field_lite.h
@@ -74,6 +74,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
@@ -118,6 +119,7 @@
void GenerateInitializationCode(io::Printer* printer) const;
void GenerateFieldInfo(io::Printer* printer,
std::vector<uint16_t>* output) const;
+ void GenerateKotlinDslMembers(io::Printer* printer) const;
std::string GetBoxedType() const;
diff --git a/src/google/protobuf/compiler/main.cc b/src/google/protobuf/compiler/main.cc
index 895b47d..7cb7a63 100644
--- a/src/google/protobuf/compiler/main.cc
+++ b/src/google/protobuf/compiler/main.cc
@@ -30,6 +30,7 @@
#include <google/protobuf/compiler/cpp/cpp_generator.h>
#include <google/protobuf/compiler/java/java_generator.h>
+#include <google/protobuf/compiler/java/java_kotlin_generator.h>
#include <google/protobuf/compiler/js/js_generator.h>
#include <google/protobuf/compiler/command_line_interface.h>
#include <google/protobuf/compiler/python/python_generator.h>
@@ -64,6 +65,10 @@
cli.RegisterGenerator("--java_out", "--java_opt", &java_generator,
"Generate Java source file.");
+ // Proto2 Kotlin
+ java::KotlinGenerator kt_generator;
+ cli.RegisterGenerator("--kotlin_out", "--kotlin_opt", &kt_generator,
+ "Generate Kotlin file.");
// Proto2 Python
diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc
index b1bf288..9c4e1e4 100644
--- a/src/google/protobuf/compiler/parser.cc
+++ b/src/google/protobuf/compiler/parser.cc
@@ -1782,12 +1782,12 @@
DO(Consume("reserved"));
if (LookingAtType(io::Tokenizer::TYPE_STRING)) {
LocationRecorder location(message_location,
- DescriptorProto::kReservedNameFieldNumber);
+ EnumDescriptorProto::kReservedNameFieldNumber);
location.StartAt(start_token);
return ParseReservedNames(message, location);
} else {
LocationRecorder location(message_location,
- DescriptorProto::kReservedRangeFieldNumber);
+ EnumDescriptorProto::kReservedRangeFieldNumber);
location.StartAt(start_token);
return ParseReservedNumbers(message, location);
}
@@ -2215,7 +2215,6 @@
return true;
}
-
bool Parser::ParseMethodOptions(const LocationRecorder& parent_location,
const FileDescriptorProto* containing_file,
const int optionsFieldNumber,
diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h
index e0ba90f..b5a5df8 100644
--- a/src/google/protobuf/compiler/parser.h
+++ b/src/google/protobuf/compiler/parser.h
@@ -523,7 +523,6 @@
return syntax_identifier_ == "proto3";
}
-
bool ValidateEnum(const EnumDescriptorProto* proto);
// =================================================================
diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc
index a413d74..32bf1b3 100644
--- a/src/google/protobuf/compiler/parser_unittest.cc
+++ b/src/google/protobuf/compiler/parser_unittest.cc
@@ -3139,6 +3139,43 @@
EXPECT_TRUE(HasSpan(file_.enum_type(0), "name"));
}
+TEST_F(SourceInfoTest, EnumReservedRange) {
+ EXPECT_TRUE(
+ Parse("enum TestEnum {\n"
+ " $a$reserved $b$1$c$ to $d$10$e$;$f$\n"
+ "}"));
+
+ const EnumDescriptorProto::EnumReservedRange& bar =
+ file_.enum_type(0).reserved_range(0);
+
+ EXPECT_TRUE(HasSpan('a', 'f', file_.enum_type(0), "reserved_range"));
+ EXPECT_TRUE(HasSpan('b', 'e', bar));
+ EXPECT_TRUE(HasSpan('b', 'c', bar, "start"));
+ EXPECT_TRUE(HasSpan('d', 'e', bar, "end"));
+
+ // Ignore these.
+ EXPECT_TRUE(HasSpan(file_));
+ EXPECT_TRUE(HasSpan(file_.enum_type(0)));
+ EXPECT_TRUE(HasSpan(file_.enum_type(0), "name"));
+}
+
+TEST_F(SourceInfoTest, EnumReservedName) {
+ EXPECT_TRUE(
+ Parse("enum TestEnum {\n"
+ " $a$reserved $b$'foo'$c$;$d$\n"
+ "}"));
+
+ const EnumDescriptorProto& bar = file_.enum_type(0);
+
+ EXPECT_TRUE(HasSpan('a', 'd', bar, "reserved_name"));
+ EXPECT_TRUE(HasSpan('b', 'c', bar, "reserved_name", 0));
+
+ // Ignore these.
+ EXPECT_TRUE(HasSpan(file_));
+ EXPECT_TRUE(HasSpan(file_.enum_type(0)));
+ EXPECT_TRUE(HasSpan(file_.enum_type(0), "name"));
+}
+
TEST_F(SourceInfoTest, NestedEnums) {
EXPECT_TRUE(
Parse("message Foo {\n"
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index 374a444..11715d2 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -67,7 +67,7 @@
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
: file_()
, error_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
- , supported_features_(PROTOBUF_ULONGLONG(0)){}
+ , supported_features_(uint64_t{0u}){}
struct CodeGeneratorResponseDefaultTypeInternal {
constexpr CodeGeneratorResponseDefaultTypeInternal()
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
@@ -243,7 +243,7 @@
suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_suffix()) {
suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(),
- GetArena());
+ GetArenaForAllocation());
}
::memcpy(&major_, &from.major_,
static_cast<size_t>(reinterpret_cast<char*>(&patch_) -
@@ -266,7 +266,7 @@
}
void Version::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
suffix_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -516,9 +516,13 @@
void Version::InternalSwap(Version* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- suffix_.Swap(&other->suffix_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &suffix_, GetArenaForAllocation(),
+ &other->suffix_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Version, patch_)
+ sizeof(Version::patch_)
@@ -571,7 +575,7 @@
parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_parameter()) {
parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_compiler_version()) {
compiler_version_ = new PROTOBUF_NAMESPACE_ID::compiler::Version(*from.compiler_version_);
@@ -593,7 +597,7 @@
}
void CodeGeneratorRequest::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
parameter_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete compiler_version_;
}
@@ -863,11 +867,15 @@
void CodeGeneratorRequest::InternalSwap(CodeGeneratorRequest* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
file_to_generate_.InternalSwap(&other->file_to_generate_);
proto_file_.InternalSwap(&other->proto_file_);
- parameter_.Swap(&other->parameter_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ ¶meter_, GetArenaForAllocation(),
+ &other->parameter_, other->GetArenaForAllocation()
+ );
swap(compiler_version_, other->compiler_version_);
}
@@ -918,17 +926,17 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_insertion_point()) {
insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(),
- GetArena());
+ GetArenaForAllocation());
}
content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_content()) {
content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_generated_code_info()) {
generated_code_info_ = new PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo(*from.generated_code_info_);
@@ -952,7 +960,7 @@
}
void CodeGeneratorResponse_File::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
insertion_point_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
content_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -1226,11 +1234,23 @@
void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- insertion_point_.Swap(&other->insertion_point_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- content_.Swap(&other->content_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &insertion_point_, GetArenaForAllocation(),
+ &other->insertion_point_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &content_, GetArenaForAllocation(),
+ &other->content_, other->GetArenaForAllocation()
+ );
swap(generated_code_info_, other->generated_code_info_);
}
@@ -1268,7 +1288,7 @@
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_error()) {
error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(),
- GetArena());
+ GetArenaForAllocation());
}
supported_features_ = from.supported_features_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse)
@@ -1276,7 +1296,7 @@
void CodeGeneratorResponse::SharedCtor() {
error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
-supported_features_ = PROTOBUF_ULONGLONG(0);
+supported_features_ = uint64_t{0u};
}
CodeGeneratorResponse::~CodeGeneratorResponse() {
@@ -1286,7 +1306,7 @@
}
void CodeGeneratorResponse::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
error_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -1311,7 +1331,7 @@
if (cached_has_bits & 0x00000001u) {
error_.ClearNonDefaultToEmpty();
}
- supported_features_ = PROTOBUF_ULONGLONG(0);
+ supported_features_ = uint64_t{0u};
_has_bits_.Clear();
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@@ -1513,10 +1533,14 @@
void CodeGeneratorResponse::InternalSwap(CodeGeneratorResponse* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
file_.InternalSwap(&other->file_);
- error_.Swap(&other->error_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &error_, GetArenaForAllocation(),
+ &other->error_, other->GetArenaForAllocation()
+ );
swap(supported_features_, other->supported_features_);
}
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index af51e54..78923cd 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -111,7 +111,7 @@
}
// ===================================================================
-class PROTOC_EXPORT Version PROTOBUF_FINAL :
+class PROTOC_EXPORT Version final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.Version) */ {
public:
inline Version() : Version(nullptr) {}
@@ -129,8 +129,9 @@
return *this;
}
inline Version& operator=(Version&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -168,7 +169,7 @@
}
inline void Swap(Version* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -176,14 +177,14 @@
}
void UnsafeArenaSwap(Version* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Version* New() const final {
- return CreateMaybeMessage<Version>(nullptr);
+ return new Version();
}
Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -203,8 +204,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Version* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -240,11 +241,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_suffix(ArgT0&& arg0, ArgT... args);
std::string* mutable_suffix();
- std::string* release_suffix();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_suffix();
void set_allocated_suffix(std::string* suffix);
private:
const std::string& _internal_suffix() const;
- void _internal_set_suffix(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_suffix(const std::string& value);
std::string* _internal_mutable_suffix();
public:
@@ -304,7 +305,7 @@
};
// -------------------------------------------------------------------
-class PROTOC_EXPORT CodeGeneratorRequest PROTOBUF_FINAL :
+class PROTOC_EXPORT CodeGeneratorRequest final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorRequest) */ {
public:
inline CodeGeneratorRequest() : CodeGeneratorRequest(nullptr) {}
@@ -322,8 +323,9 @@
return *this;
}
inline CodeGeneratorRequest& operator=(CodeGeneratorRequest&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -361,7 +363,7 @@
}
inline void Swap(CodeGeneratorRequest* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -369,14 +371,14 @@
}
void UnsafeArenaSwap(CodeGeneratorRequest* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline CodeGeneratorRequest* New() const final {
- return CreateMaybeMessage<CodeGeneratorRequest>(nullptr);
+ return new CodeGeneratorRequest();
}
CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -396,8 +398,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(CodeGeneratorRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -475,11 +477,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_parameter(ArgT0&& arg0, ArgT... args);
std::string* mutable_parameter();
- std::string* release_parameter();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_parameter();
void set_allocated_parameter(std::string* parameter);
private:
const std::string& _internal_parameter() const;
- void _internal_set_parameter(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_parameter(const std::string& value);
std::string* _internal_mutable_parameter();
public:
@@ -490,7 +492,7 @@
public:
void clear_compiler_version();
const PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const;
- PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version();
void set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version);
private:
@@ -518,7 +520,7 @@
};
// -------------------------------------------------------------------
-class PROTOC_EXPORT CodeGeneratorResponse_File PROTOBUF_FINAL :
+class PROTOC_EXPORT CodeGeneratorResponse_File final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse.File) */ {
public:
inline CodeGeneratorResponse_File() : CodeGeneratorResponse_File(nullptr) {}
@@ -536,8 +538,9 @@
return *this;
}
inline CodeGeneratorResponse_File& operator=(CodeGeneratorResponse_File&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -575,7 +578,7 @@
}
inline void Swap(CodeGeneratorResponse_File* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -583,14 +586,14 @@
}
void UnsafeArenaSwap(CodeGeneratorResponse_File* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline CodeGeneratorResponse_File* New() const final {
- return CreateMaybeMessage<CodeGeneratorResponse_File>(nullptr);
+ return new CodeGeneratorResponse_File();
}
CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -610,8 +613,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(CodeGeneratorResponse_File* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -647,11 +650,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -665,11 +668,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_insertion_point(ArgT0&& arg0, ArgT... args);
std::string* mutable_insertion_point();
- std::string* release_insertion_point();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_insertion_point();
void set_allocated_insertion_point(std::string* insertion_point);
private:
const std::string& _internal_insertion_point() const;
- void _internal_set_insertion_point(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_insertion_point(const std::string& value);
std::string* _internal_mutable_insertion_point();
public:
@@ -683,11 +686,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_content(ArgT0&& arg0, ArgT... args);
std::string* mutable_content();
- std::string* release_content();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_content();
void set_allocated_content(std::string* content);
private:
const std::string& _internal_content() const;
- void _internal_set_content(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_content(const std::string& value);
std::string* _internal_mutable_content();
public:
@@ -698,7 +701,7 @@
public:
void clear_generated_code_info();
const PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const;
- PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info();
void set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info);
private:
@@ -726,7 +729,7 @@
};
// -------------------------------------------------------------------
-class PROTOC_EXPORT CodeGeneratorResponse PROTOBUF_FINAL :
+class PROTOC_EXPORT CodeGeneratorResponse final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.compiler.CodeGeneratorResponse) */ {
public:
inline CodeGeneratorResponse() : CodeGeneratorResponse(nullptr) {}
@@ -744,8 +747,9 @@
return *this;
}
inline CodeGeneratorResponse& operator=(CodeGeneratorResponse&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -783,7 +787,7 @@
}
inline void Swap(CodeGeneratorResponse* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -791,14 +795,14 @@
}
void UnsafeArenaSwap(CodeGeneratorResponse* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline CodeGeneratorResponse* New() const final {
- return CreateMaybeMessage<CodeGeneratorResponse>(nullptr);
+ return new CodeGeneratorResponse();
}
CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -818,8 +822,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(CodeGeneratorResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -904,11 +908,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_error(ArgT0&& arg0, ArgT... args);
std::string* mutable_error();
- std::string* release_error();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_error();
void set_allocated_error(std::string* error);
private:
const std::string& _internal_error() const;
- void _internal_set_error(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_error(const std::string& value);
std::string* _internal_mutable_error();
public:
@@ -1051,10 +1055,10 @@
return _internal_suffix();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Version::set_suffix(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Version::set_suffix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.suffix)
}
inline std::string* Version::mutable_suffix() {
@@ -1066,11 +1070,11 @@
}
inline void Version::_internal_set_suffix(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Version::_internal_mutable_suffix() {
_has_bits_[0] |= 0x00000001u;
- return suffix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return suffix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Version::release_suffix() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.Version.suffix)
@@ -1078,7 +1082,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Version::set_allocated_suffix(std::string* suffix) {
if (suffix != nullptr) {
@@ -1087,7 +1091,7 @@
_has_bits_[0] &= ~0x00000001u;
}
suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
}
@@ -1186,10 +1190,10 @@
return _internal_parameter();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void CodeGeneratorRequest::set_parameter(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void CodeGeneratorRequest::set_parameter(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
inline std::string* CodeGeneratorRequest::mutable_parameter() {
@@ -1201,11 +1205,11 @@
}
inline void CodeGeneratorRequest::_internal_set_parameter(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorRequest::_internal_mutable_parameter() {
_has_bits_[0] |= 0x00000001u;
- return parameter_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return parameter_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* CodeGeneratorRequest::release_parameter() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorRequest.parameter)
@@ -1213,7 +1217,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter) {
if (parameter != nullptr) {
@@ -1222,7 +1226,7 @@
_has_bits_[0] &= ~0x00000001u;
}
parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
}
@@ -1286,7 +1290,7 @@
}
inline void CodeGeneratorRequest::unsafe_arena_set_allocated_compiler_version(
PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(compiler_version_);
}
compiler_version_ = compiler_version;
@@ -1301,7 +1305,7 @@
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::compiler::Version* temp = compiler_version_;
compiler_version_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -1316,7 +1320,7 @@
inline PROTOBUF_NAMESPACE_ID::compiler::Version* CodeGeneratorRequest::_internal_mutable_compiler_version() {
_has_bits_[0] |= 0x00000002u;
if (compiler_version_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::compiler::Version>(GetArenaForAllocation());
compiler_version_ = p;
}
return compiler_version_;
@@ -1326,13 +1330,13 @@
return _internal_mutable_compiler_version();
}
inline void CodeGeneratorRequest::set_allocated_compiler_version(PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete compiler_version_;
}
if (compiler_version) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(compiler_version);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::compiler::Version>::GetOwningArena(compiler_version);
if (message_arena != submessage_arena) {
compiler_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, compiler_version, submessage_arena);
@@ -1366,10 +1370,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void CodeGeneratorResponse_File::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void CodeGeneratorResponse_File::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
inline std::string* CodeGeneratorResponse_File::mutable_name() {
@@ -1381,11 +1385,11 @@
}
inline void CodeGeneratorResponse_File::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.name)
@@ -1393,7 +1397,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1402,7 +1406,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
}
@@ -1423,10 +1427,10 @@
return _internal_insertion_point();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void CodeGeneratorResponse_File::set_insertion_point(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void CodeGeneratorResponse_File::set_insertion_point(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
inline std::string* CodeGeneratorResponse_File::mutable_insertion_point() {
@@ -1438,11 +1442,11 @@
}
inline void CodeGeneratorResponse_File::_internal_set_insertion_point(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_insertion_point() {
_has_bits_[0] |= 0x00000002u;
- return insertion_point_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return insertion_point_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_insertion_point() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
@@ -1450,7 +1454,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* insertion_point) {
if (insertion_point != nullptr) {
@@ -1459,7 +1463,7 @@
_has_bits_[0] &= ~0x00000002u;
}
insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
}
@@ -1480,10 +1484,10 @@
return _internal_content();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void CodeGeneratorResponse_File::set_content(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void CodeGeneratorResponse_File::set_content(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
inline std::string* CodeGeneratorResponse_File::mutable_content() {
@@ -1495,11 +1499,11 @@
}
inline void CodeGeneratorResponse_File::_internal_set_content(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::_internal_mutable_content() {
_has_bits_[0] |= 0x00000004u;
- return content_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return content_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse_File::release_content() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.File.content)
@@ -1507,7 +1511,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void CodeGeneratorResponse_File::set_allocated_content(std::string* content) {
if (content != nullptr) {
@@ -1516,7 +1520,7 @@
_has_bits_[0] &= ~0x00000004u;
}
content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
}
@@ -1540,7 +1544,7 @@
}
inline void CodeGeneratorResponse_File::unsafe_arena_set_allocated_generated_code_info(
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_);
}
generated_code_info_ = generated_code_info;
@@ -1555,7 +1559,7 @@
_has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* temp = generated_code_info_;
generated_code_info_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -1570,7 +1574,7 @@
inline PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* CodeGeneratorResponse_File::_internal_mutable_generated_code_info() {
_has_bits_[0] |= 0x00000008u;
if (generated_code_info_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo>(GetArenaForAllocation());
generated_code_info_ = p;
}
return generated_code_info_;
@@ -1580,13 +1584,15 @@
return _internal_mutable_generated_code_info();
}
inline void CodeGeneratorResponse_File::set_allocated_generated_code_info(PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info_);
}
if (generated_code_info) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info)->GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
+ ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(generated_code_info));
if (message_arena != submessage_arena) {
generated_code_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, generated_code_info, submessage_arena);
@@ -1620,10 +1626,10 @@
return _internal_error();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void CodeGeneratorResponse::set_error(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void CodeGeneratorResponse::set_error(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.error)
}
inline std::string* CodeGeneratorResponse::mutable_error() {
@@ -1635,11 +1641,11 @@
}
inline void CodeGeneratorResponse::_internal_set_error(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse::_internal_mutable_error() {
_has_bits_[0] |= 0x00000001u;
- return error_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return error_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* CodeGeneratorResponse::release_error() {
// @@protoc_insertion_point(field_release:google.protobuf.compiler.CodeGeneratorResponse.error)
@@ -1647,7 +1653,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
if (error != nullptr) {
@@ -1656,7 +1662,7 @@
_has_bits_[0] &= ~0x00000001u;
}
error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
}
@@ -1669,7 +1675,7 @@
return _internal_has_supported_features();
}
inline void CodeGeneratorResponse::clear_supported_features() {
- supported_features_ = PROTOBUF_ULONGLONG(0);
+ supported_features_ = uint64_t{0u};
_has_bits_[0] &= ~0x00000002u;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::_internal_supported_features() const {
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 03c4e2b..40ded3a 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -2591,7 +2591,7 @@
enum_type(i)->DebugString(depth, contents, debug_string_options);
}
for (int i = 0; i < field_count(); i++) {
- if (field(i)->containing_oneof() == nullptr) {
+ if (field(i)->real_containing_oneof() == nullptr) {
field(i)->DebugString(depth, contents, debug_string_options);
} else if (field(i)->containing_oneof()->field(0) == field(i)) {
// This is the first field in this oneof, so print the whole oneof.
@@ -2701,7 +2701,7 @@
std::string label = StrCat(kLabelToName[this->label()], " ");
// Label is omitted for maps, oneof, and plain proto3 fields.
- if (is_map() || containing_oneof() ||
+ if (is_map() || real_containing_oneof() ||
(is_optional() && !has_optional_keyword())) {
label.clear();
}
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index c22ae43..9fb0dfa 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -378,8 +378,8 @@
, identifier_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
, string_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
, aggregate_value_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
- , positive_int_value_(PROTOBUF_ULONGLONG(0))
- , negative_int_value_(PROTOBUF_LONGLONG(0))
+ , positive_int_value_(uint64_t{0u})
+ , negative_int_value_(int64_t{0})
, double_value_(0){}
struct UninterpretedOptionDefaultTypeInternal {
constexpr UninterpretedOptionDefaultTypeInternal()
@@ -1262,7 +1262,7 @@
}
void FileDescriptorSet::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void FileDescriptorSet::ArenaDtor(void* object) {
@@ -1418,7 +1418,7 @@
void FileDescriptorSet::InternalSwap(FileDescriptorSet* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
file_.InternalSwap(&other->file_);
}
@@ -1487,17 +1487,17 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_package()) {
package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package(),
- GetArena());
+ GetArenaForAllocation());
}
syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_syntax()) {
syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_syntax(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::FileOptions(*from.options_);
@@ -1529,7 +1529,7 @@
}
void FileDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
syntax_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -2056,7 +2056,7 @@
void FileDescriptorProto::InternalSwap(FileDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
dependency_.InternalSwap(&other->dependency_);
message_type_.InternalSwap(&other->message_type_);
@@ -2065,9 +2065,21 @@
extension_.InternalSwap(&other->extension_);
public_dependency_.InternalSwap(&other->public_dependency_);
weak_dependency_.InternalSwap(&other->weak_dependency_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- package_.Swap(&other->package_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- syntax_.Swap(&other->syntax_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &package_, GetArenaForAllocation(),
+ &other->package_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &syntax_, GetArenaForAllocation(),
+ &other->syntax_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(FileDescriptorProto, source_code_info_)
+ sizeof(FileDescriptorProto::source_code_info_)
@@ -2138,7 +2150,7 @@
}
void DescriptorProto_ExtensionRange::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (this != internal_default_instance()) delete options_;
}
@@ -2362,7 +2374,7 @@
void DescriptorProto_ExtensionRange::InternalSwap(DescriptorProto_ExtensionRange* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(DescriptorProto_ExtensionRange, end_)
@@ -2421,7 +2433,7 @@
}
void DescriptorProto_ReservedRange::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void DescriptorProto_ReservedRange::ArenaDtor(void* object) {
@@ -2612,7 +2624,7 @@
void DescriptorProto_ReservedRange::InternalSwap(DescriptorProto_ReservedRange* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(DescriptorProto_ReservedRange, end_)
@@ -2675,7 +2687,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::MessageOptions(*from.options_);
@@ -2697,7 +2709,7 @@
}
void DescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
@@ -3149,7 +3161,7 @@
void DescriptorProto::InternalSwap(DescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
field_.InternalSwap(&other->field_);
nested_type_.InternalSwap(&other->nested_type_);
@@ -3159,7 +3171,11 @@
oneof_decl_.InternalSwap(&other->oneof_decl_);
reserved_range_.InternalSwap(&other->reserved_range_);
reserved_name_.InternalSwap(&other->reserved_name_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
swap(options_, other->options_);
}
@@ -3201,7 +3217,7 @@
}
void ExtensionRangeOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void ExtensionRangeOptions::ArenaDtor(void* object) {
@@ -3375,8 +3391,8 @@
void ExtensionRangeOptions::InternalSwap(ExtensionRangeOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
}
@@ -3444,27 +3460,27 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_extendee()) {
extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_extendee(),
- GetArena());
+ GetArenaForAllocation());
}
type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_type_name()) {
type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_name(),
- GetArena());
+ GetArenaForAllocation());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_default_value()) {
default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(),
- GetArena());
+ GetArenaForAllocation());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_json_name()) {
json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::FieldOptions(*from.options_);
@@ -3498,7 +3514,7 @@
}
void FieldDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
extendee_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
type_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -3987,13 +4003,33 @@
void FieldDescriptorProto::InternalSwap(FieldDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- extendee_.Swap(&other->extendee_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- type_name_.Swap(&other->type_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- default_value_.Swap(&other->default_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- json_name_.Swap(&other->json_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &extendee_, GetArenaForAllocation(),
+ &other->extendee_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &type_name_, GetArenaForAllocation(),
+ &other->type_name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &default_value_, GetArenaForAllocation(),
+ &other->default_value_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &json_name_, GetArenaForAllocation(),
+ &other->json_name_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(FieldDescriptorProto, proto3_optional_)
+ sizeof(FieldDescriptorProto::proto3_optional_)
@@ -4041,7 +4077,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::OneofOptions(*from.options_);
@@ -4063,7 +4099,7 @@
}
void OneofDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
@@ -4270,9 +4306,13 @@
void OneofDescriptorProto::InternalSwap(OneofDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
swap(options_, other->options_);
}
@@ -4325,7 +4365,7 @@
}
void EnumDescriptorProto_EnumReservedRange::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void EnumDescriptorProto_EnumReservedRange::ArenaDtor(void* object) {
@@ -4516,7 +4556,7 @@
void EnumDescriptorProto_EnumReservedRange::InternalSwap(EnumDescriptorProto_EnumReservedRange* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(EnumDescriptorProto_EnumReservedRange, end_)
@@ -4569,7 +4609,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::EnumOptions(*from.options_);
@@ -4591,7 +4631,7 @@
}
void EnumDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
@@ -4893,12 +4933,16 @@
void EnumDescriptorProto::InternalSwap(EnumDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
value_.InternalSwap(&other->value_);
reserved_range_.InternalSwap(&other->reserved_range_);
reserved_name_.InternalSwap(&other->reserved_name_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
swap(options_, other->options_);
}
@@ -4942,7 +4986,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::EnumValueOptions(*from.options_);
@@ -4968,7 +5012,7 @@
}
void EnumValueDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
@@ -5201,9 +5245,13 @@
void EnumValueDescriptorProto::InternalSwap(EnumValueDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(EnumValueDescriptorProto, number_)
+ sizeof(EnumValueDescriptorProto::number_)
@@ -5251,7 +5299,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::ServiceOptions(*from.options_);
@@ -5273,7 +5321,7 @@
}
void ServiceDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete options_;
}
@@ -5510,10 +5558,14 @@
void ServiceDescriptorProto::InternalSwap(ServiceDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
method_.InternalSwap(&other->method_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
swap(options_, other->options_);
}
@@ -5566,17 +5618,17 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_input_type()) {
input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_input_type(),
- GetArena());
+ GetArenaForAllocation());
}
output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_output_type()) {
output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_output_type(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_options()) {
options_ = new PROTOBUF_NAMESPACE_ID::MethodOptions(*from.options_);
@@ -5606,7 +5658,7 @@
}
void MethodDescriptorProto::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
input_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
output_type_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -5931,11 +5983,23 @@
void MethodDescriptorProto::InternalSwap(MethodDescriptorProto* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- input_type_.Swap(&other->input_type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- output_type_.Swap(&other->output_type_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &input_type_, GetArenaForAllocation(),
+ &other->input_type_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &output_type_, GetArenaForAllocation(),
+ &other->output_type_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(MethodDescriptorProto, server_streaming_)
+ sizeof(MethodDescriptorProto::server_streaming_)
@@ -6034,52 +6098,52 @@
java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_java_package()) {
java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_package(),
- GetArena());
+ GetArenaForAllocation());
}
java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_java_outer_classname()) {
java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_outer_classname(),
- GetArena());
+ GetArenaForAllocation());
}
go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_go_package()) {
go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_go_package(),
- GetArena());
+ GetArenaForAllocation());
}
objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_objc_class_prefix()) {
objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_objc_class_prefix(),
- GetArena());
+ GetArenaForAllocation());
}
csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_csharp_namespace()) {
csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_csharp_namespace(),
- GetArena());
+ GetArenaForAllocation());
}
swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_swift_prefix()) {
swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_swift_prefix(),
- GetArena());
+ GetArenaForAllocation());
}
php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_php_class_prefix()) {
php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_class_prefix(),
- GetArena());
+ GetArenaForAllocation());
}
php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_php_namespace()) {
php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_namespace(),
- GetArena());
+ GetArenaForAllocation());
}
php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_php_metadata_namespace()) {
php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_metadata_namespace(),
- GetArena());
+ GetArenaForAllocation());
}
ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_ruby_package()) {
ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_ruby_package(),
- GetArena());
+ GetArenaForAllocation());
}
::memcpy(&java_multiple_files_, &from.java_multiple_files_,
static_cast<size_t>(reinterpret_cast<char*>(&cc_enable_arenas_) -
@@ -6113,7 +6177,7 @@
}
void FileOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
java_package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
java_outer_classname_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
go_package_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -6900,20 +6964,60 @@
void FileOptions::InternalSwap(FileOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
- java_package_.Swap(&other->java_package_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- java_outer_classname_.Swap(&other->java_outer_classname_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- go_package_.Swap(&other->go_package_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- objc_class_prefix_.Swap(&other->objc_class_prefix_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- csharp_namespace_.Swap(&other->csharp_namespace_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- swift_prefix_.Swap(&other->swift_prefix_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- php_class_prefix_.Swap(&other->php_class_prefix_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- php_namespace_.Swap(&other->php_namespace_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- php_metadata_namespace_.Swap(&other->php_metadata_namespace_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- ruby_package_.Swap(&other->ruby_package_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &java_package_, GetArenaForAllocation(),
+ &other->java_package_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &java_outer_classname_, GetArenaForAllocation(),
+ &other->java_outer_classname_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &go_package_, GetArenaForAllocation(),
+ &other->go_package_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &objc_class_prefix_, GetArenaForAllocation(),
+ &other->objc_class_prefix_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &csharp_namespace_, GetArenaForAllocation(),
+ &other->csharp_namespace_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &swift_prefix_, GetArenaForAllocation(),
+ &other->swift_prefix_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &php_class_prefix_, GetArenaForAllocation(),
+ &other->php_class_prefix_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &php_namespace_, GetArenaForAllocation(),
+ &other->php_namespace_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &php_metadata_namespace_, GetArenaForAllocation(),
+ &other->php_metadata_namespace_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &ruby_package_, GetArenaForAllocation(),
+ &other->ruby_package_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(FileOptions, deprecated_)
+ sizeof(FileOptions::deprecated_)
@@ -6983,7 +7087,7 @@
}
void MessageOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void MessageOptions::ArenaDtor(void* object) {
@@ -7259,8 +7363,8 @@
void MessageOptions::InternalSwap(MessageOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
@@ -7336,7 +7440,7 @@
}
void FieldOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void FieldOptions::ArenaDtor(void* object) {
@@ -7671,8 +7775,8 @@
void FieldOptions::InternalSwap(FieldOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
@@ -7721,7 +7825,7 @@
}
void OneofOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void OneofOptions::ArenaDtor(void* object) {
@@ -7895,8 +7999,8 @@
void OneofOptions::InternalSwap(OneofOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
}
@@ -7953,7 +8057,7 @@
}
void EnumOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void EnumOptions::ArenaDtor(void* object) {
@@ -8185,8 +8289,8 @@
void EnumOptions::InternalSwap(EnumOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
@@ -8242,7 +8346,7 @@
}
void EnumValueOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void EnumValueOptions::ArenaDtor(void* object) {
@@ -8444,8 +8548,8 @@
void EnumValueOptions::InternalSwap(EnumValueOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
@@ -8496,7 +8600,7 @@
}
void ServiceOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void ServiceOptions::ArenaDtor(void* object) {
@@ -8698,8 +8802,8 @@
void ServiceOptions::InternalSwap(ServiceOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
swap(deprecated_, other->deprecated_);
@@ -8758,7 +8862,7 @@
}
void MethodOptions::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void MethodOptions::ArenaDtor(void* object) {
@@ -8999,8 +9103,8 @@
void MethodOptions::InternalSwap(MethodOptions* other) {
using std::swap;
- _extensions_.Swap(&other->_extensions_);
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _extensions_.InternalSwap(&other->_extensions_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
uninterpreted_option_.InternalSwap(&other->uninterpreted_option_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
@@ -9046,7 +9150,7 @@
name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_name_part()) {
name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name_part(),
- GetArena());
+ GetArenaForAllocation());
}
is_extension_ = from.is_extension_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart)
@@ -9064,7 +9168,7 @@
}
void UninterpretedOption_NamePart::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_part_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -9276,9 +9380,13 @@
void UninterpretedOption_NamePart::InternalSwap(UninterpretedOption_NamePart* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
- name_part_.Swap(&other->name_part_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_part_, GetArenaForAllocation(),
+ &other->name_part_, other->GetArenaForAllocation()
+ );
swap(is_extension_, other->is_extension_);
}
@@ -9328,17 +9436,17 @@
identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_identifier_value()) {
identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_identifier_value(),
- GetArena());
+ GetArenaForAllocation());
}
string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_string_value()) {
string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_string_value(),
- GetArena());
+ GetArenaForAllocation());
}
aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_aggregate_value()) {
aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aggregate_value(),
- GetArena());
+ GetArenaForAllocation());
}
::memcpy(&positive_int_value_, &from.positive_int_value_,
static_cast<size_t>(reinterpret_cast<char*>(&double_value_) -
@@ -9363,7 +9471,7 @@
}
void UninterpretedOption::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
identifier_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
string_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
aggregate_value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -9706,12 +9814,24 @@
void UninterpretedOption::InternalSwap(UninterpretedOption* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
name_.InternalSwap(&other->name_);
- identifier_value_.Swap(&other->identifier_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- string_value_.Swap(&other->string_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- aggregate_value_.Swap(&other->aggregate_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &identifier_value_, GetArenaForAllocation(),
+ &other->identifier_value_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &string_value_, GetArenaForAllocation(),
+ &other->string_value_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &aggregate_value_, GetArenaForAllocation(),
+ &other->aggregate_value_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(UninterpretedOption, double_value_)
+ sizeof(UninterpretedOption::double_value_)
@@ -9758,12 +9878,12 @@
leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_leading_comments()) {
leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_leading_comments(),
- GetArena());
+ GetArenaForAllocation());
}
trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_trailing_comments()) {
trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_trailing_comments(),
- GetArena());
+ GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
}
@@ -9780,7 +9900,7 @@
}
void SourceCodeInfo_Location::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
leading_comments_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
trailing_comments_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -10097,13 +10217,21 @@
void SourceCodeInfo_Location::InternalSwap(SourceCodeInfo_Location* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
path_.InternalSwap(&other->path_);
span_.InternalSwap(&other->span_);
leading_detached_comments_.InternalSwap(&other->leading_detached_comments_);
- leading_comments_.Swap(&other->leading_comments_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- trailing_comments_.Swap(&other->trailing_comments_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &leading_comments_, GetArenaForAllocation(),
+ &other->leading_comments_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &trailing_comments_, GetArenaForAllocation(),
+ &other->trailing_comments_, other->GetArenaForAllocation()
+ );
}
::PROTOBUF_NAMESPACE_ID::Metadata SourceCodeInfo_Location::GetMetadata() const {
@@ -10142,7 +10270,7 @@
}
void SourceCodeInfo::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void SourceCodeInfo::ArenaDtor(void* object) {
@@ -10297,7 +10425,7 @@
void SourceCodeInfo::InternalSwap(SourceCodeInfo* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
location_.InternalSwap(&other->location_);
}
@@ -10338,7 +10466,7 @@
source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (from._internal_has_source_file()) {
source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_source_file(),
- GetArena());
+ GetArenaForAllocation());
}
::memcpy(&begin_, &from.begin_,
static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -10361,7 +10489,7 @@
}
void GeneratedCodeInfo_Annotation::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
source_file_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -10623,10 +10751,14 @@
void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(_has_bits_[0], other->_has_bits_[0]);
path_.InternalSwap(&other->path_);
- source_file_.Swap(&other->source_file_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &source_file_, GetArenaForAllocation(),
+ &other->source_file_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_)
+ sizeof(GeneratedCodeInfo_Annotation::end_)
@@ -10671,7 +10803,7 @@
}
void GeneratedCodeInfo::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void GeneratedCodeInfo::ArenaDtor(void* object) {
@@ -10826,7 +10958,7 @@
void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
annotation_.InternalSwap(&other->annotation_);
}
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 861cc4a..6823c09 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -329,7 +329,7 @@
}
// ===================================================================
-class PROTOBUF_EXPORT FileDescriptorSet PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FileDescriptorSet final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileDescriptorSet) */ {
public:
inline FileDescriptorSet() : FileDescriptorSet(nullptr) {}
@@ -347,8 +347,9 @@
return *this;
}
inline FileDescriptorSet& operator=(FileDescriptorSet&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -386,7 +387,7 @@
}
inline void Swap(FileDescriptorSet* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -394,14 +395,14 @@
}
void UnsafeArenaSwap(FileDescriptorSet* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FileDescriptorSet* New() const final {
- return CreateMaybeMessage<FileDescriptorSet>(nullptr);
+ return new FileDescriptorSet();
}
FileDescriptorSet* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -421,8 +422,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FileDescriptorSet* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -476,7 +477,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT FileDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FileDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileDescriptorProto) */ {
public:
inline FileDescriptorProto() : FileDescriptorProto(nullptr) {}
@@ -494,8 +495,9 @@
return *this;
}
inline FileDescriptorProto& operator=(FileDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -533,7 +535,7 @@
}
inline void Swap(FileDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -541,14 +543,14 @@
}
void UnsafeArenaSwap(FileDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FileDescriptorProto* New() const final {
- return CreateMaybeMessage<FileDescriptorProto>(nullptr);
+ return new FileDescriptorProto();
}
FileDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -568,8 +570,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FileDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -753,11 +755,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -771,11 +773,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_package(ArgT0&& arg0, ArgT... args);
std::string* mutable_package();
- std::string* release_package();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_package();
void set_allocated_package(std::string* package);
private:
const std::string& _internal_package() const;
- void _internal_set_package(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_package(const std::string& value);
std::string* _internal_mutable_package();
public:
@@ -789,11 +791,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_syntax(ArgT0&& arg0, ArgT... args);
std::string* mutable_syntax();
- std::string* release_syntax();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_syntax();
void set_allocated_syntax(std::string* syntax);
private:
const std::string& _internal_syntax() const;
- void _internal_set_syntax(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_syntax(const std::string& value);
std::string* _internal_mutable_syntax();
public:
@@ -804,7 +806,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::FileOptions& options() const;
- PROTOBUF_NAMESPACE_ID::FileOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::FileOptions* release_options();
PROTOBUF_NAMESPACE_ID::FileOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::FileOptions* options);
private:
@@ -822,7 +824,7 @@
public:
void clear_source_code_info();
const PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info() const;
- PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info();
PROTOBUF_NAMESPACE_ID::SourceCodeInfo* mutable_source_code_info();
void set_allocated_source_code_info(PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info);
private:
@@ -858,7 +860,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT DescriptorProto_ExtensionRange PROTOBUF_FINAL :
+class PROTOBUF_EXPORT DescriptorProto_ExtensionRange final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto.ExtensionRange) */ {
public:
inline DescriptorProto_ExtensionRange() : DescriptorProto_ExtensionRange(nullptr) {}
@@ -876,8 +878,9 @@
return *this;
}
inline DescriptorProto_ExtensionRange& operator=(DescriptorProto_ExtensionRange&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -915,7 +918,7 @@
}
inline void Swap(DescriptorProto_ExtensionRange* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -923,14 +926,14 @@
}
void UnsafeArenaSwap(DescriptorProto_ExtensionRange* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline DescriptorProto_ExtensionRange* New() const final {
- return CreateMaybeMessage<DescriptorProto_ExtensionRange>(nullptr);
+ return new DescriptorProto_ExtensionRange();
}
DescriptorProto_ExtensionRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -950,8 +953,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(DescriptorProto_ExtensionRange* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -983,7 +986,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options() const;
- PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options();
PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options);
private:
@@ -1036,7 +1039,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT DescriptorProto_ReservedRange PROTOBUF_FINAL :
+class PROTOBUF_EXPORT DescriptorProto_ReservedRange final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto.ReservedRange) */ {
public:
inline DescriptorProto_ReservedRange() : DescriptorProto_ReservedRange(nullptr) {}
@@ -1054,8 +1057,9 @@
return *this;
}
inline DescriptorProto_ReservedRange& operator=(DescriptorProto_ReservedRange&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1093,7 +1097,7 @@
}
inline void Swap(DescriptorProto_ReservedRange* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1101,14 +1105,14 @@
}
void UnsafeArenaSwap(DescriptorProto_ReservedRange* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline DescriptorProto_ReservedRange* New() const final {
- return CreateMaybeMessage<DescriptorProto_ReservedRange>(nullptr);
+ return new DescriptorProto_ReservedRange();
}
DescriptorProto_ReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1128,8 +1132,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(DescriptorProto_ReservedRange* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1194,7 +1198,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT DescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT DescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DescriptorProto) */ {
public:
inline DescriptorProto() : DescriptorProto(nullptr) {}
@@ -1212,8 +1216,9 @@
return *this;
}
inline DescriptorProto& operator=(DescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1251,7 +1256,7 @@
}
inline void Swap(DescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1259,14 +1264,14 @@
}
void UnsafeArenaSwap(DescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline DescriptorProto* New() const final {
- return CreateMaybeMessage<DescriptorProto>(nullptr);
+ return new DescriptorProto();
}
DescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1286,8 +1291,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(DescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1482,11 +1487,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -1497,7 +1502,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::MessageOptions& options() const;
- PROTOBUF_NAMESPACE_ID::MessageOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::MessageOptions* release_options();
PROTOBUF_NAMESPACE_ID::MessageOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::MessageOptions* options);
private:
@@ -1531,7 +1536,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT ExtensionRangeOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT ExtensionRangeOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ExtensionRangeOptions) */ {
public:
inline ExtensionRangeOptions() : ExtensionRangeOptions(nullptr) {}
@@ -1549,8 +1554,9 @@
return *this;
}
inline ExtensionRangeOptions& operator=(ExtensionRangeOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1588,7 +1594,7 @@
}
inline void Swap(ExtensionRangeOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1596,14 +1602,14 @@
}
void UnsafeArenaSwap(ExtensionRangeOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline ExtensionRangeOptions* New() const final {
- return CreateMaybeMessage<ExtensionRangeOptions>(nullptr);
+ return new ExtensionRangeOptions();
}
ExtensionRangeOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1623,8 +1629,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ExtensionRangeOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1681,7 +1687,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT FieldDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FieldDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldDescriptorProto) */ {
public:
inline FieldDescriptorProto() : FieldDescriptorProto(nullptr) {}
@@ -1699,8 +1705,9 @@
return *this;
}
inline FieldDescriptorProto& operator=(FieldDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1738,7 +1745,7 @@
}
inline void Swap(FieldDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1746,14 +1753,14 @@
}
void UnsafeArenaSwap(FieldDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FieldDescriptorProto* New() const final {
- return CreateMaybeMessage<FieldDescriptorProto>(nullptr);
+ return new FieldDescriptorProto();
}
FieldDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1773,8 +1780,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FieldDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1911,11 +1918,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -1929,11 +1936,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_extendee(ArgT0&& arg0, ArgT... args);
std::string* mutable_extendee();
- std::string* release_extendee();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_extendee();
void set_allocated_extendee(std::string* extendee);
private:
const std::string& _internal_extendee() const;
- void _internal_set_extendee(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_extendee(const std::string& value);
std::string* _internal_mutable_extendee();
public:
@@ -1947,11 +1954,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_type_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_type_name();
- std::string* release_type_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_type_name();
void set_allocated_type_name(std::string* type_name);
private:
const std::string& _internal_type_name() const;
- void _internal_set_type_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_name(const std::string& value);
std::string* _internal_mutable_type_name();
public:
@@ -1965,11 +1972,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_default_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_default_value();
- std::string* release_default_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_default_value();
void set_allocated_default_value(std::string* default_value);
private:
const std::string& _internal_default_value() const;
- void _internal_set_default_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_default_value(const std::string& value);
std::string* _internal_mutable_default_value();
public:
@@ -1983,11 +1990,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_json_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_json_name();
- std::string* release_json_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_json_name();
void set_allocated_json_name(std::string* json_name);
private:
const std::string& _internal_json_name() const;
- void _internal_set_json_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_json_name(const std::string& value);
std::string* _internal_mutable_json_name();
public:
@@ -1998,7 +2005,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::FieldOptions& options() const;
- PROTOBUF_NAMESPACE_ID::FieldOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::FieldOptions* release_options();
PROTOBUF_NAMESPACE_ID::FieldOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::FieldOptions* options);
private:
@@ -2098,7 +2105,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT OneofDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT OneofDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.OneofDescriptorProto) */ {
public:
inline OneofDescriptorProto() : OneofDescriptorProto(nullptr) {}
@@ -2116,8 +2123,9 @@
return *this;
}
inline OneofDescriptorProto& operator=(OneofDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -2155,7 +2163,7 @@
}
inline void Swap(OneofDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2163,14 +2171,14 @@
}
void UnsafeArenaSwap(OneofDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline OneofDescriptorProto* New() const final {
- return CreateMaybeMessage<OneofDescriptorProto>(nullptr);
+ return new OneofDescriptorProto();
}
OneofDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -2190,8 +2198,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(OneofDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -2225,11 +2233,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -2240,7 +2248,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::OneofOptions& options() const;
- PROTOBUF_NAMESPACE_ID::OneofOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::OneofOptions* release_options();
PROTOBUF_NAMESPACE_ID::OneofOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::OneofOptions* options);
private:
@@ -2266,7 +2274,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange PROTOBUF_FINAL :
+class PROTOBUF_EXPORT EnumDescriptorProto_EnumReservedRange final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto.EnumReservedRange) */ {
public:
inline EnumDescriptorProto_EnumReservedRange() : EnumDescriptorProto_EnumReservedRange(nullptr) {}
@@ -2284,8 +2292,9 @@
return *this;
}
inline EnumDescriptorProto_EnumReservedRange& operator=(EnumDescriptorProto_EnumReservedRange&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -2323,7 +2332,7 @@
}
inline void Swap(EnumDescriptorProto_EnumReservedRange* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2331,14 +2340,14 @@
}
void UnsafeArenaSwap(EnumDescriptorProto_EnumReservedRange* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline EnumDescriptorProto_EnumReservedRange* New() const final {
- return CreateMaybeMessage<EnumDescriptorProto_EnumReservedRange>(nullptr);
+ return new EnumDescriptorProto_EnumReservedRange();
}
EnumDescriptorProto_EnumReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -2358,8 +2367,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(EnumDescriptorProto_EnumReservedRange* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -2424,7 +2433,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT EnumDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT EnumDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumDescriptorProto) */ {
public:
inline EnumDescriptorProto() : EnumDescriptorProto(nullptr) {}
@@ -2442,8 +2451,9 @@
return *this;
}
inline EnumDescriptorProto& operator=(EnumDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -2481,7 +2491,7 @@
}
inline void Swap(EnumDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2489,14 +2499,14 @@
}
void UnsafeArenaSwap(EnumDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline EnumDescriptorProto* New() const final {
- return CreateMaybeMessage<EnumDescriptorProto>(nullptr);
+ return new EnumDescriptorProto();
}
EnumDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -2516,8 +2526,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(EnumDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -2616,11 +2626,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -2631,7 +2641,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::EnumOptions& options() const;
- PROTOBUF_NAMESPACE_ID::EnumOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::EnumOptions* release_options();
PROTOBUF_NAMESPACE_ID::EnumOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumOptions* options);
private:
@@ -2660,7 +2670,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT EnumValueDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT EnumValueDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValueDescriptorProto) */ {
public:
inline EnumValueDescriptorProto() : EnumValueDescriptorProto(nullptr) {}
@@ -2678,8 +2688,9 @@
return *this;
}
inline EnumValueDescriptorProto& operator=(EnumValueDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -2717,7 +2728,7 @@
}
inline void Swap(EnumValueDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2725,14 +2736,14 @@
}
void UnsafeArenaSwap(EnumValueDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline EnumValueDescriptorProto* New() const final {
- return CreateMaybeMessage<EnumValueDescriptorProto>(nullptr);
+ return new EnumValueDescriptorProto();
}
EnumValueDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -2752,8 +2763,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(EnumValueDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -2788,11 +2799,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -2803,7 +2814,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::EnumValueOptions& options() const;
- PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options();
PROTOBUF_NAMESPACE_ID::EnumValueOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumValueOptions* options);
private:
@@ -2843,7 +2854,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT ServiceDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT ServiceDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ServiceDescriptorProto) */ {
public:
inline ServiceDescriptorProto() : ServiceDescriptorProto(nullptr) {}
@@ -2861,8 +2872,9 @@
return *this;
}
inline ServiceDescriptorProto& operator=(ServiceDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -2900,7 +2912,7 @@
}
inline void Swap(ServiceDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2908,14 +2920,14 @@
}
void UnsafeArenaSwap(ServiceDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline ServiceDescriptorProto* New() const final {
- return CreateMaybeMessage<ServiceDescriptorProto>(nullptr);
+ return new ServiceDescriptorProto();
}
ServiceDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -2935,8 +2947,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ServiceDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -2989,11 +3001,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -3004,7 +3016,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::ServiceOptions& options() const;
- PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options();
PROTOBUF_NAMESPACE_ID::ServiceOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::ServiceOptions* options);
private:
@@ -3031,7 +3043,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT MethodDescriptorProto PROTOBUF_FINAL :
+class PROTOBUF_EXPORT MethodDescriptorProto final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MethodDescriptorProto) */ {
public:
inline MethodDescriptorProto() : MethodDescriptorProto(nullptr) {}
@@ -3049,8 +3061,9 @@
return *this;
}
inline MethodDescriptorProto& operator=(MethodDescriptorProto&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -3088,7 +3101,7 @@
}
inline void Swap(MethodDescriptorProto* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3096,14 +3109,14 @@
}
void UnsafeArenaSwap(MethodDescriptorProto* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline MethodDescriptorProto* New() const final {
- return CreateMaybeMessage<MethodDescriptorProto>(nullptr);
+ return new MethodDescriptorProto();
}
MethodDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -3123,8 +3136,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(MethodDescriptorProto* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -3162,11 +3175,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -3180,11 +3193,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_input_type(ArgT0&& arg0, ArgT... args);
std::string* mutable_input_type();
- std::string* release_input_type();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_input_type();
void set_allocated_input_type(std::string* input_type);
private:
const std::string& _internal_input_type() const;
- void _internal_set_input_type(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_input_type(const std::string& value);
std::string* _internal_mutable_input_type();
public:
@@ -3198,11 +3211,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_output_type(ArgT0&& arg0, ArgT... args);
std::string* mutable_output_type();
- std::string* release_output_type();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_output_type();
void set_allocated_output_type(std::string* output_type);
private:
const std::string& _internal_output_type() const;
- void _internal_set_output_type(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_output_type(const std::string& value);
std::string* _internal_mutable_output_type();
public:
@@ -3213,7 +3226,7 @@
public:
void clear_options();
const PROTOBUF_NAMESPACE_ID::MethodOptions& options() const;
- PROTOBUF_NAMESPACE_ID::MethodOptions* release_options();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::MethodOptions* release_options();
PROTOBUF_NAMESPACE_ID::MethodOptions* mutable_options();
void set_allocated_options(PROTOBUF_NAMESPACE_ID::MethodOptions* options);
private:
@@ -3269,7 +3282,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT FileOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FileOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FileOptions) */ {
public:
inline FileOptions() : FileOptions(nullptr) {}
@@ -3287,8 +3300,9 @@
return *this;
}
inline FileOptions& operator=(FileOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -3326,7 +3340,7 @@
}
inline void Swap(FileOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3334,14 +3348,14 @@
}
void UnsafeArenaSwap(FileOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FileOptions* New() const final {
- return CreateMaybeMessage<FileOptions>(nullptr);
+ return new FileOptions();
}
FileOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -3361,8 +3375,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FileOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -3465,11 +3479,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_java_package(ArgT0&& arg0, ArgT... args);
std::string* mutable_java_package();
- std::string* release_java_package();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_java_package();
void set_allocated_java_package(std::string* java_package);
private:
const std::string& _internal_java_package() const;
- void _internal_set_java_package(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_java_package(const std::string& value);
std::string* _internal_mutable_java_package();
public:
@@ -3483,11 +3497,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_java_outer_classname(ArgT0&& arg0, ArgT... args);
std::string* mutable_java_outer_classname();
- std::string* release_java_outer_classname();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_java_outer_classname();
void set_allocated_java_outer_classname(std::string* java_outer_classname);
private:
const std::string& _internal_java_outer_classname() const;
- void _internal_set_java_outer_classname(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_java_outer_classname(const std::string& value);
std::string* _internal_mutable_java_outer_classname();
public:
@@ -3501,11 +3515,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_go_package(ArgT0&& arg0, ArgT... args);
std::string* mutable_go_package();
- std::string* release_go_package();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_go_package();
void set_allocated_go_package(std::string* go_package);
private:
const std::string& _internal_go_package() const;
- void _internal_set_go_package(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_go_package(const std::string& value);
std::string* _internal_mutable_go_package();
public:
@@ -3519,11 +3533,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_objc_class_prefix(ArgT0&& arg0, ArgT... args);
std::string* mutable_objc_class_prefix();
- std::string* release_objc_class_prefix();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_objc_class_prefix();
void set_allocated_objc_class_prefix(std::string* objc_class_prefix);
private:
const std::string& _internal_objc_class_prefix() const;
- void _internal_set_objc_class_prefix(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_objc_class_prefix(const std::string& value);
std::string* _internal_mutable_objc_class_prefix();
public:
@@ -3537,11 +3551,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_csharp_namespace(ArgT0&& arg0, ArgT... args);
std::string* mutable_csharp_namespace();
- std::string* release_csharp_namespace();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_csharp_namespace();
void set_allocated_csharp_namespace(std::string* csharp_namespace);
private:
const std::string& _internal_csharp_namespace() const;
- void _internal_set_csharp_namespace(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_csharp_namespace(const std::string& value);
std::string* _internal_mutable_csharp_namespace();
public:
@@ -3555,11 +3569,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_swift_prefix(ArgT0&& arg0, ArgT... args);
std::string* mutable_swift_prefix();
- std::string* release_swift_prefix();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_swift_prefix();
void set_allocated_swift_prefix(std::string* swift_prefix);
private:
const std::string& _internal_swift_prefix() const;
- void _internal_set_swift_prefix(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_swift_prefix(const std::string& value);
std::string* _internal_mutable_swift_prefix();
public:
@@ -3573,11 +3587,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_php_class_prefix(ArgT0&& arg0, ArgT... args);
std::string* mutable_php_class_prefix();
- std::string* release_php_class_prefix();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_php_class_prefix();
void set_allocated_php_class_prefix(std::string* php_class_prefix);
private:
const std::string& _internal_php_class_prefix() const;
- void _internal_set_php_class_prefix(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_php_class_prefix(const std::string& value);
std::string* _internal_mutable_php_class_prefix();
public:
@@ -3591,11 +3605,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_php_namespace(ArgT0&& arg0, ArgT... args);
std::string* mutable_php_namespace();
- std::string* release_php_namespace();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_php_namespace();
void set_allocated_php_namespace(std::string* php_namespace);
private:
const std::string& _internal_php_namespace() const;
- void _internal_set_php_namespace(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_php_namespace(const std::string& value);
std::string* _internal_mutable_php_namespace();
public:
@@ -3609,11 +3623,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_php_metadata_namespace(ArgT0&& arg0, ArgT... args);
std::string* mutable_php_metadata_namespace();
- std::string* release_php_metadata_namespace();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_php_metadata_namespace();
void set_allocated_php_metadata_namespace(std::string* php_metadata_namespace);
private:
const std::string& _internal_php_metadata_namespace() const;
- void _internal_set_php_metadata_namespace(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_php_metadata_namespace(const std::string& value);
std::string* _internal_mutable_php_metadata_namespace();
public:
@@ -3627,11 +3641,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_ruby_package(ArgT0&& arg0, ArgT... args);
std::string* mutable_ruby_package();
- std::string* release_ruby_package();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_ruby_package();
void set_allocated_ruby_package(std::string* ruby_package);
private:
const std::string& _internal_ruby_package() const;
- void _internal_set_ruby_package(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_ruby_package(const std::string& value);
std::string* _internal_mutable_ruby_package();
public:
@@ -3802,7 +3816,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT MessageOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT MessageOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MessageOptions) */ {
public:
inline MessageOptions() : MessageOptions(nullptr) {}
@@ -3820,8 +3834,9 @@
return *this;
}
inline MessageOptions& operator=(MessageOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -3859,7 +3874,7 @@
}
inline void Swap(MessageOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3867,14 +3882,14 @@
}
void UnsafeArenaSwap(MessageOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline MessageOptions* New() const final {
- return CreateMaybeMessage<MessageOptions>(nullptr);
+ return new MessageOptions();
}
MessageOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -3894,8 +3909,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(MessageOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -4013,7 +4028,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT FieldOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FieldOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldOptions) */ {
public:
inline FieldOptions() : FieldOptions(nullptr) {}
@@ -4031,8 +4046,9 @@
return *this;
}
inline FieldOptions& operator=(FieldOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -4070,7 +4086,7 @@
}
inline void Swap(FieldOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4078,14 +4094,14 @@
}
void UnsafeArenaSwap(FieldOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FieldOptions* New() const final {
- return CreateMaybeMessage<FieldOptions>(nullptr);
+ return new FieldOptions();
}
FieldOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -4105,8 +4121,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FieldOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -4318,7 +4334,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT OneofOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT OneofOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.OneofOptions) */ {
public:
inline OneofOptions() : OneofOptions(nullptr) {}
@@ -4336,8 +4352,9 @@
return *this;
}
inline OneofOptions& operator=(OneofOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -4375,7 +4392,7 @@
}
inline void Swap(OneofOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4383,14 +4400,14 @@
}
void UnsafeArenaSwap(OneofOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline OneofOptions* New() const final {
- return CreateMaybeMessage<OneofOptions>(nullptr);
+ return new OneofOptions();
}
OneofOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -4410,8 +4427,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(OneofOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -4468,7 +4485,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT EnumOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT EnumOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumOptions) */ {
public:
inline EnumOptions() : EnumOptions(nullptr) {}
@@ -4486,8 +4503,9 @@
return *this;
}
inline EnumOptions& operator=(EnumOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -4525,7 +4543,7 @@
}
inline void Swap(EnumOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4533,14 +4551,14 @@
}
void UnsafeArenaSwap(EnumOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline EnumOptions* New() const final {
- return CreateMaybeMessage<EnumOptions>(nullptr);
+ return new EnumOptions();
}
EnumOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -4560,8 +4578,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(EnumOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -4649,7 +4667,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT EnumValueOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT EnumValueOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValueOptions) */ {
public:
inline EnumValueOptions() : EnumValueOptions(nullptr) {}
@@ -4667,8 +4685,9 @@
return *this;
}
inline EnumValueOptions& operator=(EnumValueOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -4706,7 +4725,7 @@
}
inline void Swap(EnumValueOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4714,14 +4733,14 @@
}
void UnsafeArenaSwap(EnumValueOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline EnumValueOptions* New() const final {
- return CreateMaybeMessage<EnumValueOptions>(nullptr);
+ return new EnumValueOptions();
}
EnumValueOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -4741,8 +4760,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(EnumValueOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -4815,7 +4834,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT ServiceOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT ServiceOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ServiceOptions) */ {
public:
inline ServiceOptions() : ServiceOptions(nullptr) {}
@@ -4833,8 +4852,9 @@
return *this;
}
inline ServiceOptions& operator=(ServiceOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -4872,7 +4892,7 @@
}
inline void Swap(ServiceOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4880,14 +4900,14 @@
}
void UnsafeArenaSwap(ServiceOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline ServiceOptions* New() const final {
- return CreateMaybeMessage<ServiceOptions>(nullptr);
+ return new ServiceOptions();
}
ServiceOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -4907,8 +4927,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ServiceOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -4981,7 +5001,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT MethodOptions PROTOBUF_FINAL :
+class PROTOBUF_EXPORT MethodOptions final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.MethodOptions) */ {
public:
inline MethodOptions() : MethodOptions(nullptr) {}
@@ -4999,8 +5019,9 @@
return *this;
}
inline MethodOptions& operator=(MethodOptions&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -5038,7 +5059,7 @@
}
inline void Swap(MethodOptions* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5046,14 +5067,14 @@
}
void UnsafeArenaSwap(MethodOptions* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline MethodOptions* New() const final {
- return CreateMaybeMessage<MethodOptions>(nullptr);
+ return new MethodOptions();
}
MethodOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -5073,8 +5094,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(MethodOptions* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -5194,7 +5215,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT UninterpretedOption_NamePart PROTOBUF_FINAL :
+class PROTOBUF_EXPORT UninterpretedOption_NamePart final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UninterpretedOption.NamePart) */ {
public:
inline UninterpretedOption_NamePart() : UninterpretedOption_NamePart(nullptr) {}
@@ -5212,8 +5233,9 @@
return *this;
}
inline UninterpretedOption_NamePart& operator=(UninterpretedOption_NamePart&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -5251,7 +5273,7 @@
}
inline void Swap(UninterpretedOption_NamePart* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5259,14 +5281,14 @@
}
void UnsafeArenaSwap(UninterpretedOption_NamePart* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline UninterpretedOption_NamePart* New() const final {
- return CreateMaybeMessage<UninterpretedOption_NamePart>(nullptr);
+ return new UninterpretedOption_NamePart();
}
UninterpretedOption_NamePart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -5286,8 +5308,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(UninterpretedOption_NamePart* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -5321,11 +5343,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name_part(ArgT0&& arg0, ArgT... args);
std::string* mutable_name_part();
- std::string* release_name_part();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name_part();
void set_allocated_name_part(std::string* name_part);
private:
const std::string& _internal_name_part() const;
- void _internal_set_name_part(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name_part(const std::string& value);
std::string* _internal_mutable_name_part();
public:
@@ -5360,7 +5382,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT UninterpretedOption PROTOBUF_FINAL :
+class PROTOBUF_EXPORT UninterpretedOption final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UninterpretedOption) */ {
public:
inline UninterpretedOption() : UninterpretedOption(nullptr) {}
@@ -5378,8 +5400,9 @@
return *this;
}
inline UninterpretedOption& operator=(UninterpretedOption&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -5417,7 +5440,7 @@
}
inline void Swap(UninterpretedOption* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5425,14 +5448,14 @@
}
void UnsafeArenaSwap(UninterpretedOption* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline UninterpretedOption* New() const final {
- return CreateMaybeMessage<UninterpretedOption>(nullptr);
+ return new UninterpretedOption();
}
UninterpretedOption* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -5452,8 +5475,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(UninterpretedOption* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -5512,11 +5535,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_identifier_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_identifier_value();
- std::string* release_identifier_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_identifier_value();
void set_allocated_identifier_value(std::string* identifier_value);
private:
const std::string& _internal_identifier_value() const;
- void _internal_set_identifier_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_identifier_value(const std::string& value);
std::string* _internal_mutable_identifier_value();
public:
@@ -5530,11 +5553,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_string_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_string_value();
- std::string* release_string_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_string_value();
void set_allocated_string_value(std::string* string_value);
private:
const std::string& _internal_string_value() const;
- void _internal_set_string_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_value(const std::string& value);
std::string* _internal_mutable_string_value();
public:
@@ -5548,11 +5571,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_aggregate_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_aggregate_value();
- std::string* release_aggregate_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_aggregate_value();
void set_allocated_aggregate_value(std::string* aggregate_value);
private:
const std::string& _internal_aggregate_value() const;
- void _internal_set_aggregate_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_aggregate_value(const std::string& value);
std::string* _internal_mutable_aggregate_value();
public:
@@ -5615,7 +5638,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT SourceCodeInfo_Location PROTOBUF_FINAL :
+class PROTOBUF_EXPORT SourceCodeInfo_Location final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceCodeInfo.Location) */ {
public:
inline SourceCodeInfo_Location() : SourceCodeInfo_Location(nullptr) {}
@@ -5633,8 +5656,9 @@
return *this;
}
inline SourceCodeInfo_Location& operator=(SourceCodeInfo_Location&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -5672,7 +5696,7 @@
}
inline void Swap(SourceCodeInfo_Location* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5680,14 +5704,14 @@
}
void UnsafeArenaSwap(SourceCodeInfo_Location* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SourceCodeInfo_Location* New() const final {
- return CreateMaybeMessage<SourceCodeInfo_Location>(nullptr);
+ return new SourceCodeInfo_Location();
}
SourceCodeInfo_Location* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -5707,8 +5731,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SourceCodeInfo_Location* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -5813,11 +5837,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_leading_comments(ArgT0&& arg0, ArgT... args);
std::string* mutable_leading_comments();
- std::string* release_leading_comments();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_leading_comments();
void set_allocated_leading_comments(std::string* leading_comments);
private:
const std::string& _internal_leading_comments() const;
- void _internal_set_leading_comments(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_leading_comments(const std::string& value);
std::string* _internal_mutable_leading_comments();
public:
@@ -5831,11 +5855,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_trailing_comments(ArgT0&& arg0, ArgT... args);
std::string* mutable_trailing_comments();
- std::string* release_trailing_comments();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_trailing_comments();
void set_allocated_trailing_comments(std::string* trailing_comments);
private:
const std::string& _internal_trailing_comments() const;
- void _internal_set_trailing_comments(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_trailing_comments(const std::string& value);
std::string* _internal_mutable_trailing_comments();
public:
@@ -5859,7 +5883,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT SourceCodeInfo PROTOBUF_FINAL :
+class PROTOBUF_EXPORT SourceCodeInfo final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceCodeInfo) */ {
public:
inline SourceCodeInfo() : SourceCodeInfo(nullptr) {}
@@ -5877,8 +5901,9 @@
return *this;
}
inline SourceCodeInfo& operator=(SourceCodeInfo&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -5916,7 +5941,7 @@
}
inline void Swap(SourceCodeInfo* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5924,14 +5949,14 @@
}
void UnsafeArenaSwap(SourceCodeInfo* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SourceCodeInfo* New() const final {
- return CreateMaybeMessage<SourceCodeInfo>(nullptr);
+ return new SourceCodeInfo();
}
SourceCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -5951,8 +5976,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SourceCodeInfo* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -6008,7 +6033,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation PROTOBUF_FINAL :
+class PROTOBUF_EXPORT GeneratedCodeInfo_Annotation final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.GeneratedCodeInfo.Annotation) */ {
public:
inline GeneratedCodeInfo_Annotation() : GeneratedCodeInfo_Annotation(nullptr) {}
@@ -6026,8 +6051,9 @@
return *this;
}
inline GeneratedCodeInfo_Annotation& operator=(GeneratedCodeInfo_Annotation&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -6065,7 +6091,7 @@
}
inline void Swap(GeneratedCodeInfo_Annotation* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -6073,14 +6099,14 @@
}
void UnsafeArenaSwap(GeneratedCodeInfo_Annotation* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline GeneratedCodeInfo_Annotation* New() const final {
- return CreateMaybeMessage<GeneratedCodeInfo_Annotation>(nullptr);
+ return new GeneratedCodeInfo_Annotation();
}
GeneratedCodeInfo_Annotation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -6100,8 +6126,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(GeneratedCodeInfo_Annotation* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -6159,11 +6185,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_source_file(ArgT0&& arg0, ArgT... args);
std::string* mutable_source_file();
- std::string* release_source_file();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_source_file();
void set_allocated_source_file(std::string* source_file);
private:
const std::string& _internal_source_file() const;
- void _internal_set_source_file(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_source_file(const std::string& value);
std::string* _internal_mutable_source_file();
public:
@@ -6211,7 +6237,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT GeneratedCodeInfo PROTOBUF_FINAL :
+class PROTOBUF_EXPORT GeneratedCodeInfo final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.GeneratedCodeInfo) */ {
public:
inline GeneratedCodeInfo() : GeneratedCodeInfo(nullptr) {}
@@ -6229,8 +6255,9 @@
return *this;
}
inline GeneratedCodeInfo& operator=(GeneratedCodeInfo&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -6268,7 +6295,7 @@
}
inline void Swap(GeneratedCodeInfo* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -6276,14 +6303,14 @@
}
void UnsafeArenaSwap(GeneratedCodeInfo* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline GeneratedCodeInfo* New() const final {
- return CreateMaybeMessage<GeneratedCodeInfo>(nullptr);
+ return new GeneratedCodeInfo();
}
GeneratedCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -6303,8 +6330,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(GeneratedCodeInfo* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -6429,10 +6456,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.name)
}
inline std::string* FileDescriptorProto::mutable_name() {
@@ -6444,11 +6471,11 @@
}
inline void FileDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.name)
@@ -6456,7 +6483,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -6465,7 +6492,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
}
@@ -6486,10 +6513,10 @@
return _internal_package();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileDescriptorProto::set_package(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileDescriptorProto::set_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.package)
}
inline std::string* FileDescriptorProto::mutable_package() {
@@ -6501,11 +6528,11 @@
}
inline void FileDescriptorProto::_internal_set_package(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::_internal_mutable_package() {
_has_bits_[0] |= 0x00000002u;
- return package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::release_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.package)
@@ -6513,7 +6540,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileDescriptorProto::set_allocated_package(std::string* package) {
if (package != nullptr) {
@@ -6522,7 +6549,7 @@
_has_bits_[0] &= ~0x00000002u;
}
package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), package,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
}
@@ -6874,7 +6901,7 @@
}
inline void FileDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::FileOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -6889,7 +6916,7 @@
_has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::FileOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -6904,7 +6931,7 @@
inline PROTOBUF_NAMESPACE_ID::FileOptions* FileDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000008u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FileOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FileOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -6914,13 +6941,13 @@
return _internal_mutable_options();
}
inline void FileDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::FileOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::FileOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -6957,7 +6984,7 @@
}
inline void FileDescriptorProto::unsafe_arena_set_allocated_source_code_info(
PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_code_info_);
}
source_code_info_ = source_code_info;
@@ -6972,7 +6999,7 @@
_has_bits_[0] &= ~0x00000010u;
PROTOBUF_NAMESPACE_ID::SourceCodeInfo* temp = source_code_info_;
source_code_info_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -6987,7 +7014,7 @@
inline PROTOBUF_NAMESPACE_ID::SourceCodeInfo* FileDescriptorProto::_internal_mutable_source_code_info() {
_has_bits_[0] |= 0x00000010u;
if (source_code_info_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceCodeInfo>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceCodeInfo>(GetArenaForAllocation());
source_code_info_ = p;
}
return source_code_info_;
@@ -6997,13 +7024,13 @@
return _internal_mutable_source_code_info();
}
inline void FileDescriptorProto::set_allocated_source_code_info(PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete source_code_info_;
}
if (source_code_info) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(source_code_info);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::SourceCodeInfo>::GetOwningArena(source_code_info);
if (message_arena != submessage_arena) {
source_code_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, source_code_info, submessage_arena);
@@ -7033,10 +7060,10 @@
return _internal_syntax();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileDescriptorProto::set_syntax(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileDescriptorProto::set_syntax(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.syntax)
}
inline std::string* FileDescriptorProto::mutable_syntax() {
@@ -7048,11 +7075,11 @@
}
inline void FileDescriptorProto::_internal_set_syntax(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::_internal_mutable_syntax() {
_has_bits_[0] |= 0x00000004u;
- return syntax_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return syntax_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileDescriptorProto::release_syntax() {
// @@protoc_insertion_point(field_release:google.protobuf.FileDescriptorProto.syntax)
@@ -7060,7 +7087,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- return syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileDescriptorProto::set_allocated_syntax(std::string* syntax) {
if (syntax != nullptr) {
@@ -7069,7 +7096,7 @@
_has_bits_[0] &= ~0x00000004u;
}
syntax_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), syntax,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
}
@@ -7157,7 +7184,7 @@
}
inline void DescriptorProto_ExtensionRange::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -7172,7 +7199,7 @@
_has_bits_[0] &= ~0x00000001u;
PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -7187,7 +7214,7 @@
inline PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* DescriptorProto_ExtensionRange::_internal_mutable_options() {
_has_bits_[0] |= 0x00000001u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -7197,13 +7224,13 @@
return _internal_mutable_options();
}
inline void DescriptorProto_ExtensionRange::set_allocated_options(PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -7297,10 +7324,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void DescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void DescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.name)
}
inline std::string* DescriptorProto::mutable_name() {
@@ -7312,11 +7339,11 @@
}
inline void DescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* DescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* DescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.DescriptorProto.name)
@@ -7324,7 +7351,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void DescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -7333,7 +7360,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
}
@@ -7595,7 +7622,7 @@
}
inline void DescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::MessageOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -7610,7 +7637,7 @@
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::MessageOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -7625,7 +7652,7 @@
inline PROTOBUF_NAMESPACE_ID::MessageOptions* DescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000002u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MessageOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MessageOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -7635,13 +7662,13 @@
return _internal_mutable_options();
}
inline void DescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::MessageOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::MessageOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -7831,10 +7858,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FieldDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FieldDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.name)
}
inline std::string* FieldDescriptorProto::mutable_name() {
@@ -7846,11 +7873,11 @@
}
inline void FieldDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.name)
@@ -7858,7 +7885,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FieldDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -7867,7 +7894,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
}
@@ -7974,10 +8001,10 @@
return _internal_type_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FieldDescriptorProto::set_type_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FieldDescriptorProto::set_type_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.type_name)
}
inline std::string* FieldDescriptorProto::mutable_type_name() {
@@ -7989,11 +8016,11 @@
}
inline void FieldDescriptorProto::_internal_set_type_name(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_type_name() {
_has_bits_[0] |= 0x00000004u;
- return type_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return type_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_type_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.type_name)
@@ -8001,7 +8028,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- return type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FieldDescriptorProto::set_allocated_type_name(std::string* type_name) {
if (type_name != nullptr) {
@@ -8010,7 +8037,7 @@
_has_bits_[0] &= ~0x00000004u;
}
type_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
}
@@ -8031,10 +8058,10 @@
return _internal_extendee();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FieldDescriptorProto::set_extendee(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FieldDescriptorProto::set_extendee(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.extendee)
}
inline std::string* FieldDescriptorProto::mutable_extendee() {
@@ -8046,11 +8073,11 @@
}
inline void FieldDescriptorProto::_internal_set_extendee(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_extendee() {
_has_bits_[0] |= 0x00000002u;
- return extendee_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return extendee_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_extendee() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.extendee)
@@ -8058,7 +8085,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FieldDescriptorProto::set_allocated_extendee(std::string* extendee) {
if (extendee != nullptr) {
@@ -8067,7 +8094,7 @@
_has_bits_[0] &= ~0x00000002u;
}
extendee_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), extendee,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
}
@@ -8088,10 +8115,10 @@
return _internal_default_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FieldDescriptorProto::set_default_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FieldDescriptorProto::set_default_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000008u;
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.default_value)
}
inline std::string* FieldDescriptorProto::mutable_default_value() {
@@ -8103,11 +8130,11 @@
}
inline void FieldDescriptorProto::_internal_set_default_value(const std::string& value) {
_has_bits_[0] |= 0x00000008u;
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_default_value() {
_has_bits_[0] |= 0x00000008u;
- return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_default_value() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.default_value)
@@ -8115,7 +8142,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000008u;
- return default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FieldDescriptorProto::set_allocated_default_value(std::string* default_value) {
if (default_value != nullptr) {
@@ -8124,7 +8151,7 @@
_has_bits_[0] &= ~0x00000008u;
}
default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
}
@@ -8173,10 +8200,10 @@
return _internal_json_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FieldDescriptorProto::set_json_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FieldDescriptorProto::set_json_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000010u;
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.json_name)
}
inline std::string* FieldDescriptorProto::mutable_json_name() {
@@ -8188,11 +8215,11 @@
}
inline void FieldDescriptorProto::_internal_set_json_name(const std::string& value) {
_has_bits_[0] |= 0x00000010u;
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::_internal_mutable_json_name() {
_has_bits_[0] |= 0x00000010u;
- return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FieldDescriptorProto::release_json_name() {
// @@protoc_insertion_point(field_release:google.protobuf.FieldDescriptorProto.json_name)
@@ -8200,7 +8227,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000010u;
- return json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FieldDescriptorProto::set_allocated_json_name(std::string* json_name) {
if (json_name != nullptr) {
@@ -8209,7 +8236,7 @@
_has_bits_[0] &= ~0x00000010u;
}
json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
}
@@ -8237,7 +8264,7 @@
}
inline void FieldDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::FieldOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -8252,7 +8279,7 @@
_has_bits_[0] &= ~0x00000020u;
PROTOBUF_NAMESPACE_ID::FieldOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -8267,7 +8294,7 @@
inline PROTOBUF_NAMESPACE_ID::FieldOptions* FieldDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000020u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::FieldOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -8277,13 +8304,13 @@
return _internal_mutable_options();
}
inline void FieldDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::FieldOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::FieldOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -8345,10 +8372,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void OneofDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void OneofDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.OneofDescriptorProto.name)
}
inline std::string* OneofDescriptorProto::mutable_name() {
@@ -8360,11 +8387,11 @@
}
inline void OneofDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* OneofDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* OneofDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.OneofDescriptorProto.name)
@@ -8372,7 +8399,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void OneofDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -8381,7 +8408,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
}
@@ -8409,7 +8436,7 @@
}
inline void OneofDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::OneofOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -8424,7 +8451,7 @@
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::OneofOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -8439,7 +8466,7 @@
inline PROTOBUF_NAMESPACE_ID::OneofOptions* OneofDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000002u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::OneofOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::OneofOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -8449,13 +8476,13 @@
return _internal_mutable_options();
}
inline void OneofDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::OneofOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::OneofOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -8549,10 +8576,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void EnumDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void EnumDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.name)
}
inline std::string* EnumDescriptorProto::mutable_name() {
@@ -8564,11 +8591,11 @@
}
inline void EnumDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* EnumDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* EnumDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumDescriptorProto.name)
@@ -8576,7 +8603,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void EnumDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -8585,7 +8612,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
}
@@ -8652,7 +8679,7 @@
}
inline void EnumDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::EnumOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -8667,7 +8694,7 @@
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::EnumOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -8682,7 +8709,7 @@
inline PROTOBUF_NAMESPACE_ID::EnumOptions* EnumDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000002u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -8692,13 +8719,13 @@
return _internal_mutable_options();
}
inline void EnumDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::EnumOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -8845,10 +8872,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void EnumValueDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void EnumValueDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.name)
}
inline std::string* EnumValueDescriptorProto::mutable_name() {
@@ -8860,11 +8887,11 @@
}
inline void EnumValueDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* EnumValueDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* EnumValueDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValueDescriptorProto.name)
@@ -8872,7 +8899,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void EnumValueDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -8881,7 +8908,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
}
@@ -8937,7 +8964,7 @@
}
inline void EnumValueDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -8952,7 +8979,7 @@
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::EnumValueOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -8967,7 +8994,7 @@
inline PROTOBUF_NAMESPACE_ID::EnumValueOptions* EnumValueDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000002u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumValueOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::EnumValueOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -8977,13 +9004,13 @@
return _internal_mutable_options();
}
inline void EnumValueDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::EnumValueOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::EnumValueOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -9017,10 +9044,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void ServiceDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void ServiceDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.ServiceDescriptorProto.name)
}
inline std::string* ServiceDescriptorProto::mutable_name() {
@@ -9032,11 +9059,11 @@
}
inline void ServiceDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* ServiceDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* ServiceDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.ServiceDescriptorProto.name)
@@ -9044,7 +9071,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void ServiceDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -9053,7 +9080,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
}
@@ -9120,7 +9147,7 @@
}
inline void ServiceDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::ServiceOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -9135,7 +9162,7 @@
_has_bits_[0] &= ~0x00000002u;
PROTOBUF_NAMESPACE_ID::ServiceOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -9150,7 +9177,7 @@
inline PROTOBUF_NAMESPACE_ID::ServiceOptions* ServiceDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000002u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ServiceOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::ServiceOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -9160,13 +9187,13 @@
return _internal_mutable_options();
}
inline void ServiceDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::ServiceOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::ServiceOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -9200,10 +9227,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void MethodDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void MethodDescriptorProto::set_name(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.name)
}
inline std::string* MethodDescriptorProto::mutable_name() {
@@ -9215,11 +9242,11 @@
}
inline void MethodDescriptorProto::_internal_set_name(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::_internal_mutable_name() {
_has_bits_[0] |= 0x00000001u;
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.name)
@@ -9227,7 +9254,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void MethodDescriptorProto::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -9236,7 +9263,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
}
@@ -9257,10 +9284,10 @@
return _internal_input_type();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void MethodDescriptorProto::set_input_type(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void MethodDescriptorProto::set_input_type(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.input_type)
}
inline std::string* MethodDescriptorProto::mutable_input_type() {
@@ -9272,11 +9299,11 @@
}
inline void MethodDescriptorProto::_internal_set_input_type(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::_internal_mutable_input_type() {
_has_bits_[0] |= 0x00000002u;
- return input_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return input_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::release_input_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.input_type)
@@ -9284,7 +9311,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void MethodDescriptorProto::set_allocated_input_type(std::string* input_type) {
if (input_type != nullptr) {
@@ -9293,7 +9320,7 @@
_has_bits_[0] &= ~0x00000002u;
}
input_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), input_type,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
}
@@ -9314,10 +9341,10 @@
return _internal_output_type();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void MethodDescriptorProto::set_output_type(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void MethodDescriptorProto::set_output_type(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.MethodDescriptorProto.output_type)
}
inline std::string* MethodDescriptorProto::mutable_output_type() {
@@ -9329,11 +9356,11 @@
}
inline void MethodDescriptorProto::_internal_set_output_type(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::_internal_mutable_output_type() {
_has_bits_[0] |= 0x00000004u;
- return output_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return output_type_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* MethodDescriptorProto::release_output_type() {
// @@protoc_insertion_point(field_release:google.protobuf.MethodDescriptorProto.output_type)
@@ -9341,7 +9368,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- return output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void MethodDescriptorProto::set_allocated_output_type(std::string* output_type) {
if (output_type != nullptr) {
@@ -9350,7 +9377,7 @@
_has_bits_[0] &= ~0x00000004u;
}
output_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), output_type,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
}
@@ -9378,7 +9405,7 @@
}
inline void MethodDescriptorProto::unsafe_arena_set_allocated_options(
PROTOBUF_NAMESPACE_ID::MethodOptions* options) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(options_);
}
options_ = options;
@@ -9393,7 +9420,7 @@
_has_bits_[0] &= ~0x00000008u;
PROTOBUF_NAMESPACE_ID::MethodOptions* temp = options_;
options_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -9408,7 +9435,7 @@
inline PROTOBUF_NAMESPACE_ID::MethodOptions* MethodDescriptorProto::_internal_mutable_options() {
_has_bits_[0] |= 0x00000008u;
if (options_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MethodOptions>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::MethodOptions>(GetArenaForAllocation());
options_ = p;
}
return options_;
@@ -9418,13 +9445,13 @@
return _internal_mutable_options();
}
inline void MethodDescriptorProto::set_allocated_options(PROTOBUF_NAMESPACE_ID::MethodOptions* options) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete options_;
}
if (options) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(options);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::MethodOptions>::GetOwningArena(options);
if (message_arena != submessage_arena) {
options = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, options, submessage_arena);
@@ -9514,10 +9541,10 @@
return _internal_java_package();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_java_package(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_java_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_package)
}
inline std::string* FileOptions::mutable_java_package() {
@@ -9529,11 +9556,11 @@
}
inline void FileOptions::_internal_set_java_package(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_java_package() {
_has_bits_[0] |= 0x00000001u;
- return java_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return java_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_java_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_package)
@@ -9541,7 +9568,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_java_package(std::string* java_package) {
if (java_package != nullptr) {
@@ -9550,7 +9577,7 @@
_has_bits_[0] &= ~0x00000001u;
}
java_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_package,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
}
@@ -9571,10 +9598,10 @@
return _internal_java_outer_classname();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_java_outer_classname(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_java_outer_classname(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.java_outer_classname)
}
inline std::string* FileOptions::mutable_java_outer_classname() {
@@ -9586,11 +9613,11 @@
}
inline void FileOptions::_internal_set_java_outer_classname(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_java_outer_classname() {
_has_bits_[0] |= 0x00000002u;
- return java_outer_classname_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return java_outer_classname_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_java_outer_classname() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.java_outer_classname)
@@ -9598,7 +9625,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_java_outer_classname(std::string* java_outer_classname) {
if (java_outer_classname != nullptr) {
@@ -9607,7 +9634,7 @@
_has_bits_[0] &= ~0x00000002u;
}
java_outer_classname_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_outer_classname,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
}
@@ -9741,10 +9768,10 @@
return _internal_go_package();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_go_package(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_go_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.go_package)
}
inline std::string* FileOptions::mutable_go_package() {
@@ -9756,11 +9783,11 @@
}
inline void FileOptions::_internal_set_go_package(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_go_package() {
_has_bits_[0] |= 0x00000004u;
- return go_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return go_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_go_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.go_package)
@@ -9768,7 +9795,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- return go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_go_package(std::string* go_package) {
if (go_package != nullptr) {
@@ -9777,7 +9804,7 @@
_has_bits_[0] &= ~0x00000004u;
}
go_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), go_package,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
}
@@ -9966,10 +9993,10 @@
return _internal_objc_class_prefix();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_objc_class_prefix(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_objc_class_prefix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000008u;
- objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.objc_class_prefix)
}
inline std::string* FileOptions::mutable_objc_class_prefix() {
@@ -9981,11 +10008,11 @@
}
inline void FileOptions::_internal_set_objc_class_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000008u;
- objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_objc_class_prefix() {
_has_bits_[0] |= 0x00000008u;
- return objc_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return objc_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_objc_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.objc_class_prefix)
@@ -9993,7 +10020,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000008u;
- return objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_objc_class_prefix(std::string* objc_class_prefix) {
if (objc_class_prefix != nullptr) {
@@ -10002,7 +10029,7 @@
_has_bits_[0] &= ~0x00000008u;
}
objc_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), objc_class_prefix,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
}
@@ -10023,10 +10050,10 @@
return _internal_csharp_namespace();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_csharp_namespace(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_csharp_namespace(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000010u;
- csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace)
}
inline std::string* FileOptions::mutable_csharp_namespace() {
@@ -10038,11 +10065,11 @@
}
inline void FileOptions::_internal_set_csharp_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000010u;
- csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_csharp_namespace() {
_has_bits_[0] |= 0x00000010u;
- return csharp_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return csharp_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_csharp_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.csharp_namespace)
@@ -10050,7 +10077,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000010u;
- return csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_csharp_namespace(std::string* csharp_namespace) {
if (csharp_namespace != nullptr) {
@@ -10059,7 +10086,7 @@
_has_bits_[0] &= ~0x00000010u;
}
csharp_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), csharp_namespace,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
}
@@ -10080,10 +10107,10 @@
return _internal_swift_prefix();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_swift_prefix(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_swift_prefix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000020u;
- swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.swift_prefix)
}
inline std::string* FileOptions::mutable_swift_prefix() {
@@ -10095,11 +10122,11 @@
}
inline void FileOptions::_internal_set_swift_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000020u;
- swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_swift_prefix() {
_has_bits_[0] |= 0x00000020u;
- return swift_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return swift_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_swift_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.swift_prefix)
@@ -10107,7 +10134,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000020u;
- return swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_swift_prefix(std::string* swift_prefix) {
if (swift_prefix != nullptr) {
@@ -10116,7 +10143,7 @@
_has_bits_[0] &= ~0x00000020u;
}
swift_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), swift_prefix,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
}
@@ -10137,10 +10164,10 @@
return _internal_php_class_prefix();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_php_class_prefix(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_php_class_prefix(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000040u;
- php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_class_prefix)
}
inline std::string* FileOptions::mutable_php_class_prefix() {
@@ -10152,11 +10179,11 @@
}
inline void FileOptions::_internal_set_php_class_prefix(const std::string& value) {
_has_bits_[0] |= 0x00000040u;
- php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_php_class_prefix() {
_has_bits_[0] |= 0x00000040u;
- return php_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return php_class_prefix_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_php_class_prefix() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_class_prefix)
@@ -10164,7 +10191,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000040u;
- return php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_php_class_prefix(std::string* php_class_prefix) {
if (php_class_prefix != nullptr) {
@@ -10173,7 +10200,7 @@
_has_bits_[0] &= ~0x00000040u;
}
php_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_class_prefix,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
}
@@ -10194,10 +10221,10 @@
return _internal_php_namespace();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_php_namespace(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_php_namespace(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000080u;
- php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_namespace)
}
inline std::string* FileOptions::mutable_php_namespace() {
@@ -10209,11 +10236,11 @@
}
inline void FileOptions::_internal_set_php_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000080u;
- php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_php_namespace() {
_has_bits_[0] |= 0x00000080u;
- return php_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return php_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_php_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_namespace)
@@ -10221,7 +10248,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000080u;
- return php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_php_namespace(std::string* php_namespace) {
if (php_namespace != nullptr) {
@@ -10230,7 +10257,7 @@
_has_bits_[0] &= ~0x00000080u;
}
php_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_namespace,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
}
@@ -10251,10 +10278,10 @@
return _internal_php_metadata_namespace();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_php_metadata_namespace(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_php_metadata_namespace(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000100u;
- php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.php_metadata_namespace)
}
inline std::string* FileOptions::mutable_php_metadata_namespace() {
@@ -10266,11 +10293,11 @@
}
inline void FileOptions::_internal_set_php_metadata_namespace(const std::string& value) {
_has_bits_[0] |= 0x00000100u;
- php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_php_metadata_namespace() {
_has_bits_[0] |= 0x00000100u;
- return php_metadata_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return php_metadata_namespace_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_php_metadata_namespace() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.php_metadata_namespace)
@@ -10278,7 +10305,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000100u;
- return php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_php_metadata_namespace(std::string* php_metadata_namespace) {
if (php_metadata_namespace != nullptr) {
@@ -10287,7 +10314,7 @@
_has_bits_[0] &= ~0x00000100u;
}
php_metadata_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_metadata_namespace,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
}
@@ -10308,10 +10335,10 @@
return _internal_ruby_package();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void FileOptions::set_ruby_package(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void FileOptions::set_ruby_package(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000200u;
- ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.FileOptions.ruby_package)
}
inline std::string* FileOptions::mutable_ruby_package() {
@@ -10323,11 +10350,11 @@
}
inline void FileOptions::_internal_set_ruby_package(const std::string& value) {
_has_bits_[0] |= 0x00000200u;
- ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* FileOptions::_internal_mutable_ruby_package() {
_has_bits_[0] |= 0x00000200u;
- return ruby_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return ruby_package_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* FileOptions::release_ruby_package() {
// @@protoc_insertion_point(field_release:google.protobuf.FileOptions.ruby_package)
@@ -10335,7 +10362,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000200u;
- return ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void FileOptions::set_allocated_ruby_package(std::string* ruby_package) {
if (ruby_package != nullptr) {
@@ -10344,7 +10371,7 @@
_has_bits_[0] &= ~0x00000200u;
}
ruby_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ruby_package,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.ruby_package)
}
@@ -11160,10 +11187,10 @@
return _internal_name_part();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void UninterpretedOption_NamePart::set_name_part(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void UninterpretedOption_NamePart::set_name_part(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.NamePart.name_part)
}
inline std::string* UninterpretedOption_NamePart::mutable_name_part() {
@@ -11175,11 +11202,11 @@
}
inline void UninterpretedOption_NamePart::_internal_set_name_part(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption_NamePart::_internal_mutable_name_part() {
_has_bits_[0] |= 0x00000001u;
- return name_part_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_part_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* UninterpretedOption_NamePart::release_name_part() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.NamePart.name_part)
@@ -11187,7 +11214,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void UninterpretedOption_NamePart::set_allocated_name_part(std::string* name_part) {
if (name_part != nullptr) {
@@ -11196,7 +11223,7 @@
_has_bits_[0] &= ~0x00000001u;
}
name_part_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name_part,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
}
@@ -11288,10 +11315,10 @@
return _internal_identifier_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void UninterpretedOption::set_identifier_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void UninterpretedOption::set_identifier_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.identifier_value)
}
inline std::string* UninterpretedOption::mutable_identifier_value() {
@@ -11303,11 +11330,11 @@
}
inline void UninterpretedOption::_internal_set_identifier_value(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::_internal_mutable_identifier_value() {
_has_bits_[0] |= 0x00000001u;
- return identifier_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return identifier_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::release_identifier_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.identifier_value)
@@ -11315,7 +11342,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void UninterpretedOption::set_allocated_identifier_value(std::string* identifier_value) {
if (identifier_value != nullptr) {
@@ -11324,7 +11351,7 @@
_has_bits_[0] &= ~0x00000001u;
}
identifier_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), identifier_value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
}
@@ -11337,7 +11364,7 @@
return _internal_has_positive_int_value();
}
inline void UninterpretedOption::clear_positive_int_value() {
- positive_int_value_ = PROTOBUF_ULONGLONG(0);
+ positive_int_value_ = uint64_t{0u};
_has_bits_[0] &= ~0x00000008u;
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::_internal_positive_int_value() const {
@@ -11365,7 +11392,7 @@
return _internal_has_negative_int_value();
}
inline void UninterpretedOption::clear_negative_int_value() {
- negative_int_value_ = PROTOBUF_LONGLONG(0);
+ negative_int_value_ = int64_t{0};
_has_bits_[0] &= ~0x00000010u;
}
inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::_internal_negative_int_value() const {
@@ -11429,10 +11456,10 @@
return _internal_string_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void UninterpretedOption::set_string_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void UninterpretedOption::set_string_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- string_value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ string_value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.string_value)
}
inline std::string* UninterpretedOption::mutable_string_value() {
@@ -11444,11 +11471,11 @@
}
inline void UninterpretedOption::_internal_set_string_value(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::_internal_mutable_string_value() {
_has_bits_[0] |= 0x00000002u;
- return string_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return string_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.string_value)
@@ -11456,7 +11483,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void UninterpretedOption::set_allocated_string_value(std::string* string_value) {
if (string_value != nullptr) {
@@ -11465,7 +11492,7 @@
_has_bits_[0] &= ~0x00000002u;
}
string_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), string_value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
}
@@ -11486,10 +11513,10 @@
return _internal_aggregate_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void UninterpretedOption::set_aggregate_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void UninterpretedOption::set_aggregate_value(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000004u;
- aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.aggregate_value)
}
inline std::string* UninterpretedOption::mutable_aggregate_value() {
@@ -11501,11 +11528,11 @@
}
inline void UninterpretedOption::_internal_set_aggregate_value(const std::string& value) {
_has_bits_[0] |= 0x00000004u;
- aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::_internal_mutable_aggregate_value() {
_has_bits_[0] |= 0x00000004u;
- return aggregate_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return aggregate_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* UninterpretedOption::release_aggregate_value() {
// @@protoc_insertion_point(field_release:google.protobuf.UninterpretedOption.aggregate_value)
@@ -11513,7 +11540,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000004u;
- return aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void UninterpretedOption::set_allocated_aggregate_value(std::string* aggregate_value) {
if (aggregate_value != nullptr) {
@@ -11522,7 +11549,7 @@
_has_bits_[0] &= ~0x00000004u;
}
aggregate_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), aggregate_value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
}
@@ -11641,10 +11668,10 @@
return _internal_leading_comments();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void SourceCodeInfo_Location::set_leading_comments(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void SourceCodeInfo_Location::set_leading_comments(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
inline std::string* SourceCodeInfo_Location::mutable_leading_comments() {
@@ -11656,11 +11683,11 @@
}
inline void SourceCodeInfo_Location::_internal_set_leading_comments(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::_internal_mutable_leading_comments() {
_has_bits_[0] |= 0x00000001u;
- return leading_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return leading_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::release_leading_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.leading_comments)
@@ -11668,7 +11695,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void SourceCodeInfo_Location::set_allocated_leading_comments(std::string* leading_comments) {
if (leading_comments != nullptr) {
@@ -11677,7 +11704,7 @@
_has_bits_[0] &= ~0x00000001u;
}
leading_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), leading_comments,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
}
@@ -11698,10 +11725,10 @@
return _internal_trailing_comments();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void SourceCodeInfo_Location::set_trailing_comments(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void SourceCodeInfo_Location::set_trailing_comments(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000002u;
- trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
inline std::string* SourceCodeInfo_Location::mutable_trailing_comments() {
@@ -11713,11 +11740,11 @@
}
inline void SourceCodeInfo_Location::_internal_set_trailing_comments(const std::string& value) {
_has_bits_[0] |= 0x00000002u;
- trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::_internal_mutable_trailing_comments() {
_has_bits_[0] |= 0x00000002u;
- return trailing_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return trailing_comments_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* SourceCodeInfo_Location::release_trailing_comments() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceCodeInfo.Location.trailing_comments)
@@ -11725,7 +11752,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000002u;
- return trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void SourceCodeInfo_Location::set_allocated_trailing_comments(std::string* trailing_comments) {
if (trailing_comments != nullptr) {
@@ -11734,7 +11761,7 @@
_has_bits_[0] &= ~0x00000002u;
}
trailing_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), trailing_comments,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
}
@@ -11923,10 +11950,10 @@
return _internal_source_file();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void GeneratedCodeInfo_Annotation::set_source_file(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void GeneratedCodeInfo_Annotation::set_source_file(ArgT0&& arg0, ArgT... args) {
_has_bits_[0] |= 0x00000001u;
- source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
inline std::string* GeneratedCodeInfo_Annotation::mutable_source_file() {
@@ -11938,11 +11965,11 @@
}
inline void GeneratedCodeInfo_Annotation::_internal_set_source_file(const std::string& value) {
_has_bits_[0] |= 0x00000001u;
- source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* GeneratedCodeInfo_Annotation::_internal_mutable_source_file() {
_has_bits_[0] |= 0x00000001u;
- return source_file_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return source_file_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* GeneratedCodeInfo_Annotation::release_source_file() {
// @@protoc_insertion_point(field_release:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
@@ -11950,7 +11977,7 @@
return nullptr;
}
_has_bits_[0] &= ~0x00000001u;
- return source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(std::string* source_file) {
if (source_file != nullptr) {
@@ -11959,7 +11986,7 @@
_has_bits_[0] &= ~0x00000001u;
}
source_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source_file,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
}
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index b454ed5..ce09791 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -2071,6 +2071,84 @@
// ===================================================================
+// Ensure that overlapping extension ranges are not allowed.
+TEST(OverlappingExtensionRangeTest, ExtensionRangeInternal) {
+ // Build descriptors for the following definitions:
+ //
+ // message Foo {
+ // extensions 10 to 19;
+ // extensions 15;
+ // }
+ FileDescriptorProto foo_file;
+ foo_file.set_name("foo.proto");
+
+ DescriptorProto* foo = AddMessage(&foo_file, "Foo");
+ AddExtensionRange(foo, 10, 20);
+ AddExtensionRange(foo, 15, 16);
+
+ DescriptorPool pool;
+ MockErrorCollector error_collector;
+ // The extensions ranges are invalid, so the proto shouldn't build.
+ ASSERT_TRUE(pool.BuildFileCollectingErrors(foo_file, &error_collector) ==
+ nullptr);
+ ASSERT_EQ(
+ "foo.proto: Foo: NUMBER: Extension range 15 to 15 overlaps with "
+ "already-defined range 10 to 19.\n",
+ error_collector.text_);
+}
+
+TEST(OverlappingExtensionRangeTest, ExtensionRangeAfter) {
+ // Build descriptors for the following definitions:
+ //
+ // message Foo {
+ // extensions 10 to 19;
+ // extensions 15 to 24;
+ // }
+ FileDescriptorProto foo_file;
+ foo_file.set_name("foo.proto");
+
+ DescriptorProto* foo = AddMessage(&foo_file, "Foo");
+ AddExtensionRange(foo, 10, 20);
+ AddExtensionRange(foo, 15, 25);
+
+ DescriptorPool pool;
+ MockErrorCollector error_collector;
+ // The extensions ranges are invalid, so the proto shouldn't build.
+ ASSERT_TRUE(pool.BuildFileCollectingErrors(foo_file, &error_collector) ==
+ nullptr);
+ ASSERT_EQ(
+ "foo.proto: Foo: NUMBER: Extension range 15 to 24 overlaps with "
+ "already-defined range 10 to 19.\n",
+ error_collector.text_);
+}
+
+TEST(OverlappingExtensionRangeTest, ExtensionRangeBefore) {
+ // Build descriptors for the following definitions:
+ //
+ // message Foo {
+ // extensions 10 to 19;
+ // extensions 5 to 14;
+ // }
+ FileDescriptorProto foo_file;
+ foo_file.set_name("foo.proto");
+
+ DescriptorProto* foo = AddMessage(&foo_file, "Foo");
+ AddExtensionRange(foo, 10, 20);
+ AddExtensionRange(foo, 5, 15);
+
+ DescriptorPool pool;
+ MockErrorCollector error_collector;
+ // The extensions ranges are invalid, so the proto shouldn't build.
+ ASSERT_TRUE(pool.BuildFileCollectingErrors(foo_file, &error_collector) ==
+ nullptr);
+ ASSERT_EQ(
+ "foo.proto: Foo: NUMBER: Extension range 5 to 14 overlaps with "
+ "already-defined range 10 to 19.\n",
+ error_collector.text_);
+}
+
+// ===================================================================
+
// Test reserved fields.
class ReservedDescriptorTest : public testing::Test {
protected:
diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc
index 01cd8d7..164d295 100644
--- a/src/google/protobuf/duration.pb.cc
+++ b/src/google/protobuf/duration.pb.cc
@@ -19,7 +19,7 @@
PROTOBUF_NAMESPACE_OPEN
constexpr Duration::Duration(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : seconds_(PROTOBUF_LONGLONG(0))
+ : seconds_(int64_t{0})
, nanos_(0){}
struct DurationDefaultTypeInternal {
constexpr DurationDefaultTypeInternal()
@@ -110,7 +110,7 @@
}
void Duration::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void Duration::ArenaDtor(void* object) {
@@ -285,7 +285,7 @@
void Duration::InternalSwap(Duration* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Duration, nanos_)
+ sizeof(Duration::nanos_)
diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h
index fdab83d..428f247 100644
--- a/src/google/protobuf/duration.pb.h
+++ b/src/google/protobuf/duration.pb.h
@@ -65,7 +65,7 @@
// ===================================================================
-class PROTOBUF_EXPORT Duration PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Duration final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Duration) */ {
public:
inline Duration() : Duration(nullptr) {}
@@ -83,8 +83,9 @@
return *this;
}
inline Duration& operator=(Duration&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -115,7 +116,7 @@
}
inline void Swap(Duration* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -123,14 +124,14 @@
}
void UnsafeArenaSwap(Duration* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Duration* New() const final {
- return CreateMaybeMessage<Duration>(nullptr);
+ return new Duration();
}
Duration* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -150,8 +151,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Duration* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -218,7 +219,7 @@
// int64 seconds = 1;
inline void Duration::clear_seconds() {
- seconds_ = PROTOBUF_LONGLONG(0);
+ seconds_ = int64_t{0};
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::_internal_seconds() const {
return seconds_;
diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc
index ef7e1f2..0bfb94a 100644
--- a/src/google/protobuf/dynamic_message.cc
+++ b/src/google/protobuf/dynamic_message.cc
@@ -355,7 +355,7 @@
if (type_info_->extensions_offset != -1) {
new (OffsetToPointer(type_info_->extensions_offset))
- ExtensionSet(GetArena());
+ ExtensionSet(GetArenaForAllocation());
}
for (int i = 0; i < descriptor->field_count(); i++) {
const FieldDescriptor* field = descriptor->field(i);
@@ -364,13 +364,13 @@
continue;
}
switch (field->cpp_type()) {
-#define HANDLE_TYPE(CPPTYPE, TYPE) \
- case FieldDescriptor::CPPTYPE_##CPPTYPE: \
- if (!field->is_repeated()) { \
- new (field_ptr) TYPE(field->default_value_##TYPE()); \
- } else { \
- new (field_ptr) RepeatedField<TYPE>(GetArena()); \
- } \
+#define HANDLE_TYPE(CPPTYPE, TYPE) \
+ case FieldDescriptor::CPPTYPE_##CPPTYPE: \
+ if (!field->is_repeated()) { \
+ new (field_ptr) TYPE(field->default_value_##TYPE()); \
+ } else { \
+ new (field_ptr) RepeatedField<TYPE>(GetArenaForAllocation()); \
+ } \
break;
HANDLE_TYPE(INT32, int32);
@@ -386,7 +386,7 @@
if (!field->is_repeated()) {
new (field_ptr) int(field->default_value_enum()->number());
} else {
- new (field_ptr) RepeatedField<int>(GetArena());
+ new (field_ptr) RepeatedField<int>(GetArenaForAllocation());
}
break;
@@ -402,7 +402,8 @@
ArenaStringPtr* asp = new (field_ptr) ArenaStringPtr();
asp->UnsafeSetDefault(default_value);
} else {
- new (field_ptr) RepeatedPtrField<std::string>(GetArena());
+ new (field_ptr)
+ RepeatedPtrField<std::string>(GetArenaForAllocation());
}
break;
}
@@ -417,20 +418,30 @@
// when the constructor is called inside GetPrototype(), in which
// case we have already locked the factory.
if (lock_factory) {
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
new (field_ptr) DynamicMapField(
type_info_->factory->GetPrototype(field->message_type()),
- GetArena());
+ GetArenaForAllocation());
+ if (GetOwningArena() != nullptr) {
+ // Needs to destroy the mutex member.
+ GetOwningArena()->OwnDestructor(
+ static_cast<DynamicMapField*>(field_ptr));
+ }
} else {
new (field_ptr) DynamicMapField(
type_info_->factory->GetPrototype(field->message_type()));
}
} else {
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
new (field_ptr)
DynamicMapField(type_info_->factory->GetPrototypeNoLock(
field->message_type()),
- GetArena());
+ GetArenaForAllocation());
+ if (GetOwningArena() != nullptr) {
+ // Needs to destroy the mutex member.
+ GetOwningArena()->OwnDestructor(
+ static_cast<DynamicMapField*>(field_ptr));
+ }
} else {
new (field_ptr)
DynamicMapField(type_info_->factory->GetPrototypeNoLock(
@@ -438,7 +449,7 @@
}
}
} else {
- new (field_ptr) RepeatedPtrField<Message>(GetArena());
+ new (field_ptr) RepeatedPtrField<Message>(GetArenaForAllocation());
}
}
break;
diff --git a/src/google/protobuf/dynamic_message_unittest.cc b/src/google/protobuf/dynamic_message_unittest.cc
index 37f9574..dcd5b88 100644
--- a/src/google/protobuf/dynamic_message_unittest.cc
+++ b/src/google/protobuf/dynamic_message_unittest.cc
@@ -286,6 +286,7 @@
// Return without freeing: should not leak.
}
+
TEST_F(DynamicMessageTest, Proto3) {
Message* message = proto3_prototype_->New();
const Reflection* refl = message->GetReflection();
diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc
index b2149ab..15761e9 100644
--- a/src/google/protobuf/empty.pb.cc
+++ b/src/google/protobuf/empty.pb.cc
@@ -98,7 +98,7 @@
}
void Empty::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void Empty::ArenaDtor(void* object) {
@@ -219,7 +219,7 @@
void Empty::InternalSwap(Empty* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
}
::PROTOBUF_NAMESPACE_ID::Metadata Empty::GetMetadata() const {
diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h
index eb3c11c..281deaf 100644
--- a/src/google/protobuf/empty.pb.h
+++ b/src/google/protobuf/empty.pb.h
@@ -65,7 +65,7 @@
// ===================================================================
-class PROTOBUF_EXPORT Empty PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Empty final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Empty) */ {
public:
inline Empty() : Empty(nullptr) {}
@@ -83,8 +83,9 @@
return *this;
}
inline Empty& operator=(Empty&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -115,7 +116,7 @@
}
inline void Swap(Empty* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -123,14 +124,14 @@
}
void UnsafeArenaSwap(Empty* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Empty* New() const final {
- return CreateMaybeMessage<Empty>(nullptr);
+ return new Empty();
}
Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -150,8 +151,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Empty* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index bc53480..5814dc9 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -616,7 +616,7 @@
ClearExtension(number);
return;
}
- Arena* message_arena = message->GetArena();
+ Arena* message_arena = message->GetOwningArena();
Extension* extension;
if (MaybeNewExtension(number, descriptor, &extension)) {
extension->type = type;
@@ -1055,10 +1055,7 @@
void ExtensionSet::Swap(ExtensionSet* x) {
if (GetArena() == x->GetArena()) {
- using std::swap;
- swap(flat_capacity_, x->flat_capacity_);
- swap(flat_size_, x->flat_size_);
- swap(map_, x->map_);
+ InternalSwap(x);
} else {
// TODO(cfallin, rohananil): We maybe able to optimize a case where we are
// swapping from heap to arena-allocated extension set, by just Own()'ing
@@ -1072,6 +1069,14 @@
}
}
+void ExtensionSet::InternalSwap(ExtensionSet* other) {
+ using std::swap;
+ swap(arena_, other->arena_);
+ swap(flat_capacity_, other->flat_capacity_);
+ swap(flat_size_, other->flat_size_);
+ swap(map_, other->map_);
+}
+
void ExtensionSet::SwapExtension(ExtensionSet* other, int number) {
if (this == other) return;
Extension* this_ext = FindOrNull(number);
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h
index c4b845a..acfe47d 100644
--- a/src/google/protobuf/extension_set.h
+++ b/src/google/protobuf/extension_set.h
@@ -282,12 +282,13 @@
void UnsafeArenaSetAllocatedMessage(int number, FieldType type,
const FieldDescriptor* descriptor,
MessageLite* message);
- MessageLite* ReleaseMessage(int number, const MessageLite& prototype);
+ PROTOBUF_FUTURE_MUST_USE_RESULT MessageLite* ReleaseMessage(
+ int number, const MessageLite& prototype);
MessageLite* UnsafeArenaReleaseMessage(int number,
const MessageLite& prototype);
- MessageLite* ReleaseMessage(const FieldDescriptor* descriptor,
- MessageFactory* factory);
+ PROTOBUF_FUTURE_MUST_USE_RESULT MessageLite* ReleaseMessage(
+ const FieldDescriptor* descriptor, MessageFactory* factory);
MessageLite* UnsafeArenaReleaseMessage(const FieldDescriptor* descriptor,
MessageFactory* factory);
#undef desc
@@ -354,7 +355,7 @@
#undef desc
void RemoveLast(int number);
- MessageLite* ReleaseLast(int number);
+ PROTOBUF_FUTURE_MUST_USE_RESULT MessageLite* ReleaseLast(int number);
void SwapElements(int number, int index1, int index2);
// -----------------------------------------------------------------
@@ -369,6 +370,7 @@
void Clear();
void MergeFrom(const ExtensionSet& other);
void Swap(ExtensionSet* other);
+ void InternalSwap(ExtensionSet* other);
void SwapExtension(ExtensionSet* other, int number);
bool IsInitialized() const;
@@ -533,7 +535,8 @@
virtual MessageLite* MutableMessage(const MessageLite& prototype) = 0;
virtual void SetAllocatedMessage(MessageLite* message) = 0;
virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message) = 0;
- virtual MessageLite* ReleaseMessage(const MessageLite& prototype) = 0;
+ virtual PROTOBUF_FUTURE_MUST_USE_RESULT MessageLite* ReleaseMessage(
+ const MessageLite& prototype) = 0;
virtual MessageLite* UnsafeArenaReleaseMessage(
const MessageLite& prototype) = 0;
@@ -1259,8 +1262,8 @@
ExtensionSet* set) {
set->UnsafeArenaSetAllocatedMessage(number, field_type, NULL, message);
}
- static inline MutableType Release(int number, FieldType /* field_type */,
- ExtensionSet* set) {
+ static inline PROTOBUF_FUTURE_MUST_USE_RESULT MutableType
+ Release(int number, FieldType /* field_type */, ExtensionSet* set) {
return static_cast<Type*>(
set->ReleaseMessage(number, Type::default_instance()));
}
@@ -1475,9 +1478,11 @@
template <typename _proto_TypeTraits, \
::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type, \
bool _is_packed> \
- inline typename _proto_TypeTraits::Singular::MutableType ReleaseExtension( \
- const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
- CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
+ inline PROTOBUF_FUTURE_MUST_USE_RESULT \
+ typename _proto_TypeTraits::Singular::MutableType \
+ ReleaseExtension( \
+ const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< \
+ CLASSNAME, _proto_TypeTraits, _field_type, _is_packed>& id) { \
return _proto_TypeTraits::Release(id.number(), _field_type, \
&_extensions_); \
} \
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index 6a6fc25..7971fe5 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -198,7 +198,8 @@
// ReleaseExtension will return the underlying object even after
// ClearExtension is called.
message.SetAllocatedExtension(
- unittest::TestMessageSetExtension1::message_set_extension, extension);
+ unittest::TestMessageSetExtension1::message_set_extension,
+ released_extension);
message.ClearExtension(
unittest::TestMessageSetExtension1::message_set_extension);
released_extension = message.ReleaseExtension(
@@ -1335,5 +1336,3 @@
} // namespace internal
} // namespace protobuf
} // namespace google
-
-#include <google/protobuf/port_undef.inc>
diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc
index 5890bb2..1174f1e 100644
--- a/src/google/protobuf/field_mask.pb.cc
+++ b/src/google/protobuf/field_mask.pb.cc
@@ -103,7 +103,7 @@
}
void FieldMask::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void FieldMask::ArenaDtor(void* object) {
@@ -263,7 +263,7 @@
void FieldMask::InternalSwap(FieldMask* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
paths_.InternalSwap(&other->paths_);
}
diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h
index e6047de..7bc589b 100644
--- a/src/google/protobuf/field_mask.pb.h
+++ b/src/google/protobuf/field_mask.pb.h
@@ -65,7 +65,7 @@
// ===================================================================
-class PROTOBUF_EXPORT FieldMask PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FieldMask final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FieldMask) */ {
public:
inline FieldMask() : FieldMask(nullptr) {}
@@ -83,8 +83,9 @@
return *this;
}
inline FieldMask& operator=(FieldMask&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -115,7 +116,7 @@
}
inline void Swap(FieldMask* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -123,14 +124,14 @@
}
void UnsafeArenaSwap(FieldMask* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FieldMask* New() const final {
- return CreateMaybeMessage<FieldMask>(nullptr);
+ return new FieldMask();
}
FieldMask* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -150,8 +151,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FieldMask* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc
index 3260e30..ea3c71d 100644
--- a/src/google/protobuf/generated_message_reflection.cc
+++ b/src/google/protobuf/generated_message_reflection.cc
@@ -235,6 +235,16 @@
->mutable_unknown_fields<UnknownFieldSet>();
}
+bool Reflection::IsLazilyVerifiedLazyField(const FieldDescriptor* field) const {
+ return field->options().lazy();
+}
+
+bool Reflection::IsEagerlyVerifiedLazyField(
+ const FieldDescriptor* field) const {
+ return (field->type() == FieldDescriptor::TYPE_MESSAGE &&
+ schema_.IsEagerlyVerifiedLazyField(field));
+}
+
size_t Reflection::SpaceUsedLong(const Message& message) const {
// object_size_ already includes the in-memory representation of each field
// in the message, so we only need to account for additional memory used by
@@ -411,7 +421,8 @@
SWAP_VALUES(ENUM, int);
#undef SWAP_VALUES
case FieldDescriptor::CPPTYPE_MESSAGE:
- if (GetArena(message1) == GetArena(message2)) {
+ if (message1->GetArenaForAllocation() ==
+ message2->GetArenaForAllocation()) {
std::swap(*MutableRaw<Message*>(message1, field),
*MutableRaw<Message*>(message2, field));
} else {
@@ -423,13 +434,17 @@
break;
}
if (*sub_msg1 == nullptr) {
- *sub_msg1 = (*sub_msg2)->New(message1->GetArena());
+ *sub_msg1 = (*sub_msg2)->New(message1->GetArenaForAllocation());
(*sub_msg1)->CopyFrom(**sub_msg2);
ClearField(message2, field);
+ // Ensures has bit is unchanged after ClearField.
+ SetBit(message2, field);
} else {
- *sub_msg2 = (*sub_msg1)->New(message2->GetArena());
+ *sub_msg2 = (*sub_msg1)->New(message2->GetArenaForAllocation());
(*sub_msg2)->CopyFrom(**sub_msg1);
ClearField(message1, field);
+ // Ensures has bit is unchanged after ClearField.
+ SetBit(message1, field);
}
}
break;
@@ -438,25 +453,30 @@
switch (field->options().ctype()) {
default: // TODO(kenton): Support other string reps.
case FieldOptions::STRING: {
- Arena* arena1 = GetArena(message1);
- Arena* arena2 = GetArena(message2);
+ const std::string* default_ptr =
+ DefaultRaw<ArenaStringPtr>(field).GetPointer();
+ Arena* arena1 = message1->GetArenaForAllocation();
+ Arena* arena2 = message2->GetArenaForAllocation();
ArenaStringPtr* string1 =
MutableRaw<ArenaStringPtr>(message1, field);
ArenaStringPtr* string2 =
MutableRaw<ArenaStringPtr>(message2, field);
- const std::string* default_ptr =
- DefaultRaw<ArenaStringPtr>(field).GetPointer();
- if (arena1 == arena2) {
- string1->Swap(string2, default_ptr, arena1);
+ if (message1->GetOwningArena() == message2->GetOwningArena()) {
+ ArenaStringPtr::InternalSwap(default_ptr, string1, arena1,
+ string2, arena2);
} else if (string1->IsDefault(default_ptr) &&
string2->IsDefault(default_ptr)) {
// Nothing to do.
} else if (string1->IsDefault(default_ptr)) {
string1->Set(default_ptr, string2->Get(), arena1);
+ // string2 needs to be destroyed before overwritten.
+ string2->Destroy(default_ptr, arena2);
string2->UnsafeSetDefault(default_ptr);
} else if (string2->IsDefault(default_ptr)) {
string2->Set(default_ptr, string1->Get(), arena2);
+ // string1 needs to be destroyed before overwritten.
+ string1->Destroy(default_ptr, arena1);
string1->UnsafeSetDefault(default_ptr);
} else {
std::string temp = string1->Get();
@@ -612,19 +632,38 @@
// Check that both messages are in the same arena (or both on the heap). We
// need to copy all data if not, due to ownership semantics.
- if (GetArena(message1) != GetArena(message2)) {
- // Slow copy path.
- // Use our arena as temp space, if available.
- Message* temp = message1->New(GetArena(message1));
+ if (message1->GetOwningArena() != message2->GetOwningArena()) {
+ // One of the two is guaranteed to have an arena. Switch things around
+ // to guarantee that message1 has an arena.
+ Arena* arena = message1->GetOwningArena();
+ if (arena == nullptr) {
+ arena = message2->GetOwningArena();
+ std::swap(message1, message2); // Swapping names for pointers!
+ }
+
+ Message* temp = message1->New(arena);
temp->MergeFrom(*message2);
message2->CopyFrom(*message1);
Swap(message1, temp);
- if (GetArena(message1) == nullptr) {
- delete temp;
- }
return;
}
+ for (int i = 0; i <= last_non_weak_field_index_; i++) {
+ const FieldDescriptor* field = descriptor_->field(i);
+ if (schema_.InRealOneof(field)) continue;
+ if (schema_.IsFieldStripped(field)) continue;
+ SwapField(message1, message2, field);
+ }
+ const int oneof_decl_count = descriptor_->oneof_decl_count();
+ for (int i = 0; i < oneof_decl_count; i++) {
+ const OneofDescriptor* oneof = descriptor_->oneof_decl(i);
+ if (!oneof->is_synthetic()) {
+ SwapOneofField(message1, message2, oneof);
+ }
+ }
+
+ // Swapping bits need to happen after swapping fields, because the latter may
+ // depend on the has bit information.
if (schema_.HasHasbits()) {
uint32* has_bits1 = MutableHasBits(message1);
uint32* has_bits2 = MutableHasBits(message2);
@@ -645,20 +684,6 @@
}
}
- for (int i = 0; i <= last_non_weak_field_index_; i++) {
- const FieldDescriptor* field = descriptor_->field(i);
- if (schema_.InRealOneof(field)) continue;
- if (schema_.IsFieldStripped(field)) continue;
- SwapField(message1, message2, field);
- }
- const int oneof_decl_count = descriptor_->oneof_decl_count();
- for (int i = 0; i < oneof_decl_count; i++) {
- const OneofDescriptor* oneof = descriptor_->oneof_decl(i);
- if (!oneof->is_synthetic()) {
- SwapOneofField(message1, message2, oneof);
- }
- }
-
if (schema_.HasExtensionSet()) {
MutableExtensionSet(message1)->Swap(MutableExtensionSet(message2));
}
@@ -708,13 +733,14 @@
swapped_oneof.insert(oneof_index);
SwapOneofField(message1, message2, field->containing_oneof());
} else {
+ // Swap field.
+ SwapField(message1, message2, field);
// Swap has bit for non-repeated fields. We have already checked for
- // oneof already.
+ // oneof already. This has to be done after SwapField, because SwapField
+ // may depend on the information in has bits.
if (!field->is_repeated()) {
SwapBit(message1, message2, field);
}
- // Swap field.
- SwapField(message1, message2, field);
}
}
}
@@ -828,7 +854,8 @@
const std::string* default_ptr =
DefaultRaw<ArenaStringPtr>(field).GetPointer();
MutableRaw<ArenaStringPtr>(message, field)
- ->SetAllocated(default_ptr, nullptr, GetArena(message));
+ ->SetAllocated(default_ptr, nullptr,
+ message->GetArenaForAllocation());
break;
}
}
@@ -839,7 +866,7 @@
if (schema_.HasBitIndex(field) == static_cast<uint32>(-1)) {
// Proto3 does not have has-bits and we need to set a message field
// to nullptr in order to indicate its un-presence.
- if (GetArena(message) == nullptr) {
+ if (message->GetArenaForAllocation() == nullptr) {
delete *MutableRaw<Message*>(message, field);
}
*MutableRaw<Message*>(message, field) = nullptr;
@@ -1242,7 +1269,8 @@
->UnsafeSetDefault(default_ptr);
}
MutableField<ArenaStringPtr>(message, field)
- ->Set(default_ptr, std::move(value), GetArena(message));
+ ->Set(default_ptr, std::move(value),
+ message->GetArenaForAllocation());
break;
}
}
@@ -1494,7 +1522,7 @@
// This is an optimization to avoid going to GetPrototype() below, as that
// requires a lock and a map lookup.
if (!field->is_extension() && !field->options().weak() &&
- !field->options().lazy() && !schema_.InRealOneof(field)) {
+ !IsLazyField(field) && !schema_.InRealOneof(field)) {
auto* res = DefaultRaw<const Message*>(field);
if (res != nullptr) {
return res;
@@ -1548,7 +1576,7 @@
ClearOneof(message, field->containing_oneof());
result_holder = MutableField<Message*>(message, field);
const Message* default_message = GetDefaultMessageInstance(field);
- *result_holder = default_message->New(message->GetArena());
+ *result_holder = default_message->New(message->GetArenaForAllocation());
}
} else {
SetBit(message, field);
@@ -1556,7 +1584,7 @@
if (*result_holder == nullptr) {
const Message* default_message = GetDefaultMessageInstance(field);
- *result_holder = default_message->New(message->GetArena());
+ *result_holder = default_message->New(message->GetArenaForAllocation());
}
result = *result_holder;
return result;
@@ -1590,7 +1618,7 @@
SetBit(message, field);
}
Message** sub_message_holder = MutableRaw<Message*>(message, field);
- if (GetArena(message) == nullptr) {
+ if (message->GetArenaForAllocation() == nullptr) {
delete *sub_message_holder;
}
*sub_message_holder = sub_message;
@@ -1605,12 +1633,13 @@
// (different arenas, or one is on heap and one is not), then we may need to
// do a copy.
if (sub_message != nullptr &&
- sub_message->GetArena() != message->GetArena()) {
- if (sub_message->GetArena() == nullptr && message->GetArena() != nullptr) {
+ sub_message->GetOwningArena() != message->GetArenaForAllocation()) {
+ if (sub_message->GetOwningArena() == nullptr &&
+ message->GetArenaForAllocation() != nullptr) {
// Case 1: parent is on an arena and child is heap-allocated. We can add
// the child to the arena's Own() list to free on arena destruction, then
// set our pointer.
- message->GetArena()->Own(sub_message);
+ message->GetArenaForAllocation()->Own(sub_message);
UnsafeArenaSetAllocatedMessage(message, sub_message, field);
} else {
// Case 2: all other cases. We need to make a copy. MutableMessage() will
@@ -1661,7 +1690,7 @@
CheckInvalidAccess(schema_, field);
Message* released = UnsafeArenaReleaseMessage(message, field, factory);
- if (GetArena(message) != nullptr && released != nullptr) {
+ if (message->GetArenaForAllocation() != nullptr && released != nullptr) {
Message* copy_from_arena = released->New();
copy_from_arena->CopyFrom(*released);
released = copy_from_arena;
@@ -1743,7 +1772,7 @@
} else {
prototype = &repeated->Get<GenericTypeHandler<Message> >(0);
}
- result = prototype->New(message->GetArena());
+ result = prototype->New(message->GetArenaForAllocation());
// We can guarantee here that repeated and result are either both heap
// allocated or arena owned. So it is safe to call the unsafe version
// of AddAllocated.
@@ -1988,10 +2017,6 @@
schema_.GetExtensionSetOffset());
}
-Arena* Reflection::GetArena(Message* message) const {
- return GetInternalMetadata(*message).arena();
-}
-
const InternalMetadata& Reflection::GetInternalMetadata(
const Message& message) const {
return GetConstRefAtOffset<InternalMetadata>(message,
@@ -2137,7 +2162,7 @@
uint32 oneof_case = GetOneofCase(*message, oneof_descriptor);
if (oneof_case > 0) {
const FieldDescriptor* field = descriptor_->FindFieldByNumber(oneof_case);
- if (GetArena(message) == nullptr) {
+ if (message->GetArenaForAllocation() == nullptr) {
switch (field->cpp_type()) {
case FieldDescriptor::CPPTYPE_STRING: {
switch (field->options().ctype()) {
@@ -2148,7 +2173,7 @@
// work. This allows us to not have the real default accessible
// from reflection.
MutableField<ArenaStringPtr>(message, field)
- ->Destroy(nullptr, GetArena(message));
+ ->Destroy(nullptr, message->GetArenaForAllocation());
break;
}
}
diff --git a/src/google/protobuf/generated_message_reflection.h b/src/google/protobuf/generated_message_reflection.h
index b34f722..1771b474 100644
--- a/src/google/protobuf/generated_message_reflection.h
+++ b/src/google/protobuf/generated_message_reflection.h
@@ -198,6 +198,13 @@
OffsetValue(offsets_[field->index()], field->type());
}
+ // Returns true if the field is implicitly backed by LazyField.
+ bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const {
+ GOOGLE_DCHECK_EQ(field->type(), FieldDescriptor::TYPE_MESSAGE);
+ (void)field;
+ return false;
+ }
+
// Returns true if the field's accessor is called by any external code (aka,
// non proto library code).
bool IsFieldUsed(const FieldDescriptor* field) const {
@@ -235,8 +242,11 @@
int weak_field_map_offset_;
// We tag offset values to provide additional data about fields (such as
- // "unused").
- static uint32 OffsetValue(uint32 v, FieldDescriptor::Type /* type */) {
+ // "unused" or "lazy").
+ static uint32 OffsetValue(uint32 v, FieldDescriptor::Type type) {
+ if (type == FieldDescriptor::TYPE_MESSAGE) {
+ return v & 0x7FFFFFFEu;
+ }
return v & 0x7FFFFFFFu;
}
};
diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc
index 7234f5f..b4c013a 100644
--- a/src/google/protobuf/generated_message_reflection_unittest.cc
+++ b/src/google/protobuf/generated_message_reflection_unittest.cc
@@ -55,6 +55,9 @@
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
+// Must be included last.
+#include <google/protobuf/port_def.inc>
+
namespace google {
namespace protobuf {
@@ -263,6 +266,39 @@
TestUtil::ExpectClear(message2);
}
+TEST(GeneratedMessageReflectionTest, SwapFieldsAllOnDifferentArena) {
+ Arena arena1, arena2;
+ auto* message1 = Arena::CreateMessage<unittest::TestAllTypes>(&arena1);
+ auto* message2 = Arena::CreateMessage<unittest::TestAllTypes>(&arena2);
+
+ TestUtil::SetAllFields(message2);
+
+ std::vector<const FieldDescriptor*> fields;
+ const Reflection* reflection = message1->GetReflection();
+ reflection->ListFields(*message2, &fields);
+ reflection->SwapFields(message1, message2, fields);
+
+ TestUtil::ExpectAllFieldsSet(*message1);
+ TestUtil::ExpectClear(*message2);
+}
+
+TEST(GeneratedMessageReflectionTest, SwapFieldsAllOnArenaHeap) {
+ Arena arena;
+ auto* message1 = Arena::CreateMessage<unittest::TestAllTypes>(&arena);
+ std::unique_ptr<unittest::TestAllTypes> message2(
+ Arena::CreateMessage<unittest::TestAllTypes>(nullptr));
+
+ TestUtil::SetAllFields(message2.get());
+
+ std::vector<const FieldDescriptor*> fields;
+ const Reflection* reflection = message1->GetReflection();
+ reflection->ListFields(*message2, &fields);
+ reflection->SwapFields(message1, message2.get(), fields);
+
+ TestUtil::ExpectAllFieldsSet(*message1);
+ TestUtil::ExpectClear(*message2);
+}
+
TEST(GeneratedMessageReflectionTest, SwapFieldsAllExtension) {
unittest::TestAllExtensions message1;
unittest::TestAllExtensions message2;
@@ -358,6 +394,7 @@
ASSERT_EQ(2, message.repeated_foreign_message_size());
const protobuf_unittest::ForeignMessage* expected =
message.mutable_repeated_foreign_message(1);
+ (void)expected; // unused in somce configurations
std::unique_ptr<Message> released(message.GetReflection()->ReleaseLast(
&message, descriptor->FindFieldByName("repeated_foreign_message")));
EXPECT_EQ(expected, released.get());
@@ -781,6 +818,7 @@
&to_message);
const Message& sub_message = reflection->GetMessage(
to_message, descriptor->FindFieldByName("foo_lazy_message"));
+ (void)sub_message; // unused in somce configurations
released = reflection->ReleaseMessage(
&to_message, descriptor->FindFieldByName("foo_lazy_message"));
EXPECT_TRUE(released != NULL);
@@ -798,6 +836,7 @@
const Message& sub_message2 = reflection->GetMessage(
to_message, descriptor->FindFieldByName("foo_message"));
+ (void)sub_message2; // unused in somce configurations
released = reflection->ReleaseMessage(
&to_message, descriptor->FindFieldByName("foo_message"));
EXPECT_TRUE(released != NULL);
@@ -917,6 +956,7 @@
const Reflection* reflection = message.GetReflection();
const Message& sub_message = reflection->GetMessage(
message, descriptor->FindFieldByName("foo_lazy_message"));
+ (void)sub_message; // unused in somce configurations
Message* released = reflection->ReleaseMessage(
&message, descriptor->FindFieldByName("foo_lazy_message"));
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc
index bc79365..4fd6211 100644
--- a/src/google/protobuf/generated_message_util.cc
+++ b/src/google/protobuf/generated_message_util.cc
@@ -718,7 +718,8 @@
MessageLite* GetOwnedMessageInternal(Arena* message_arena,
MessageLite* submessage,
Arena* submessage_arena) {
- GOOGLE_DCHECK(submessage->GetArena() == submessage_arena);
+ GOOGLE_DCHECK(Arena::InternalHelper<MessageLite>::GetOwningArena(submessage) ==
+ submessage_arena);
GOOGLE_DCHECK(message_arena != submessage_arena);
if (message_arena != NULL && submessage_arena == NULL) {
message_arena->Own(submessage);
diff --git a/src/google/protobuf/has_bits.h b/src/google/protobuf/has_bits.h
index 7fd9234..66d3cd4 100644
--- a/src/google/protobuf/has_bits.h
+++ b/src/google/protobuf/has_bits.h
@@ -47,17 +47,17 @@
template <size_t doublewords>
class HasBits {
public:
- constexpr HasBits() PROTOBUF_NDEBUG_INLINE : has_bits_{} {}
+ PROTOBUF_NDEBUG_INLINE constexpr HasBits() : has_bits_{} {}
- void Clear() PROTOBUF_NDEBUG_INLINE {
+ PROTOBUF_NDEBUG_INLINE void Clear() {
memset(has_bits_, 0, sizeof(has_bits_));
}
- uint32& operator[](int index) PROTOBUF_NDEBUG_INLINE {
+ PROTOBUF_NDEBUG_INLINE uint32& operator[](int index) {
return has_bits_[index];
}
- const uint32& operator[](int index) const PROTOBUF_NDEBUG_INLINE {
+ PROTOBUF_NDEBUG_INLINE const uint32& operator[](int index) const {
return has_bits_[index];
}
diff --git a/src/google/protobuf/io/coded_stream_unittest.cc b/src/google/protobuf/io/coded_stream_unittest.cc
index d2f8959..d02cc88 100644
--- a/src/google/protobuf/io/coded_stream_unittest.cc
+++ b/src/google/protobuf/io/coded_stream_unittest.cc
@@ -51,11 +51,6 @@
#include <google/protobuf/port_def.inc>
-// This declares an unsigned long long integer literal in a portable way.
-// (The original macro is way too big and ruins my formatting.)
-#undef ULL
-#define ULL(x) PROTOBUF_ULONGLONG(x)
-
namespace google {
namespace protobuf {
@@ -168,24 +163,25 @@
{{0xbe, 0xf7, 0x92, 0x84, 0x0b},
5, // 2961488830
(0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
- (ULL(0x0b) << 28)},
+ (uint64_t{0x0bu} << 28)},
// 64-bit
{{0xbe, 0xf7, 0x92, 0x84, 0x1b},
5, // 7256456126
(0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) |
- (ULL(0x1b) << 28)},
+ (uint64_t{0x1bu} << 28)},
{{0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49},
8, // 41256202580718336
(0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) |
- (ULL(0x43) << 28) | (ULL(0x49) << 35) | (ULL(0x24) << 42) |
- (ULL(0x49) << 49)},
+ (uint64_t{0x43u} << 28) | (uint64_t{0x49u} << 35) |
+ (uint64_t{0x24u} << 42) | (uint64_t{0x49u} << 49)},
// 11964378330978735131
{{0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01},
10,
(0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) |
- (ULL(0x3b) << 28) | (ULL(0x56) << 35) | (ULL(0x00) << 42) |
- (ULL(0x05) << 49) | (ULL(0x26) << 56) | (ULL(0x01) << 63)},
+ (uint64_t{0x3bu} << 28) | (uint64_t{0x56u} << 35) |
+ (uint64_t{0x00u} << 42) | (uint64_t{0x05u} << 49) |
+ (uint64_t{0x26u} << 56) | (uint64_t{0x01u} << 63)},
};
TEST_2D(CodedStreamTest, ReadVarint32, kVarintCases, kBlockSizes) {
@@ -313,7 +309,7 @@
}
TEST_2D(CodedStreamTest, WriteVarint32, kVarintCases, kBlockSizes) {
- if (kVarintCases_case.value > ULL(0x00000000FFFFFFFF)) {
+ if (kVarintCases_case.value > uint64_t{0x00000000FFFFFFFFu}) {
// Skip this test for the 64-bit values.
return;
}
@@ -500,8 +496,8 @@
{128u, 2},
{758923u, 3},
{4000000000u, 5},
- {ULL(41256202580718336), 8},
- {ULL(11964378330978735131), 10},
+ {uint64_t{41256202580718336u}, 8},
+ {uint64_t{11964378330978735131u}, 10},
};
TEST_1D(CodedStreamTest, VarintSize32, kVarintSizeCases) {
@@ -569,8 +565,10 @@
};
Fixed64Case kFixed64Cases[] = {
- {{0xef, 0xcd, 0xab, 0x90, 0x12, 0x34, 0x56, 0x78}, ULL(0x7856341290abcdef)},
- {{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}, ULL(0x8877665544332211)},
+ {{0xef, 0xcd, 0xab, 0x90, 0x12, 0x34, 0x56, 0x78},
+ uint64_t{0x7856341290abcdefu}},
+ {{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88},
+ uint64_t{0x8877665544332211u}},
};
TEST_2D(CodedStreamTest, ReadLittleEndian32, kFixed32Cases, kBlockSizes) {
diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h
index 64336eb..904b818 100644
--- a/src/google/protobuf/io/printer.h
+++ b/src/google/protobuf/io/printer.h
@@ -65,7 +65,7 @@
// TODO(gerbens) I don't see why we need virtuals here. Just a vector of
// range, payload pairs stored in a context should suffice.
- virtual void AddAnnotationNew(Annotation& a) {}
+ virtual void AddAnnotationNew(Annotation& /* a */) {}
virtual ~AnnotationCollector() {}
};
diff --git a/src/google/protobuf/io/tokenizer.h b/src/google/protobuf/io/tokenizer.h
index 551516e..3be00f1 100644
--- a/src/google/protobuf/io/tokenizer.h
+++ b/src/google/protobuf/io/tokenizer.h
@@ -78,8 +78,8 @@
// Indicates that there was a warning in the input at the given line and
// column numbers. The numbers are zero-based, so you may want to add
// 1 to each before printing them.
- virtual void AddWarning(int line, ColumnNumber column,
- const std::string& message) {}
+ virtual void AddWarning(int /* line */, ColumnNumber /* column */,
+ const std::string& /* message */) {}
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ErrorCollector);
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 7efee12..df84e1e 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -1321,7 +1321,7 @@
void swap(Map& other) {
if (arena() == other.arena()) {
- elements_.Swap(&other.elements_);
+ InternalSwap(other);
} else {
// TODO(zuguang): optimize this. The temporary copy can be allocated
// in the same arena as the other message, and the "other = copy" can
@@ -1332,6 +1332,8 @@
}
}
+ void InternalSwap(Map& other) { elements_.Swap(&other.elements_); }
+
// Access to hasher. Currently this returns a copy, but it may
// be modified to return a const reference in the future.
hasher hash_function() const { return elements_.hash_function(); }
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index 1caf59d..722481b 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -194,7 +194,7 @@
_has_bits_{} {}
~MapEntryImpl() {
- if (Base::GetArena() != NULL) return;
+ if (Base::GetArenaForAllocation() != NULL) return;
KeyTypeHandler::DeleteNoArena(key_);
ValueTypeHandler::DeleteNoArena(value_);
}
@@ -209,11 +209,12 @@
}
inline KeyMapEntryAccessorType* mutable_key() {
set_has_key();
- return KeyTypeHandler::EnsureMutable(&key_, Base::GetArena());
+ return KeyTypeHandler::EnsureMutable(&key_, Base::GetArenaForAllocation());
}
inline ValueMapEntryAccessorType* mutable_value() {
set_has_value();
- return ValueTypeHandler::EnsureMutable(&value_, Base::GetArena());
+ return ValueTypeHandler::EnsureMutable(&value_,
+ Base::GetArenaForAllocation());
}
// implements MessageLite =========================================
@@ -301,13 +302,14 @@
void MergeFromInternal(const MapEntryImpl& from) {
if (from._has_bits_[0]) {
if (from.has_key()) {
- KeyTypeHandler::EnsureMutable(&key_, Base::GetArena());
- KeyTypeHandler::Merge(from.key(), &key_, Base::GetArena());
+ KeyTypeHandler::EnsureMutable(&key_, Base::GetArenaForAllocation());
+ KeyTypeHandler::Merge(from.key(), &key_, Base::GetArenaForAllocation());
set_has_key();
}
if (from.has_value()) {
- ValueTypeHandler::EnsureMutable(&value_, Base::GetArena());
- ValueTypeHandler::Merge(from.value(), &value_, Base::GetArena());
+ ValueTypeHandler::EnsureMutable(&value_, Base::GetArenaForAllocation());
+ ValueTypeHandler::Merge(from.value(), &value_,
+ Base::GetArenaForAllocation());
set_has_value();
}
}
@@ -315,8 +317,8 @@
public:
void Clear() override {
- KeyTypeHandler::Clear(&key_, Base::GetArena());
- ValueTypeHandler::Clear(&value_, Base::GetArena());
+ KeyTypeHandler::Clear(&key_, Base::GetArenaForAllocation());
+ ValueTypeHandler::Clear(&value_, Base::GetArenaForAllocation());
clear_has_key();
clear_has_value();
}
@@ -328,7 +330,8 @@
public:
explicit Parser(MapField* mf) : mf_(mf), map_(mf->MutableMap()) {}
~Parser() {
- if (entry_ != nullptr && entry_->GetArena() == nullptr) delete entry_;
+ if (entry_ != nullptr && entry_->GetArenaForAllocation() == nullptr)
+ delete entry_;
}
// This does what the typical MergePartialFromCodedStream() is expected to
diff --git a/src/google/protobuf/map_field.cc b/src/google/protobuf/map_field.cc
index 542a1f8..1afdc9d 100644
--- a/src/google/protobuf/map_field.cc
+++ b/src/google/protobuf/map_field.cc
@@ -56,6 +56,21 @@
return reinterpret_cast<RepeatedPtrFieldBase*>(repeated_field_);
}
+void MapFieldBase::Swap(MapFieldBase* other) {
+ // TODO(teboring): This is incorrect when on different arenas.
+ InternalSwap(other);
+}
+
+void MapFieldBase::InternalSwap(MapFieldBase* other) {
+ std::swap(arena_, other->arena_);
+ std::swap(repeated_field_, other->repeated_field_);
+ // a relaxed swap of the atomic
+ auto other_state = other->state_.load(std::memory_order_relaxed);
+ auto this_state = state_.load(std::memory_order_relaxed);
+ other->state_.store(this_state, std::memory_order_relaxed);
+ state_.store(other_state, std::memory_order_relaxed);
+}
+
size_t MapFieldBase::SpaceUsedExcludingSelfLong() const {
ConstAccess();
mutex_.Lock();
@@ -122,12 +137,8 @@
// Double check state
if (state_.load(std::memory_order_relaxed) == CLEAN) {
if (repeated_field_ == nullptr) {
- if (arena_ == nullptr) {
- repeated_field_ = new RepeatedPtrField<Message>();
- } else {
- repeated_field_ =
- Arena::CreateMessage<RepeatedPtrField<Message> >(arena_);
- }
+ repeated_field_ =
+ Arena::CreateMessage<RepeatedPtrField<Message> >(arena_);
}
state_.store(CLEAN, std::memory_order_release);
}
@@ -172,11 +183,11 @@
default_entry_(default_entry) {}
DynamicMapField::~DynamicMapField() {
- // DynamicMapField owns map values. Need to delete them before clearing
- // the map.
- for (Map<MapKey, MapValueRef>::iterator iter = map_.begin();
- iter != map_.end(); ++iter) {
- iter->second.DeleteData();
+ if (arena_ != nullptr) return;
+ // DynamicMapField owns map values. Need to delete them before clearing the
+ // map.
+ for (auto& kv : map_) {
+ kv.second.DeleteData();
}
map_.clear();
}
@@ -388,13 +399,8 @@
const FieldDescriptor* key_des = default_entry_->GetDescriptor()->map_key();
const FieldDescriptor* val_des = default_entry_->GetDescriptor()->map_value();
if (MapFieldBase::repeated_field_ == NULL) {
- if (MapFieldBase::arena_ == NULL) {
- MapFieldBase::repeated_field_ = new RepeatedPtrField<Message>();
- } else {
- MapFieldBase::repeated_field_ =
- Arena::CreateMessage<RepeatedPtrField<Message> >(
- MapFieldBase::arena_);
- }
+ MapFieldBase::repeated_field_ =
+ Arena::CreateMessage<RepeatedPtrField<Message> >(MapFieldBase::arena_);
}
MapFieldBase::repeated_field_->Clear();
diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h
index e05d3ee..5f357b3 100644
--- a/src/google/protobuf/map_field.h
+++ b/src/google/protobuf/map_field.h
@@ -336,13 +336,7 @@
mutex_(GOOGLE_PROTOBUF_LINKER_INITIALIZED),
state_(STATE_MODIFIED_MAP) {}
explicit MapFieldBase(Arena* arena)
- : arena_(arena), repeated_field_(NULL), state_(STATE_MODIFIED_MAP) {
- // Mutex's destructor needs to be called explicitly to release resources
- // acquired in its constructor.
- if (arena) {
- arena->OwnDestructor(&mutex_);
- }
- }
+ : arena_(arena), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {}
virtual ~MapFieldBase();
// Returns reference to internal repeated field. Data written using
@@ -371,7 +365,7 @@
virtual void MapBegin(MapIterator* map_iter) const = 0;
virtual void MapEnd(MapIterator* map_iter) const = 0;
virtual void MergeFrom(const MapFieldBase& other) = 0;
- virtual void Swap(MapFieldBase* other) = 0;
+ virtual void Swap(MapFieldBase* other);
// Sync Map with repeated field and returns the size of map.
virtual int size() const = 0;
virtual void Clear() = 0;
@@ -407,6 +401,8 @@
// Provides derived class the access to repeated field.
void* MutableRepeatedPtrField() const;
+ void InternalSwap(MapFieldBase* other);
+
// Support thread sanitizer (tsan) by making const / mutable races
// more apparent. If one thread calls MutableAccess() while another
// thread calls either ConstAccess() or MutableAccess(), on the same
@@ -571,6 +567,7 @@
void Clear() override;
void MergeFrom(const MapFieldBase& other) override;
void Swap(MapFieldBase* other) override;
+ void InternalSwap(MapField* other);
// Used in the implementation of parsing. Caller should take the ownership iff
// arena_ is NULL.
diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h
index 8e92170..82206c6 100644
--- a/src/google/protobuf/map_field_inl.h
+++ b/src/google/protobuf/map_field_inl.h
@@ -277,14 +277,18 @@
WireFormatLite::FieldType kValueFieldType>
void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType>::Swap(
MapFieldBase* other) {
+ MapFieldBase::Swap(other);
MapField* other_field = down_cast<MapField*>(other);
- std::swap(this->MapFieldBase::repeated_field_, other_field->repeated_field_);
impl_.Swap(&other_field->impl_);
- // a relaxed swap of the atomic
- auto other_state = other_field->state_.load(std::memory_order_relaxed);
- auto this_state = this->MapFieldBase::state_.load(std::memory_order_relaxed);
- other_field->state_.store(this_state, std::memory_order_relaxed);
- this->MapFieldBase::state_.store(other_state, std::memory_order_relaxed);
+}
+
+template <typename Derived, typename Key, typename T,
+ WireFormatLite::FieldType kKeyFieldType,
+ WireFormatLite::FieldType kValueFieldType>
+void MapField<Derived, Key, T, kKeyFieldType, kValueFieldType>::InternalSwap(
+ MapField* other) {
+ MapFieldBase::InternalSwap(other);
+ impl_.InternalSwap(&other->impl_);
}
template <typename Derived, typename Key, typename T,
@@ -293,13 +297,9 @@
void MapField<Derived, Key, T, kKeyFieldType,
kValueFieldType>::SyncRepeatedFieldWithMapNoLock() const {
if (this->MapFieldBase::repeated_field_ == NULL) {
- if (this->MapFieldBase::arena_ == NULL) {
- this->MapFieldBase::repeated_field_ = new RepeatedPtrField<Message>();
- } else {
- this->MapFieldBase::repeated_field_ =
- Arena::CreateMessage<RepeatedPtrField<Message> >(
- this->MapFieldBase::arena_);
- }
+ this->MapFieldBase::repeated_field_ =
+ Arena::CreateMessage<RepeatedPtrField<Message> >(
+ this->MapFieldBase::arena_);
}
const Map<Key, T>& map = impl_.GetMap();
RepeatedPtrField<EntryType>* repeated_field =
diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h
index 665cb0e..46658d4 100644
--- a/src/google/protobuf/map_field_lite.h
+++ b/src/google/protobuf/map_field_lite.h
@@ -81,6 +81,7 @@
}
}
void Swap(MapFieldLite* other) { map_.swap(other->map_); }
+ void InternalSwap(MapFieldLite* other) { map_.InternalSwap(other->map_); }
// Used in the implementation of parsing. Caller should take the ownership iff
// arena_ is NULL.
diff --git a/src/google/protobuf/map_field_test.cc b/src/google/protobuf/map_field_test.cc
index dd70e98..982a34f 100644
--- a/src/google/protobuf/map_field_test.cc
+++ b/src/google/protobuf/map_field_test.cc
@@ -100,16 +100,24 @@
void CopyIterator(MapIterator* this_iterator,
const MapIterator& other_iterator) const override {}
void IncreaseIterator(MapIterator* map_iter) const override {}
+
+ Arena* GetArenaForInternalRepeatedField() {
+ auto* repeated_field = MutableRepeatedField();
+ return repeated_field->GetArena();
+ }
};
-class MapFieldBasePrimitiveTest : public ::testing::Test {
+class MapFieldBasePrimitiveTest : public testing::TestWithParam<bool> {
protected:
typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
typedef MapField<EntryType, int32, int32, WireFormatLite::TYPE_INT32,
WireFormatLite::TYPE_INT32>
MapFieldType;
- MapFieldBasePrimitiveTest() {
+ MapFieldBasePrimitiveTest()
+ : arena_(GetParam() ? new Arena() : nullptr),
+ map_field_(arena_.get()),
+ map_field_base_(map_field_.get()) {
// Get descriptors
map_descriptor_ = unittest::TestMap::descriptor()
->FindFieldByName("map_int32_int32")
@@ -118,7 +126,6 @@
value_descriptor_ = map_descriptor_->map_value();
// Build map field
- map_field_.reset(new MapFieldType);
map_field_base_ = map_field_.get();
map_ = map_field_->MutableMap();
initial_value_map_[0] = 100;
@@ -127,7 +134,8 @@
EXPECT_EQ(2, map_->size());
}
- std::unique_ptr<MapFieldType> map_field_;
+ std::unique_ptr<Arena> arena_;
+ ArenaHolder<MapFieldType> map_field_;
MapFieldBase* map_field_base_;
Map<int32, int32>* map_;
const Descriptor* map_descriptor_;
@@ -136,11 +144,15 @@
std::map<int32, int32> initial_value_map_; // copy of initial values inserted
};
-TEST_F(MapFieldBasePrimitiveTest, SpaceUsedExcludingSelf) {
+INSTANTIATE_TEST_SUITE_P(MapFieldBasePrimitiveTestInstance,
+ MapFieldBasePrimitiveTest,
+ testing::Values(true, false));
+
+TEST_P(MapFieldBasePrimitiveTest, SpaceUsedExcludingSelf) {
EXPECT_LT(0, map_field_base_->SpaceUsedExcludingSelf());
}
-TEST_F(MapFieldBasePrimitiveTest, GetRepeatedField) {
+TEST_P(MapFieldBasePrimitiveTest, GetRepeatedField) {
const RepeatedPtrField<Message>& repeated =
reinterpret_cast<const RepeatedPtrField<Message>&>(
map_field_base_->GetRepeatedField());
@@ -153,7 +165,7 @@
}
}
-TEST_F(MapFieldBasePrimitiveTest, MutableRepeatedField) {
+TEST_P(MapFieldBasePrimitiveTest, MutableRepeatedField) {
RepeatedPtrField<Message>* repeated =
reinterpret_cast<RepeatedPtrField<Message>*>(
map_field_base_->MutableRepeatedField());
@@ -166,7 +178,7 @@
}
}
-TEST_F(MapFieldBasePrimitiveTest, Arena) {
+TEST_P(MapFieldBasePrimitiveTest, Arena) {
// Allocate a large initial block to avoid mallocs during hooked test.
std::vector<char> arena_block(128 * 1024);
ArenaOptions options;
@@ -198,25 +210,34 @@
// Trigger conversion to repeated field.
EXPECT_TRUE(map_field->MutableRepeatedField() != NULL);
+
+ EXPECT_EQ(map_field->GetArenaForInternalRepeatedField(), &arena);
}
}
+TEST_P(MapFieldBasePrimitiveTest, EnforceNoArena) {
+ std::unique_ptr<MapFieldBaseStub> map_field(
+ Arena::CreateMessage<MapFieldBaseStub>(nullptr));
+ EXPECT_EQ(map_field->GetArenaForInternalRepeatedField(), nullptr);
+}
+
namespace {
enum State { CLEAN, MAP_DIRTY, REPEATED_DIRTY };
} // anonymous namespace
-class MapFieldStateTest : public testing::TestWithParam<State> {
- public:
+class MapFieldStateTest
+ : public testing::TestWithParam<std::tuple<State, bool>> {
protected:
typedef unittest::TestMap_MapInt32Int32Entry_DoNotUse EntryType;
typedef MapField<EntryType, int32, int32, WireFormatLite::TYPE_INT32,
WireFormatLite::TYPE_INT32>
MapFieldType;
- MapFieldStateTest() : state_(GetParam()) {
+ MapFieldStateTest()
+ : arena_(std::get<1>(GetParam()) ? new Arena() : nullptr),
+ map_field_(arena_.get()),
+ map_field_base_(map_field_.get()),
+ state_(std::get<0>(GetParam())) {
// Build map field
- map_field_.reset(new MapFieldType());
- map_field_base_ = map_field_.get();
-
Expect(map_field_.get(), MAP_DIRTY, 0, 0, true);
switch (state_) {
case CLEAN:
@@ -297,13 +318,16 @@
}
}
- std::unique_ptr<MapFieldType> map_field_;
+ std::unique_ptr<Arena> arena_;
+ ArenaHolder<MapFieldType> map_field_;
MapFieldBase* map_field_base_;
State state_;
};
INSTANTIATE_TEST_SUITE_P(MapFieldStateTestInstance, MapFieldStateTest,
- ::testing::Values(CLEAN, MAP_DIRTY, REPEATED_DIRTY));
+ testing::Combine(testing::Values(CLEAN, MAP_DIRTY,
+ REPEATED_DIRTY),
+ testing::Values(true, false)));
TEST_P(MapFieldStateTest, GetMap) {
map_field_->GetMap();
@@ -324,10 +348,10 @@
}
TEST_P(MapFieldStateTest, MergeFromClean) {
- MapFieldType other;
- AddOneStillClean(&other);
+ ArenaHolder<MapFieldType> other(arena_.get());
+ AddOneStillClean(other.get());
- map_field_->MergeFrom(other);
+ map_field_->MergeFrom(*other);
if (state_ != MAP_DIRTY) {
Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
@@ -335,14 +359,14 @@
Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
}
- Expect(&other, CLEAN, 1, 1, false);
+ Expect(other.get(), CLEAN, 1, 1, false);
}
TEST_P(MapFieldStateTest, MergeFromMapDirty) {
- MapFieldType other;
- MakeMapDirty(&other);
+ ArenaHolder<MapFieldType> other(arena_.get());
+ MakeMapDirty(other.get());
- map_field_->MergeFrom(other);
+ map_field_->MergeFrom(*other);
if (state_ != MAP_DIRTY) {
Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
@@ -350,14 +374,14 @@
Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
}
- Expect(&other, MAP_DIRTY, 1, 0, true);
+ Expect(other.get(), MAP_DIRTY, 1, 0, true);
}
TEST_P(MapFieldStateTest, MergeFromRepeatedDirty) {
- MapFieldType other;
- MakeRepeatedDirty(&other);
+ ArenaHolder<MapFieldType> other(arena_.get());
+ MakeRepeatedDirty(other.get());
- map_field_->MergeFrom(other);
+ map_field_->MergeFrom(*other);
if (state_ != MAP_DIRTY) {
Expect(map_field_.get(), MAP_DIRTY, 1, 1, false);
@@ -365,26 +389,26 @@
Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
}
- Expect(&other, CLEAN, 1, 1, false);
+ Expect(other.get(), CLEAN, 1, 1, false);
}
TEST_P(MapFieldStateTest, SwapClean) {
- MapFieldType other;
- AddOneStillClean(&other);
+ ArenaHolder<MapFieldType> other(arena_.get());
+ AddOneStillClean(other.get());
- map_field_->Swap(&other);
+ map_field_->Swap(other.get());
Expect(map_field_.get(), CLEAN, 1, 1, false);
switch (state_) {
case CLEAN:
- Expect(&other, CLEAN, 1, 1, false);
+ Expect(other.get(), CLEAN, 1, 1, false);
break;
case MAP_DIRTY:
- Expect(&other, MAP_DIRTY, 1, 0, true);
+ Expect(other.get(), MAP_DIRTY, 1, 0, true);
break;
case REPEATED_DIRTY:
- Expect(&other, REPEATED_DIRTY, 0, 1, false);
+ Expect(other.get(), REPEATED_DIRTY, 0, 1, false);
break;
default:
break;
@@ -392,22 +416,22 @@
}
TEST_P(MapFieldStateTest, SwapMapDirty) {
- MapFieldType other;
- MakeMapDirty(&other);
+ ArenaHolder<MapFieldType> other(arena_.get());
+ MakeMapDirty(other.get());
- map_field_->Swap(&other);
+ map_field_->Swap(other.get());
Expect(map_field_.get(), MAP_DIRTY, 1, 0, true);
switch (state_) {
case CLEAN:
- Expect(&other, CLEAN, 1, 1, false);
+ Expect(other.get(), CLEAN, 1, 1, false);
break;
case MAP_DIRTY:
- Expect(&other, MAP_DIRTY, 1, 0, true);
+ Expect(other.get(), MAP_DIRTY, 1, 0, true);
break;
case REPEATED_DIRTY:
- Expect(&other, REPEATED_DIRTY, 0, 1, false);
+ Expect(other.get(), REPEATED_DIRTY, 0, 1, false);
break;
default:
break;
@@ -415,22 +439,22 @@
}
TEST_P(MapFieldStateTest, SwapRepeatedDirty) {
- MapFieldType other;
- MakeRepeatedDirty(&other);
+ ArenaHolder<MapFieldType> other(arena_.get());
+ MakeRepeatedDirty(other.get());
- map_field_->Swap(&other);
+ map_field_->Swap(other.get());
Expect(map_field_.get(), REPEATED_DIRTY, 0, 1, false);
switch (state_) {
case CLEAN:
- Expect(&other, CLEAN, 1, 1, false);
+ Expect(other.get(), CLEAN, 1, 1, false);
break;
case MAP_DIRTY:
- Expect(&other, MAP_DIRTY, 1, 0, true);
+ Expect(other.get(), MAP_DIRTY, 1, 0, true);
break;
case REPEATED_DIRTY:
- Expect(&other, REPEATED_DIRTY, 0, 1, false);
+ Expect(other.get(), REPEATED_DIRTY, 0, 1, false);
break;
default:
break;
@@ -501,5 +525,3 @@
} // namespace internal
} // namespace protobuf
} // namespace google
-
-#include <google/protobuf/port_undef.inc>
diff --git a/src/google/protobuf/map_test.cc b/src/google/protobuf/map_test.cc
index 768858f..1414fc3 100644
--- a/src/google/protobuf/map_test.cc
+++ b/src/google/protobuf/map_test.cc
@@ -1471,19 +1471,19 @@
std::unique_ptr<Message> entry_int32_int32(
MessageFactory::generated_factory()
->GetPrototype(fd_map_int32_int32->message_type())
- ->New());
+ ->New(message.GetArena()));
std::unique_ptr<Message> entry_int32_double(
MessageFactory::generated_factory()
->GetPrototype(fd_map_int32_double->message_type())
- ->New());
+ ->New(message.GetArena()));
std::unique_ptr<Message> entry_string_string(
MessageFactory::generated_factory()
->GetPrototype(fd_map_string_string->message_type())
- ->New());
+ ->New(message.GetArena()));
std::unique_ptr<Message> entry_int32_foreign_message(
MessageFactory::generated_factory()
->GetPrototype(fd_map_int32_foreign_message->message_type())
- ->New());
+ ->New(message.GetArena()));
EXPECT_EQ(10, mf_int32_int32.size());
EXPECT_EQ(10, mmf_int32_int32.size());
@@ -1890,6 +1890,15 @@
EXPECT_EQ(int32_value9a, int32_value0b);
EXPECT_EQ(int32_value0a, int32_value9b);
}
+
+ // TODO(b/181148674): After supporting arena agnostic delete or let map entry
+ // handle heap allocation, this could be removed.
+ if (message.GetArena() != nullptr) {
+ entry_int32_int32.release();
+ entry_int32_double.release();
+ entry_string_string.release();
+ entry_int32_foreign_message.release();
+ }
}
TEST_F(MapFieldReflectionTest, RepeatedFieldRefMergeFromAndSwap) {
@@ -2406,6 +2415,21 @@
MapTestUtil::ExpectMapFieldsSet(message2);
}
+TEST(GeneratedMapFieldTest, ParseFailsIfMalformed) {
+ unittest::TestMapSubmessage o, p;
+ auto m = o.mutable_test_map()->mutable_map_int32_foreign_message();
+ (*m)[0].set_c(-1);
+ std::string serialized;
+ EXPECT_TRUE(o.SerializeToString(&serialized));
+
+ // Should parse correctly.
+ EXPECT_TRUE(p.ParseFromString(serialized));
+
+ // Overwriting the last byte to 0xFF results in malformed wire.
+ serialized[serialized.size() - 1] = 0xFF;
+ EXPECT_FALSE(p.ParseFromString(serialized));
+}
+
TEST(GeneratedMapFieldTest, SameTypeMaps) {
const Descriptor* map1 = unittest::TestSameTypeMap::descriptor()
@@ -3730,6 +3754,22 @@
MapTestUtil::ExpectMapFieldsSet(message2);
}
+TEST(ArenaTest, DynamicMapFieldOnArenaMemoryLeak) {
+ auto* desc = unittest::TestMap::descriptor();
+ auto* field = desc->FindFieldByName("map_int32_int32");
+
+ Arena arena;
+ DynamicMessageFactory factory;
+ auto* message = factory.GetPrototype(desc)->New(&arena);
+ auto* reflection = message->GetReflection();
+ reflection->AddMessage(message, field);
+
+ // Force internal syncing, which initializes the mutex.
+ MapReflectionTester reflection_tester(unittest::TestMap::descriptor());
+ int size = reflection_tester.MapSize(*message, "map_int32_int32");
+ EXPECT_EQ(size, 1);
+}
+
TEST(MoveTest, MoveConstructorWorks) {
Map<int32, TestAllTypes> original_map;
original_map[42].mutable_optional_nested_message()->set_bb(42);
@@ -3771,5 +3811,3 @@
} // namespace internal
} // namespace protobuf
} // namespace google
-
-#include <google/protobuf/port_undef.inc>
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index 1a5c775..7228429 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -346,18 +346,8 @@
PROTOBUF_NOINLINE
#endif
Arena*
- GenericTypeHandler<Message>::GetArena(Message* value) {
- return value->GetArena();
-}
-template <>
-#if defined(_MSC_VER) && (_MSC_VER >= 1800)
-// Note: force noinline to workaround MSVC compiler bug with /Zc:inline, issue
-// #240
-PROTOBUF_NOINLINE
-#endif
- void*
- GenericTypeHandler<Message>::GetMaybeArenaPointer(Message* value) {
- return value->GetMaybeArenaPointer();
+ GenericTypeHandler<Message>::GetOwningArena(Message* value) {
+ return value->GetOwningArena();
}
} // namespace internal
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index 52e6a1d..068324b 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -476,7 +476,8 @@
void RemoveLast(Message* message, const FieldDescriptor* field) const;
// Removes the last element of a repeated message field, and returns the
// pointer to the caller. Caller takes ownership of the returned pointer.
- Message* ReleaseLast(Message* message, const FieldDescriptor* field) const;
+ PROTOBUF_FUTURE_MUST_USE_RESULT Message* ReleaseLast(
+ Message* message, const FieldDescriptor* field) const;
// Swap the complete contents of two messages.
void Swap(Message* message1, Message* message2) const;
@@ -591,12 +592,20 @@
// the compiled-in class for this type, NOT DynamicMessage.
Message* MutableMessage(Message* message, const FieldDescriptor* field,
MessageFactory* factory = nullptr) const;
+
// Replaces the message specified by 'field' with the already-allocated object
// sub_message, passing ownership to the message. If the field contained a
// message, that message is deleted. If sub_message is nullptr, the field is
// cleared.
void SetAllocatedMessage(Message* message, Message* sub_message,
const FieldDescriptor* field) const;
+
+ // Similar to `SetAllocatedMessage`, but omits all internal safety and
+ // ownership checks. This method should only be used when the objects are on
+ // the same arena or paired with a call to `UnsafeArenaReleaseMessage`.
+ void UnsafeArenaSetAllocatedMessage(Message* message, Message* sub_message,
+ const FieldDescriptor* field) const;
+
// Releases the message specified by 'field' and returns the pointer,
// ReleaseMessage() will return the message the message object if it exists.
// Otherwise, it may or may not return nullptr. In any case, if the return
@@ -604,8 +613,16 @@
// If the field existed (HasField() is true), then the returned pointer will
// be the same as the pointer returned by MutableMessage().
// This function has the same effect as ClearField().
- Message* ReleaseMessage(Message* message, const FieldDescriptor* field,
- MessageFactory* factory = nullptr) const;
+ PROTOBUF_FUTURE_MUST_USE_RESULT Message* ReleaseMessage(
+ Message* message, const FieldDescriptor* field,
+ MessageFactory* factory = nullptr) const;
+
+ // Similar to `ReleaseMessage`, but omits all internal safety and ownership
+ // checks. This method should only be used when the objects are on the same
+ // arena or paired with a call to `UnsafeArenaSetAllocatedMessage`.
+ Message* UnsafeArenaReleaseMessage(Message* message,
+ const FieldDescriptor* field,
+ MessageFactory* factory = nullptr) const;
// Repeated field getters ------------------------------------------
@@ -934,6 +951,24 @@
const Message& message, bool should_fail,
std::vector<const FieldDescriptor*>* output) const;
+ // Returns true if the message field is backed by a LazyField.
+ //
+ // A message field may be backed by a LazyField without the user annotation
+ // ([lazy = true]). While the user-annotated LazyField is lazily verified on
+ // first touch (i.e. failure on access rather than parsing if the LazyField is
+ // not initialized), the inferred LazyField is eagerly verified to avoid lazy
+ // parsing error at the cost of lower efficiency. When reflecting a message
+ // field, use this API instead of checking field->options().lazy().
+ bool IsLazyField(const FieldDescriptor* field) const {
+ return IsLazilyVerifiedLazyField(field) ||
+ IsEagerlyVerifiedLazyField(field);
+ }
+
+ bool IsLazilyVerifiedLazyField(const FieldDescriptor* field) const;
+ bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const;
+
+ friend class FastReflectionMessageMutator;
+
const Descriptor* const descriptor_;
const internal::ReflectionSchema schema_;
const DescriptorPool* const descriptor_pool_;
@@ -1050,7 +1085,6 @@
}
const internal::ExtensionSet& GetExtensionSet(const Message& message) const;
internal::ExtensionSet* MutableExtensionSet(Message* message) const;
- inline Arena* GetArena(Message* message) const;
inline const internal::InternalMetadata& GetInternalMetadata(
const Message& message) const;
@@ -1121,13 +1155,6 @@
void AddEnumValueInternal(Message* message, const FieldDescriptor* field,
int value) const;
- Message* UnsafeArenaReleaseMessage(Message* message,
- const FieldDescriptor* field,
- MessageFactory* factory = nullptr) const;
-
- void UnsafeArenaSetAllocatedMessage(Message* message, Message* sub_message,
- const FieldDescriptor* field) const;
-
friend inline // inline so nobody can call this function.
void
RegisterAllTypesInternal(const Metadata* file_level_metadata, int size);
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index 8a9b79d..f753e65 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -64,6 +64,10 @@
template <typename T>
class RepeatedPtrField;
+class FastReflectionMessageMutator;
+class FastReflectionStringSetter;
+class Reflection;
+
namespace io {
class CodedInputStream;
@@ -83,11 +87,15 @@
// See parse_context.h for explanation
class ParseContext;
-class Proto3ArenaTestHelper;
+class ExtensionSet;
+class LazyField;
class RepeatedPtrFieldBase;
class WireFormatLite;
class WeakFieldMap;
+template <typename Type>
+class GenericTypeHandler; // defined in repeated_field.h
+
// We compute sizes as size_t but cache them as int. This function converts a
// computed size to a cached size. Since we don't proceed with serialization
// if the total size was > INT_MAX, it is not important what this function
@@ -210,12 +218,8 @@
// if arena is a NULL. Default implementation for backwards compatibility.
virtual MessageLite* New(Arena* arena) const;
- // Get the arena for allocating submessages, if any, associated with this
- // message. Virtual method required for generic operations but most
- // arena-related operations should use the GetArena() generated-code method.
- // Default implementation to reduce code size by avoiding the need for
- // per-type implementations when types do not implement arena support.
- Arena* GetArena() const { return _internal_metadata_.arena(); }
+ // Same as GetOwningArena.
+ Arena* GetArena() const { return GetOwningArena(); }
// Get a pointer that may be equal to this message's arena, or may not be.
// If the value returned by this method is equal to some arena pointer, then
@@ -470,6 +474,17 @@
inline explicit MessageLite(Arena* arena) : _internal_metadata_(arena) {}
+ // Returns the arena, if any, that directly owns this message and its internal
+ // memory (Arena::Own is different in that the arena doesn't directly own the
+ // internal memory). This method is used in proto's implementation for
+ // swapping, moving and setting allocated, for deciding whether the ownership
+ // of this message or its internal memory could be changed.
+ Arena* GetOwningArena() const { return _internal_metadata_.arena(); }
+
+ // Returns the arena, used for allocating internal objects(e.g., child
+ // messages, etc), or owning incoming objects (e.g., set allocated).
+ Arena* GetArenaForAllocation() const { return _internal_metadata_.arena(); }
+
internal::InternalMetadata _internal_metadata_;
public:
@@ -503,19 +518,19 @@
// TODO(gerbens) make this a pure abstract function
virtual const void* InternalGetTable() const { return NULL; }
- // Get the arena that owns this message.
- Arena* GetOwningArena() const { return _internal_metadata_.GetOwningArena(); }
-
- // Set the owning arena to the given one.
- void SetOwningArena(Arena* arena) {
- _internal_metadata_.SetOwningArena(arena);
- }
-
- friend class Arena;
- friend class internal::WireFormatLite;
+ friend class FastReflectionMessageMutator;
+ friend class FastReflectionStringSetter;
friend class Message;
- friend class internal::Proto3ArenaTestHelper;
+ friend class Reflection;
+ friend class internal::ExtensionSet;
+ friend class internal::LazyField;
friend class internal::WeakFieldMap;
+ friend class internal::WireFormatLite;
+
+ template <typename Type>
+ friend class Arena::InternalHelper;
+ template <typename Type>
+ friend class internal::GenericTypeHandler;
void LogInitializationErrorMessage() const;
diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc
index 0d97d40..408c233 100644
--- a/src/google/protobuf/message_unittest.inc
+++ b/src/google/protobuf/message_unittest.inc
@@ -56,9 +56,11 @@
#include <google/protobuf/arena.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
+#include <gmock/gmock.h>
#include <google/protobuf/testing/googletest.h>
#include <gtest/gtest.h>
#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/substitute.h>
#include <google/protobuf/io/io_win32.h>
@@ -208,6 +210,171 @@
errors[0]);
}
+TEST(MESSAGE_TEST_NAME, ParseFailsIfSubmessageNotInitialized) {
+ UNITTEST::TestRequiredForeign source, message;
+ source.mutable_optional_message()->set_dummy2(100);
+ std::string serialized = source.SerializePartialAsString();
+
+ EXPECT_TRUE(message.ParsePartialFromString(serialized));
+ EXPECT_FALSE(message.IsInitialized());
+
+ std::vector<std::string> errors;
+ {
+ ScopedMemoryLog log;
+ EXPECT_FALSE(message.ParseFromString(source.SerializePartialAsString()));
+ errors = log.GetMessages(ERROR);
+ }
+
+ EXPECT_THAT(
+ errors,
+ testing::ElementsAre(
+ "Can't parse message of type \"" +
+ std::string(UNITTEST_PACKAGE_NAME) +
+ ".TestRequiredForeign\" because it is missing required fields: "
+ "optional_message.a, optional_message.b, optional_message.c"));
+}
+
+TEST(MESSAGE_TEST_NAME, ParseFailsIfExtensionNotInitialized) {
+ UNITTEST::TestChildExtension source, message;
+ auto* r = source.mutable_optional_extension()->MutableExtension(
+ UNITTEST::TestRequired::single);
+ r->set_dummy2(100);
+ std::string serialized = source.SerializePartialAsString();
+
+ EXPECT_TRUE(message.ParsePartialFromString(serialized));
+ EXPECT_FALSE(message.IsInitialized());
+
+ std::vector<std::string> errors;
+ {
+ ScopedMemoryLog log;
+ EXPECT_FALSE(message.ParseFromString(source.SerializePartialAsString()));
+ errors = log.GetMessages(ERROR);
+ }
+
+ EXPECT_THAT(errors,
+ testing::ElementsAre(strings::Substitute(
+ "Can't parse message of type \"$0.TestChildExtension\" "
+ "because it is missing required fields: "
+ "optional_extension.($0.TestRequired.single).a, "
+ "optional_extension.($0.TestRequired.single).b, "
+ "optional_extension.($0.TestRequired.single).c",
+ UNITTEST_PACKAGE_NAME)));
+}
+
+TEST(MESSAGE_TEST_NAME, ParseFailsIfSubmessageTruncated) {
+ UNITTEST::NestedTestAllTypes o, p;
+ constexpr int kDepth = 5;
+ auto* child = o.mutable_child();
+ for (int i = 0; i < kDepth; i++) {
+ child = child->mutable_child();
+ }
+ TestUtil::SetAllFields(child->mutable_payload());
+
+ std::string serialized;
+ EXPECT_TRUE(o.SerializeToString(&serialized));
+
+ // Should parse correctly.
+ EXPECT_TRUE(p.ParseFromString(serialized));
+
+ constexpr int kMaxTruncate = 50;
+ ASSERT_GT(serialized.size(), kMaxTruncate);
+
+ for (int i = 1; i < kMaxTruncate; i += 3) {
+ EXPECT_FALSE(
+ p.ParseFromString(serialized.substr(0, serialized.size() - i)));
+ }
+}
+
+TEST(MESSAGE_TEST_NAME, ParseFailsIfWireMalformed) {
+ UNITTEST::NestedTestAllTypes o, p;
+ constexpr int kDepth = 5;
+ auto* child = o.mutable_child();
+ for (int i = 0; i < kDepth; i++) {
+ child = child->mutable_child();
+ }
+ // -1 becomes \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1
+ child->mutable_payload()->set_optional_int32(-1);
+
+ std::string serialized;
+ EXPECT_TRUE(o.SerializeToString(&serialized));
+
+ // Should parse correctly.
+ EXPECT_TRUE(p.ParseFromString(serialized));
+
+ // Overwriting the last byte to 0xFF results in malformed wire.
+ serialized[serialized.size() - 1] = 0xFF;
+ EXPECT_FALSE(p.ParseFromString(serialized));
+}
+
+TEST(MESSAGE_TEST_NAME, ParseFailsIfOneofWireMalformed) {
+ UNITTEST::NestedTestAllTypes o, p;
+ constexpr int kDepth = 5;
+ auto* child = o.mutable_child();
+ for (int i = 0; i < kDepth; i++) {
+ child = child->mutable_child();
+ }
+ // -1 becomes \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1
+ child->mutable_payload()->mutable_oneof_nested_message()->set_bb(-1);
+
+ std::string serialized;
+ EXPECT_TRUE(o.SerializeToString(&serialized));
+
+ // Should parse correctly.
+ EXPECT_TRUE(p.ParseFromString(serialized));
+
+ // Overwriting the last byte to 0xFF results in malformed wire.
+ serialized[serialized.size() - 1] = 0xFF;
+ EXPECT_FALSE(p.ParseFromString(serialized));
+}
+
+TEST(MESSAGE_TEST_NAME, ParseFailsIfExtensionWireMalformed) {
+ UNITTEST::TestChildExtension o, p;
+ auto* m = o.mutable_optional_extension()->MutableExtension(
+ UNITTEST::optional_nested_message_extension);
+
+ // -1 becomes \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1
+ m->set_bb(-1);
+
+ std::string serialized;
+ EXPECT_TRUE(o.SerializeToString(&serialized));
+
+ // Should parse correctly.
+ EXPECT_TRUE(p.ParseFromString(serialized));
+
+ // Overwriting the last byte to 0xFF results in malformed wire.
+ serialized[serialized.size() - 1] = 0xFF;
+ EXPECT_FALSE(p.ParseFromString(serialized));
+}
+
+TEST(MESSAGE_TEST_NAME, Swap) {
+ UNITTEST::NestedTestAllTypes o;
+ constexpr int kDepth = 5;
+ auto* child = o.mutable_child();
+ for (int i = 0; i < kDepth; i++) {
+ child = child->mutable_child();
+ }
+ TestUtil::SetAllFields(child->mutable_payload());
+
+ std::string serialized;
+ EXPECT_TRUE(o.SerializeToString(&serialized));
+
+ {
+ Arena arena;
+ UNITTEST::NestedTestAllTypes* p1 =
+ Arena::CreateMessage<UNITTEST::NestedTestAllTypes>(&arena);
+
+ // Should parse correctly.
+ EXPECT_TRUE(p1->ParseFromString(serialized));
+
+ UNITTEST::NestedTestAllTypes* p2 =
+ Arena::CreateMessage<UNITTEST::NestedTestAllTypes>(&arena);
+
+ p1->Swap(p2);
+
+ EXPECT_EQ(o.SerializeAsString(), p2->SerializeAsString());
+ }
+}
+
TEST(MESSAGE_TEST_NAME, BypassInitializationCheckOnParse) {
UNITTEST::TestRequired message;
io::ArrayInputStream raw_input(nullptr, 0);
@@ -374,6 +541,18 @@
EXPECT_EQ("c", errors[2]);
}
+TEST(MESSAGE_TEST_NAME, ReleaseMustUseResult) {
+ UNITTEST::TestAllTypes message;
+ auto* f = new UNITTEST::ForeignMessage();
+ f->set_c(1000);
+ message.set_allocated_optional_foreign_message(f);
+ auto* mf = message.mutable_optional_foreign_message();
+ EXPECT_EQ(mf, f);
+ std::unique_ptr<UNITTEST::ForeignMessage> rf(
+ message.release_optional_foreign_message());
+ EXPECT_NE(rf.get(), nullptr);
+}
+
TEST(MESSAGE_TEST_NAME, ParseFailsOnInvalidMessageEnd) {
UNITTEST::TestAllTypes message;
diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h
index 1f8d8fc..ad5710c 100644
--- a/src/google/protobuf/metadata_lite.h
+++ b/src/google/protobuf/metadata_lite.h
@@ -73,17 +73,15 @@
}
PROTOBUF_NDEBUG_INLINE Arena* arena() const {
- if (PROTOBUF_PREDICT_TRUE(!has_tag())) {
- return PtrValue<Arena>();
- } else if (is_heap_allocating()) {
- return nullptr;
- } else {
+ if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) {
return PtrValue<ContainerBase>()->arena;
+ } else {
+ return PtrValue<Arena>();
}
}
PROTOBUF_NDEBUG_INLINE bool have_unknown_fields() const {
- return UnknownTag() == kUnknownTagMask;
+ return PtrTag() == kTagContainer;
}
PROTOBUF_NDEBUG_INLINE void* raw_arena_ptr() const { return ptr_; }
@@ -120,6 +118,10 @@
}
}
+ PROTOBUF_NDEBUG_INLINE void InternalSwap(InternalMetadata* other) {
+ std::swap(ptr_, other->ptr_);
+ }
+
template <typename T>
PROTOBUF_NDEBUG_INLINE void MergeFrom(const InternalMetadata& other) {
if (other.have_unknown_fields()) {
@@ -134,56 +136,23 @@
}
}
- PROTOBUF_ALWAYS_INLINE Arena* GetOwningArena() const {
- if (PROTOBUF_PREDICT_FALSE(have_unknown_fields())) {
- return PtrValue<ContainerBase>()->arena;
- } else {
- return PtrValue<Arena>();
- }
- }
-
- PROTOBUF_ALWAYS_INLINE void SetOwningArena(Arena* arena) {
- Arena* owning_arena = GetOwningArena();
- GOOGLE_DCHECK(arena != nullptr); // Heap can't own.
- GOOGLE_DCHECK(owning_arena == nullptr); // Only heap can be owned.
-
- if (have_unknown_fields()) {
- ContainerBase* container = PtrValue<ContainerBase>();
- container->arena = arena;
- ptr_ = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(ptr_) |
- kHeapAllocatingTagMask);
- } else {
- ptr_ = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(arena) |
- kHeapAllocatingTagMask);
- }
- }
-
private:
void* ptr_;
// Tagged pointer implementation.
- static constexpr intptr_t kUnknownTagMask = 1;
- static constexpr intptr_t kHeapAllocatingTagMask = 2;
- static constexpr intptr_t kPtrTagMask =
- kUnknownTagMask | kHeapAllocatingTagMask;
+ enum {
+ // ptr_ is an Arena*.
+ kTagArena = 0,
+ // ptr_ is a Container*.
+ kTagContainer = 1,
+ };
+ static constexpr intptr_t kPtrTagMask = 1;
static constexpr intptr_t kPtrValueMask = ~kPtrTagMask;
// Accessors for pointer tag and pointer value.
PROTOBUF_NDEBUG_INLINE int PtrTag() const {
return reinterpret_cast<intptr_t>(ptr_) & kPtrTagMask;
}
- PROTOBUF_ALWAYS_INLINE int UnknownTag() const {
- return reinterpret_cast<intptr_t>(ptr_) & kUnknownTagMask;
- }
- PROTOBUF_ALWAYS_INLINE int HeapAllocatingTag() const {
- return reinterpret_cast<intptr_t>(ptr_) & kHeapAllocatingTagMask;
- }
- PROTOBUF_ALWAYS_INLINE bool has_tag() const {
- return (reinterpret_cast<intptr_t>(ptr_) & kPtrTagMask) != 0;
- }
- PROTOBUF_ALWAYS_INLINE bool is_heap_allocating() const {
- return HeapAllocatingTag() == kHeapAllocatingTagMask;
- }
template <typename U>
U* PtrValue() const {
@@ -191,8 +160,7 @@
kPtrValueMask);
}
- // If ptr_'s tag is kUnknownTagMask, it points to an instance of this
- // struct.
+ // If ptr_'s tag is kTagContainer, it points to an instance of this struct.
struct ContainerBase {
Arena* arena;
};
@@ -212,16 +180,13 @@
template <typename T>
PROTOBUF_NOINLINE T* mutable_unknown_fields_slow() {
Arena* my_arena = arena();
- Arena* owning_arena = GetOwningArena();
Container<T>* container = Arena::Create<Container<T>>(my_arena);
// Two-step assignment works around a bug in clang's static analyzer:
// https://bugs.llvm.org/show_bug.cgi?id=34198.
- intptr_t allocating_tag =
- reinterpret_cast<intptr_t>(ptr_) & kHeapAllocatingTagMask;
ptr_ = container;
ptr_ = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(ptr_) |
- kUnknownTagMask | allocating_tag);
- container->arena = owning_arena;
+ kTagContainer);
+ container->arena = my_arena;
return &(container->unknown_fields);
}
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 7bfcfa9..fe83cf1 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -48,120 +48,85 @@
// detect/prohibit anytime it is #included twice without a corresponding
// #undef.
-// These macros are private and should always be
-// ::util::RetrieveErrorSpace(*this) headers. If any of these errors fire, you
-// should either properly #include port_undef.h at the end of your header that
-// #includes port.h, or don't #include port.h twice in a .cc file.
-#ifdef PROTOBUF_NAMESPACE
-#error PROTOBUF_NAMESPACE was previously defined
+// The definitions in this file are intended to be portable across Clang,
+// GCC, and MSVC. Function-like macros are usable without an #ifdef guard.
+// Syntax macros (for example, attributes) are always defined, although
+// they may be empty.
+
+// Portable fallbacks for C++20 feature test macros:
+// https://en.cppreference.com/w/cpp/feature_test
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) 0
+#define PROTOBUF_has_cpp_attribute_DEFINED_
#endif
-#ifdef PROTOBUF_NAMESPACE_ID
-#error PROTOBUF_NAMESPACE_ID was previously defined
+
+// Portable fallback for Clang's __has_feature macro:
+// https://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
+#ifndef __has_feature
+#define __has_feature(x) 0
+#define PROTOBUF_has_feature_DEFINED_
#endif
-#ifdef PROTOBUF_ALWAYS_INLINE
-#error PROTOBUF_ALWAYS_INLINE was previously defined
+
+// Portable fallback for Clang's __has_warning macro:
+#ifndef __has_warning
+#define __has_warning(x) 0
+#define PROTOBUF_has_warning_DEFINED_
#endif
-#ifdef PROTOBUF_NDEBUG_INLINE
-#error PROTOBUF_NDEBUG_INLINE was previously defined
+
+// Portable fallbacks for the __has_attribute macro (GCC and Clang):
+// https://clang.llvm.org/docs/LanguageExtensions.html#has-attribute
+// https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fattribute.html
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#define PROTOBUF_has_attribute_DEFINED_
#endif
-#ifdef PROTOBUF_COLD
-#error PROTOBUF_COLD was previously defined
+
+// Portable fallback for __has_builtin (GCC and Clang):
+// https://clang.llvm.org/docs/LanguageExtensions.html#has-builtin
+// https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005fbuiltin.html
+#ifndef __has_builtin
+#define __has_builtin(x) 0
+#define PROTOBUF_has_builtin_DEFINED_
#endif
-#ifdef PROTOBUF_NOINLINE
-#error PROTOBUF_NOINLINE was previously defined
+
+// Portable check for GCC minimum version:
+// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) \
+ && defined(__GNUC_PATCHLEVEL__)
+# define PROTOBUF_GNUC_MIN(x, y) \
+ (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
+#else
+# define PROTOBUF_GNUC_MIN(x, y) 0
#endif
-#ifdef PROTOBUF_SECTION_VARIABLE
-#error PROTOBUF_SECTION_VARIABLE was previously defined
-#endif
-#ifdef PROTOBUF_DEPRECATED
-#error PROTOBUF_DEPRECATED was previously defined
-#endif
-#ifdef PROTOBUF_DEPRECATED_MSG
-#error PROTOBUF_DEPRECATED_MSG was previously defined
-#endif
-#ifdef PROTOBUF_FUNC_ALIGN
-#error PROTOBUF_FUNC_ALIGN was previously defined
-#endif
-#ifdef PROTOBUF_RETURNS_NONNULL
-#error PROTOBUF_RETURNS_NONNULL was previously defined
-#endif
-#ifdef PROTOBUF_ATTRIBUTE_REINITIALIZES
-#error PROTOBUF_ATTRIBUTE_REINITIALIZES was previously defined
-#endif
-#ifdef PROTOBUF_RTTI
-#error PROTOBUF_RTTI was previously defined
-#endif
+
+// Future versions of protobuf will include breaking changes to some APIs.
+// This macro can be set to enable these API changes ahead of time, so that
+// user code can be updated before upgrading versions of protobuf.
+// #define PROTOBUF_FUTURE_BREAKING_CHANGES 1
+
#ifdef PROTOBUF_VERSION
#error PROTOBUF_VERSION was previously defined
#endif
-#ifdef PROTOBUF_VERSION_SUFFIX
-#error PROTOBUF_VERSION_SUFFIX was previously defined
-#endif
+#define PROTOBUF_VERSION 3016000
+
#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
#endif
+#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3016000
+
#ifdef PROTOBUF_MIN_PROTOC_VERSION
#error PROTOBUF_MIN_PROTOC_VERSION was previously defined
#endif
-#ifdef PROTOBUF_PREDICT_TRUE
-#error PROTOBUF_PREDICT_TRUE was previously defined
-#endif
-#ifdef PROTOBUF_PREDICT_FALSE
-#error PROTOBUF_PREDICT_FALSE was previously defined
-#endif
-#ifdef PROTOBUF_FIELD_OFFSET
-#error PROTOBUF_FIELD_OFFSET was previously defined
-#endif
-#ifdef PROTOBUF_LL_FORMAT
-#error PROTOBUF_LL_FORMAT was previously defined
-#endif
-#ifdef PROTOBUF_GUARDED_BY
-#error PROTOBUF_GUARDED_BY was previously defined
-#endif
-#ifdef PROTOBUF_LONGLONG
-#error PROTOBUF_LONGLONG was previously defined
-#endif
-#ifdef PROTOBUF_ULONGLONG
-#error PROTOBUF_ULONGLONG was previously defined
-#endif
-#ifdef PROTOBUF_FALLTHROUGH_INTENDED
-#error PROTOBUF_FALLTHROUGH_INTENDED was previously defined
-#endif
-#ifdef PROTOBUF_EXPORT
-#error PROTOBUF_EXPORT was previously defined
-#endif
-#ifdef PROTOC_EXPORT
-#error PROTOC_EXPORT was previously defined
-#endif
-#ifdef PROTOBUF_MUST_USE_RESULT
-#error PROTOBUF_MUST_USE_RESULT was previously defined
-#endif
-#ifdef PROTOBUF_UNUSED
-#error PROTOBUF_UNUSED was previously defined
-#endif
-#ifdef PROTOBUF_FINAL
-#error PROTOBUF_FINAL was previously defined
-#endif
-#ifdef PROTOBUF_ENABLE_MSVC_UNION_WARNING
-#error PROTOBUF_ENABLE_MSVC_UNION_WARNING was previously defined
-#endif
-#ifdef PROTOBUF_CONSTINIT
-#error PROTOBUF_CONSTINIT was previously defined
-#endif
-#ifdef PROTOBUF_ATTRIBUTE_NO_DESTROY
-#error PROTOBUF_ATTRIBUTE_NO_DESTROY was previously defined
-#endif
-#ifdef PROTOBUF_ATTRIBUTE_INIT_PRIORITY
-#error PROTOBUF_ATTRIBUTE_INIT_PRIORITY was previously defined
-#endif
-#ifdef PROTOBUF_PRAGMA_INIT_SEG
-#error PROTOBUF_PRAGMA_INIT_SEG was previously defined
-#endif
-#ifdef PROTOBUF_ATTRIBUTE_WEAK
-#error PROTOBUF_ATTRIBUTE_WEAK was previously defined
-#endif
+#define PROTOBUF_MIN_PROTOC_VERSION 3016000
+#ifdef PROTOBUF_VERSION_SUFFIX
+#error PROTOBUF_VERSION_SUFFIX was previously defined
+#endif
+#define PROTOBUF_VERSION_SUFFIX ""
+#if defined(PROTOBUF_NAMESPACE) || defined(PROTOBUF_NAMESPACE_ID)
+#error PROTOBUF_NAMESPACE or PROTOBUF_NAMESPACE_ID was previously defined
+#endif
#define PROTOBUF_NAMESPACE "google::protobuf"
#define PROTOBUF_NAMESPACE_ID google::protobuf
#define PROTOBUF_NAMESPACE_OPEN \
@@ -171,194 +136,170 @@
} /* namespace protobuf */ \
} /* namespace google */
-#if defined(__clang__)
-#define PROTOBUF_DEPRECATED __attribute__((deprecated))
-#define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated))
-#define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
-#elif defined(__GNUC__)
-#define PROTOBUF_DEPRECATED __attribute__((deprecated))
-#define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
-#if __GNUC__ >= 6
-#define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated))
-#else
-#define PROTOBUF_DEPRECATED_ENUM
+#ifdef PROTOBUF_ALWAYS_INLINE
+#error PROTOBUF_ALWAYS_INLINE was previously defined
#endif
-#elif defined(_MSC_VER)
-#define PROTOBUF_DEPRECATED __declspec(deprecated)
-#define PROTOBUF_DEPRECATED_ENUM
-#define PROTOBUF_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
-#endif
-
-#define PROTOBUF_SECTION_VARIABLE(x)
-#define PROTOBUF_MUST_USE_RESULT
-
-// ----------------------------------------------------------------------------
-// Annotations: Some parts of the code have been annotated in ways that might
-// be useful to some compilers or tools, but are not supported universally.
-// You can #define these annotations yourself if the default implementation
-// is not right for you.
-
-#ifndef PROTOBUF_NO_INLINE
-#ifdef GOOGLE_ATTRIBUTE_ALWAYS_INLINE
-#define PROTOBUF_ALWAYS_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE
-#define PROTOBUF_NDEBUG_INLINE GOOGLE_ATTRIBUTE_ALWAYS_INLINE
-#elif defined(__GNUC__) && \
- (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
// For functions we want to force inline.
-// Introduced in gcc 3.1.
-#define PROTOBUF_ALWAYS_INLINE __attribute__((always_inline))
-#define PROTOBUF_NDEBUG_INLINE __attribute__((always_inline))
-#endif
-#endif
-
-#ifndef PROTOBUF_ALWAYS_INLINE
-// Other compilers will have to figure it out for themselves.
-#define PROTOBUF_ALWAYS_INLINE
-#define PROTOBUF_NDEBUG_INLINE
-#endif
-
-#ifdef GOOGLE_ATTRIBUTE_NOINLINE
-#define PROTOBUF_NOINLINE GOOGLE_ATTRIBUTE_NOINLINE
+#if defined(PROTOBUF_NO_INLINE)
+# define PROTOBUF_ALWAYS_INLINE
+#elif PROTOBUF_GNUC_MIN(3, 1)
+# define PROTOBUF_ALWAYS_INLINE __attribute__((always_inline))
+#elif defined(_MSC_VER)
+# define PROTOBUF_ALWAYS_INLINE __forceinline
#else
-#if defined(__GNUC__) && \
- (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
-// For functions we want to force not inline.
-// Introduced in gcc 3.1.
-#define PROTOBUF_NOINLINE __attribute__((noinline))
-#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
+# define PROTOBUF_ALWAYS_INLINE
+#endif
+
+#ifdef PROTOBUF_NDEBUG_INLINE
+#error PROTOBUF_NDEBUG_INLINE was previously defined
+#endif
+// Avoid excessive inlining in non-optimized builds. Without other optimizations
+// the inlining is not going to provide benefits anyway and the huge resulting
+// functions, especially in the proto-generated serialization functions, produce
+// stack frames so large that many tests run into stack overflows (b/32192897).
+#if defined(NDEBUG) || (defined(_MSC_VER) && !defined(_DEBUG))
+# define PROTOBUF_NDEBUG_INLINE PROTOBUF_ALWAYS_INLINE
+#else
+# define PROTOBUF_NDEBUG_INLINE
+#endif
+
+// Note that PROTOBUF_NOINLINE is an attribute applied to functions, to prevent
+// them from being inlined by the compiler. This is different from
+// PROTOBUF_NO_INLINE, which is a user-supplied macro that disables forced
+// inlining by PROTOBUF_(ALWAYS|NDEBUG)_INLINE.
+#ifdef PROTOBUF_NOINLINE
+#error PROTOBUF_NOINLINE was previously defined
+#endif
+#if PROTOBUF_GNUC_MIN(3, 1)
+# define PROTOBUF_NOINLINE __attribute__((noinline))
+#elif defined(_MSC_VER)
// Seems to have been around since at least Visual Studio 2005
-#define PROTOBUF_NOINLINE __declspec(noinline)
-#else
-// Other compilers will have to figure it out for themselves.
-#define PROTOBUF_NOINLINE
-#endif
+# define PROTOBUF_NOINLINE __declspec(noinline)
#endif
-#ifdef GOOGLE_ATTRIBUTE_FUNC_ALIGN
-#define PROTOBUF_FUNC_ALIGN GOOGLE_ATTRIBUTE_FUNC_ALIGN
+#ifdef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED
+#error PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED was previously defined
+#endif
+#if __has_attribute(exclusive_locks_required)
+#define PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED(...) \
+ __attribute__((exclusive_locks_required(__VA_ARGS__)))
#else
-#if defined(__clang__) || \
- defined(__GNUC__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-// Function alignment attribute introduced in gcc 4.3
+#define PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED(...)
+#endif
+
+#ifdef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS
+#error PROTOBUF_NO_THREAD_SAFETY_ANALYSIS was previously defined
+#endif
+#if __has_attribute(no_thread_safety_analysis)
+#define PROTOBUF_NO_THREAD_SAFETY_ANALYSIS \
+ __attribute__((no_thread_safety_analysis))
+#else
+#define PROTOBUF_NO_THREAD_SAFETY_ANALYSIS
+#endif
+
+#ifdef PROTOBUF_GUARDED_BY
+#error PROTOBUF_GUARDED_BY was previously defined
+#endif
+#if __has_attribute(guarded_by)
+#define PROTOBUF_GUARDED_BY(x) __attribute__((guarded_by(x)))
+#else
+#define PROTOBUF_GUARDED_BY(x)
+#endif
+
+#ifdef PROTOBUF_LOCKS_EXCLUDED
+#error PROTOBUF_LOCKS_EXCLUDED was previously defined
+#endif
+#if __has_attribute(locks_excluded)
+#define PROTOBUF_LOCKS_EXCLUDED(...) \
+ __attribute__((locks_excluded(__VA_ARGS__)))
+#else
+#define PROTOBUF_LOCKS_EXCLUDED(...)
+#endif
+
+#ifdef PROTOBUF_COLD
+#error PROTOBUF_COLD was previously defined
+#endif
+#if __has_attribute(cold) || PROTOBUF_GNUC_MIN(4, 3)
+# define PROTOBUF_COLD __attribute__((cold))
+#else
+# define PROTOBUF_COLD
+#endif
+
+#ifdef PROTOBUF_SECTION_VARIABLE
+#error PROTOBUF_SECTION_VARIABLE was previously defined
+#endif
+#define PROTOBUF_SECTION_VARIABLE(x)
+
+#if defined(PROTOBUF_DEPRECATED)
+#error PROTOBUF_DEPRECATED was previously defined
+#endif
+#if defined(PROTOBUF_DEPRECATED_MSG)
+#error PROTOBUF_DEPRECATED_MSG was previously defined
+#endif
+#if __has_attribute(deprecated) || PROTOBUF_GNUC_MIN(3, 0)
+# define PROTOBUF_DEPRECATED __attribute__((deprecated))
+# define PROTOBUF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
+#elif defined(_MSC_VER)
+# define PROTOBUF_DEPRECATED __declspec(deprecated)
+# define PROTOBUF_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
+#else
+# define PROTOBUF_DEPRECATED
+# define PROTOBUF_DEPRECATED_MSG(msg)
+#endif
+
+#if defined(PROTOBUF_DEPRECATED_ENUM)
+#error PROTOBUF_DEPRECATED_ENUM was previously defined
+#endif
+#if defined(__clang__) || PROTOBUF_GNUC_MIN(6, 0)
+// https://gcc.gnu.org/gcc-6/changes.html
+# define PROTOBUF_DEPRECATED_ENUM __attribute__((deprecated))
+#else
+# define PROTOBUF_DEPRECATED_ENUM
+#endif
+
+#ifdef PROTOBUF_FUNC_ALIGN
+#error PROTOBUF_FUNC_ALIGN was previously defined
+#endif
+#if __has_attribute(aligned) || PROTOBUF_GNUC_MIN(4, 3)
#define PROTOBUF_FUNC_ALIGN(bytes) __attribute__((aligned(bytes)))
#else
#define PROTOBUF_FUNC_ALIGN(bytes)
#endif
-#endif
-#ifdef GOOGLE_PREDICT_TRUE
-#define PROTOBUF_PREDICT_TRUE GOOGLE_PREDICT_TRUE
-#else
-#ifdef __GNUC__
-// Provided at least since GCC 3.0.
-#define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
-#else
-#define PROTOBUF_PREDICT_TRUE(x) (x)
+#ifdef PROTOBUF_RETURNS_NONNULL
+#error PROTOBUF_RETURNS_NONNULL was previously defined
#endif
-#endif
-
-#ifdef GOOGLE_PREDICT_FALSE
-#define PROTOBUF_PREDICT_FALSE GOOGLE_PREDICT_FALSE
-#else
-#ifdef __GNUC__
-// Provided at least since GCC 3.0.
-#define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect(x, 0))
-#else
-#define PROTOBUF_PREDICT_FALSE(x) (x)
-#endif
-#endif
-
-#ifdef GOOGLE_PROTOBUF_ATTRIBUTE_RETURNS_NONNULL
-#define PROTOBUF_RETURNS_NONNULL GOOGLE_PROTOBUF_ATTRIBUTE_RETURNS_NONNULL
-#else
-#if defined(__has_attribute)
-#if __has_attribute(returns_nonnull)
+#if __has_attribute(returns_nonnull) || PROTOBUF_GNUC_MIN(4, 9)
#define PROTOBUF_RETURNS_NONNULL __attribute__((returns_nonnull))
-#endif
-#endif
-#endif
-#ifndef PROTOBUF_RETURNS_NONNULL
+#else
#define PROTOBUF_RETURNS_NONNULL
#endif
-#if defined(__has_cpp_attribute)
+#ifdef PROTOBUF_ATTRIBUTE_REINITIALIZES
+#error PROTOBUF_ATTRIBUTE_REINITIALIZES was previously defined
+#endif
#if __has_cpp_attribute(clang::reinitializes)
#define PROTOBUF_ATTRIBUTE_REINITIALIZES [[clang::reinitializes]]
-#endif
-#endif
-#ifndef PROTOBUF_ATTRIBUTE_REINITIALIZES
+#else
#define PROTOBUF_ATTRIBUTE_REINITIALIZES
#endif
-#define PROTOBUF_GUARDED_BY(x)
-#define PROTOBUF_COLD
-
-// Copied from ABSL.
-#if defined(__clang__) && defined(__has_warning)
-#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
-#define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]]
-#endif
-#elif defined(__GNUC__) && __GNUC__ >= 7
-#define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
-#endif
-
-#ifndef PROTOBUF_FALLTHROUGH_INTENDED
-#define PROTOBUF_FALLTHROUGH_INTENDED
-#endif
-
-#if defined(__has_cpp_attribute)
-#define HAS_ATTRIBUTE(attr) __has_cpp_attribute(attr)
-#else
-#define HAS_ATTRIBUTE(attr) 0
-#endif
-
-#if HAS_ATTRIBUTE(unused) || (defined(__GNUC__) && !defined(__clang__))
-#define PROTOBUF_UNUSED __attribute__((__unused__))
-#else
-#define PROTOBUF_UNUSED
-#endif
-
-#undef HAS_ATTRIBUTE
-
-#ifdef _MSC_VER
-#define PROTOBUF_LONGLONG(x) x##I64
-#define PROTOBUF_ULONGLONG(x) x##UI64
-#define PROTOBUF_LL_FORMAT "I64" // As in printf("%I64d", ...)
-#else
-// By long long, we actually mean int64.
-#define PROTOBUF_LONGLONG(x) x##LL
-#define PROTOBUF_ULONGLONG(x) x##ULL
-// Used to format real long long integers.
-#define PROTOBUF_LL_FORMAT \
- "ll" // As in "%lld". Note that "q" is poor form also.
-#endif
-
-
-// Shared google3/opensource definitions. //////////////////////////////////////
-
-#define PROTOBUF_VERSION 3016000
-#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3016000
-#define PROTOBUF_MIN_PROTOC_VERSION 3016000
-#define PROTOBUF_VERSION_SUFFIX ""
-
// The minimum library version which works with the current version of the
// headers.
#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3016000
+#ifdef PROTOBUF_RTTI
+#error PROTOBUF_RTTI was previously defined
+#endif
#if defined(GOOGLE_PROTOBUF_NO_RTTI) && GOOGLE_PROTOBUF_NO_RTTI
#define PROTOBUF_RTTI 0
-#elif defined(__has_feature)
-// https://clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension
-#define PROTOBUF_RTTI __has_feature(cxx_rtti)
-#elif !defined(__cxx_rtti)
-// https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros#C.2B.2B98
-#define PROTOBUF_RTTI 0
-#elif defined(__GNUC__) && !defined(__GXX_RTTI)
-#https: // gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
-#define PROTOBUF_RTTI 0
-#else
+#elif __has_feature(cxx_rtti)
#define PROTOBUF_RTTI 1
+#elif defined(__cxx_rtti)
+// https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros#C.2B.2B98
+#define PROTOBUF_RTTI 1
+#else
+#define PROTOBUF_RTTI 0
#endif
// Returns the offset of the given field within the given aggregate type.
@@ -369,17 +310,19 @@
// which the offsets of the direct fields of a class are non-constant.
// Fields inherited from superclasses *can* have non-constant offsets,
// but that's not what this macro will be used for.
+#ifdef PROTOBUF_FIELD_OFFSET
+#error PROTOBUF_FIELD_OFFSET was previously defined
+#endif
#if defined(__clang__)
// For Clang we use __builtin_offsetof() and suppress the warning,
// to avoid Control Flow Integrity and UBSan vptr sanitizers from
-// crashing while trying to validate the invalid reinterpet_casts.
+// crashing while trying to validate the invalid reinterpret_casts.
#define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"") \
__builtin_offsetof(TYPE, FIELD) \
_Pragma("clang diagnostic pop")
-#elif defined(__GNUC__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
+#elif PROTOBUF_GNUC_MIN(4, 8)
#define PROTOBUF_FIELD_OFFSET(TYPE, FIELD) __builtin_offsetof(TYPE, FIELD)
#else // defined(__clang__)
// Note that we calculate relative to the pointer value 16 here since if we
@@ -392,43 +335,234 @@
reinterpret_cast<const char*>(16))
#endif
-#if defined(PROTOBUF_USE_DLLS)
+#ifdef PROTOBUF_EXPORT
+#error PROTOBUF_EXPORT was previously defined
+#endif
+
+#if defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
+# if defined(LIBPROTOBUF_EXPORTS)
+# define PROTOBUF_EXPORT __declspec(dllexport)
+# define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+# define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllexport)
+# else
+# define PROTOBUF_EXPORT __declspec(dllimport)
+# define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+# define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllimport)
+# endif // defined(LIBPROTOBUF_EXPORTS)
+#elif defined(PROTOBUF_USE_DLLS) && defined(LIBPROTOBUF_EXPORTS)
+# define PROTOBUF_EXPORT __attribute__((visibility("default")))
+# define PROTOBUF_EXPORT_TEMPLATE_DECLARE __attribute__((visibility("default")))
+# define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#else
+# define PROTOBUF_EXPORT
+# define PROTOBUF_EXPORT_TEMPLATE_DECLARE
+# define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#endif
+
+#ifdef PROTOC_EXPORT
+#error PROTOC_EXPORT was previously defined
+#endif
+
+#if defined(PROTOBUF_USE_DLLS) && defined(_MSC_VER)
+# if defined(LIBPROTOC_EXPORTS)
+# define PROTOC_EXPORT __declspec(dllexport)
+# else
+# define PROTOC_EXPORT __declspec(dllimport)
+# endif // defined(LIBPROTOC_EXPORTS)
+#elif defined(PROTOBUF_USE_DLLS) && defined(LIBPROTOBUF_EXPORTS)
+# define PROTOC_EXPORT __attribute__((visibility("default")))
+#else
+# define PROTOC_EXPORT
+#endif
+
+#if defined(PROTOBUF_PREDICT_TRUE) || defined(PROTOBUF_PREDICT_FALSE)
+#error PROTOBUF_PREDICT_(TRUE|FALSE) was previously defined
+#endif
+#if PROTOBUF_GNUC_MIN(3, 0)
+# define PROTOBUF_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
+# define PROTOBUF_PREDICT_FALSE(x) (__builtin_expect((x), 0))
+#else
+# define PROTOBUF_PREDICT_TRUE(x) (x)
+# define PROTOBUF_PREDICT_FALSE(x) (x)
+#endif
+
+#ifdef PROTOBUF_MUST_USE_RESULT
+#error PROTOBUF_MUST_USE_RESULT was previously defined
+#endif
+# define PROTOBUF_FUTURE_MUST_USE_RESULT
+# define PROTOBUF_MUST_USE_RESULT
+
+#ifdef PROTOBUF_FALLTHROUGH_INTENDED
+#error PROTOBUF_FALLTHROUGH_INTENDED was previously defined
+#endif
+#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
+#define PROTOBUF_FALLTHROUGH_INTENDED [[clang::fallthrough]]
+#elif PROTOBUF_GNUC_MIN(7, 0)
+#define PROTOBUF_FALLTHROUGH_INTENDED [[gnu::fallthrough]]
+#else
+#define PROTOBUF_FALLTHROUGH_INTENDED
+#endif
+
+// PROTOBUF_ASSUME(pred) tells the compiler that it can assume pred is true. To
+// be safe, we also validate the assumption with a GOOGLE_DCHECK in unoptimized
+// builds. The macro does not do anything useful if the compiler does not
+// support __builtin_assume.
+#ifdef PROTOBUF_ASSUME
+#error PROTOBUF_ASSUME was previously defined
+#endif
+#if __has_builtin(__builtin_assume)
+#define PROTOBUF_ASSUME(pred) \
+ GOOGLE_DCHECK(pred); \
+ __builtin_assume(pred)
+#else
+#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred)
+#endif
+
+// Specify memory alignment for structs, classes, etc.
+// Use like:
+// class PROTOBUF_ALIGNAS(16) MyClass { ... }
+// PROTOBUF_ALIGNAS(16) int array[4];
+//
+// In most places you can use the C++11 keyword "alignas", which is preferred.
+//
+// But compilers have trouble mixing __attribute__((...)) syntax with
+// alignas(...) syntax.
+//
+// Doesn't work in clang or gcc:
+// struct alignas(16) __attribute__((packed)) S { char c; };
+// Works in clang but not gcc:
+// struct __attribute__((packed)) alignas(16) S2 { char c; };
+// Works in clang and gcc:
+// struct alignas(16) S3 { char c; } __attribute__((packed));
+//
+// There are also some attributes that must be specified *before* a class
+// definition: visibility (used for exporting functions/classes) is one of
+// these attributes. This means that it is not possible to use alignas() with a
+// class that is marked as exported.
+#ifdef PROTOBUF_ALIGNAS
+#error PROTOBUF_ALIGNAS was previously defined
+#endif
#if defined(_MSC_VER)
-#ifdef LIBPROTOBUF_EXPORTS
-#define PROTOBUF_EXPORT __declspec(dllexport)
-#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
-#define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllexport)
+#define PROTOBUF_ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
+#elif PROTOBUF_GNUC_MIN(3, 0)
+#define PROTOBUF_ALIGNAS(byte_alignment) \
+ __attribute__((aligned(byte_alignment)))
#else
-#define PROTOBUF_EXPORT __declspec(dllimport)
-#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
-#define PROTOBUF_EXPORT_TEMPLATE_DEFINE __declspec(dllimport)
+#define PROTOBUF_ALIGNAS(byte_alignment) alignas(byte_alignment)
#endif
-#ifdef LIBPROTOC_EXPORTS
-#define PROTOC_EXPORT __declspec(dllexport)
+
+#ifdef PROTOBUF_THREAD_LOCAL
+#error PROTOBUF_THREAD_LOCAL was previously defined
+#endif
+#if defined(_MSC_VER)
+#define PROTOBUF_THREAD_LOCAL __declspec(thread)
#else
-#define PROTOC_EXPORT __declspec(dllimport)
+#define PROTOBUF_THREAD_LOCAL __thread
#endif
-#else // defined(_MSC_VER)
-#ifdef LIBPROTOBUF_EXPORTS
-#define PROTOBUF_EXPORT __attribute__((visibility("default")))
-#define PROTOBUF_EXPORT_TEMPLATE_DECLARE __attribute__((visibility("default")))
-#define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+
+// For enabling message owned arena, one major blocker is semantic change from
+// moving to copying when there is ownership transfer (e.g., move ctor, swap,
+// set allocated, release). This change not only causes performance regression
+// but also breaks users code (e.g., dangling reference). For top-level
+// messages, since it owns the arena, we can mitigate the issue by transferring
+// ownership of arena. However, we cannot do that for nested messages. In order
+// to tell how many usages of nested messages affected by message owned arena,
+// we need to simulate the arena ownership.
+// This experiment is purely for the purpose of gathering data. All code guarded
+// by this flag is supposed to be removed after this experiment.
+// #define PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
+#ifdef PROTOBUF_CONSTINIT
+#error PROTOBUF_CONSTINIT was previously defined
+#endif
+#if defined(__cpp_constinit) && !PROTOBUF_GNUC_MIN(3, 0)
+// Our use of constinit does not yet work with GCC:
+// https://github.com/protocolbuffers/protobuf/issues/8310
+#define PROTOBUF_CONSTINIT constinit
+#elif __has_cpp_attribute(clang::require_constant_initialization)
+#define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]
#else
-#define PROTOBUF_EXPORT
-#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
-#define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#define PROTOBUF_CONSTINIT
#endif
-#ifdef LIBPROTOC_EXPORTS
-#define PROTOC_EXPORT __attribute__((visibility("default")))
+
+// Some globals with an empty non-trivial destructor are annotated with
+// no_destroy for performance reasons. It reduces the cost of these globals in
+// non-opt mode and under sanitizers.
+#ifdef PROTOBUF_ATTRIBUTE_NO_DESTROY
+#error PROTOBUF_ATTRIBUTE_NO_DESTROY was previously defined
+#endif
+#if __has_cpp_attribute(clang::no_destroy)
+#define PROTOBUF_ATTRIBUTE_NO_DESTROY [[clang::no_destroy]]
#else
-#define PROTOC_EXPORT
+#define PROTOBUF_ATTRIBUTE_NO_DESTROY
#endif
+
+// Protobuf extensions and reflection require registration of the protos linked
+// in the binary. Not until everything is registered does the runtime have a
+// complete view on all protos. When code is using reflection or extensions
+// in between registration calls this can lead to surprising behavior. By
+// having the registration run first we mitigate this scenario.
+// Highest priority is 101. We use 102 to allow code that really wants to
+// higher priority to still beat us.
+#ifdef PROTOBUF_ATTRIBUTE_INIT_PRIORITY
+#error PROTOBUF_ATTRIBUTE_INIT_PRIORITY was previously defined
#endif
-#else // defined(PROTOBUF_USE_DLLS)
-#define PROTOBUF_EXPORT
-#define PROTOC_EXPORT
-#define PROTOBUF_EXPORT_TEMPLATE_DECLARE
-#define PROTOBUF_EXPORT_TEMPLATE_DEFINE
+#if PROTOBUF_GNUC_MIN(3, 0)
+#define PROTOBUF_ATTRIBUTE_INIT_PRIORITY __attribute__((init_priority((102))))
+#else
+#define PROTOBUF_ATTRIBUTE_INIT_PRIORITY
+#endif
+
+#ifdef PROTOBUF_PRAGMA_INIT_SEG
+#error PROTOBUF_PRAGMA_INIT_SEG was previously defined
+#endif
+#if _MSC_VER
+#define PROTOBUF_PRAGMA_INIT_SEG __pragma(init_seg(lib))
+#else
+#define PROTOBUF_PRAGMA_INIT_SEG
+#endif
+
+#ifdef PROTOBUF_ATTRIBUTE_WEAK
+#error PROTOBUF_ATTRIBUTE_WEAK was previously defined
+#endif
+#if __has_attribute(weak) && !defined(__MINGW32__)
+#define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak))
+#else
+#define PROTOBUF_ATTRIBUTE_WEAK
+#endif
+
+// Macros to detect sanitizers.
+#ifdef PROTOBUF_ASAN
+#error PROTOBUF_ASAN was previously defined
+#endif
+#ifdef PROTOBUF_MSAN
+#error PROTOBUF_MSAN was previously defined
+#endif
+#ifdef PROTOBUF_TSAN
+#error PROTOBUF_TSAN was previously defined
+#endif
+#if defined(__clang__)
+# if __has_feature(address_sanitizer)
+# define PROTOBUF_ASAN 1
+# endif
+# if __has_feature(thread_sanitizer)
+# define PROTOBUF_TSAN 1
+# endif
+# if __has_feature(memory_sanitizer)
+# define PROTOBUF_MSAN 1
+# endif
+#elif PROTOBUF_GNUC_MIN(3, 0)
+# define PROTOBUF_ASAN __SANITIZE_ADDRESS__
+# define PROTOBUF_TSAN __SANITIZE_THREAD__
+#endif
+
+#ifdef PROTOBUF_UNUSED
+#error PROTOBUF_UNUSED was previously defined
+#endif
+#if __has_cpp_attribute(unused) || \
+ (PROTOBUF_GNUC_MIN(3, 0) && !defined(__clang__))
+#define PROTOBUF_UNUSED __attribute__((__unused__))
+#else
+#define PROTOBUF_UNUSED
#endif
// Windows declares several inconvenient macro names. We #undef them and then
@@ -436,12 +570,16 @@
#ifdef _MSC_VER
#pragma push_macro("CREATE_NEW")
#undef CREATE_NEW
+#pragma push_macro("DELETE")
+#undef DELETE
#pragma push_macro("DOUBLE_CLICK")
#undef DOUBLE_CLICK
#pragma push_macro("ERROR")
#undef ERROR
#pragma push_macro("ERROR_BUSY")
#undef ERROR_BUSY
+#pragma push_macro("ERROR_INSTALL_FAILED")
+#undef ERROR_INSTALL_FAILED
#pragma push_macro("ERROR_NOT_FOUND")
#undef ERROR_NOT_FOUND
#pragma push_macro("GetMessage")
@@ -478,19 +616,19 @@
#undef timezone
#endif // _MSC_VER
-#if defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
-// Don't let Objective-C Macros interfere with proto identifiers with the same
+#if defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER)
+// Don't let Objective-C Macros interfere with proto identifiers with the same
// name.
#pragma push_macro("DEBUG")
#undef DEBUG
-#endif // defined(__clang__) || defined(__GNUC__) || defined(_MSC_VER)
+#endif // defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER)
#if defined(__clang__)
#pragma clang diagnostic push
// TODO(gerbens) ideally we cleanup the code. But a cursory try shows many
// violations. So let's ignore for now.
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
-#elif defined(__GNUC__)
+#elif PROTOBUF_GNUC_MIN(3, 0)
// GCC does not allow disabling diagnostics within an expression:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875, so we disable this one
// globally even though it's only used for PROTOBUF_FIELD_OFFSET.
@@ -498,125 +636,6 @@
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
-// PROTOBUF_ASSUME(pred) tells the compiler that it can assume pred is true. To
-// be safe, we also validate the assumption with a GOOGLE_DCHECK in unoptimized
-// builds. The macro does not do anything useful if the compiler does not
-// support __builtin_assume.
-#ifdef __has_builtin
-#if __has_builtin(__builtin_assume)
-#define PROTOBUF_ASSUME(pred) \
- GOOGLE_DCHECK(pred); \
- __builtin_assume(pred)
-#else
-#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred)
-#endif
-#else
-#define PROTOBUF_ASSUME(pred) GOOGLE_DCHECK(pred)
-#endif
-
-// Specify memory alignment for structs, classes, etc.
-// Use like:
-// class PROTOBUF_ALIGNAS(16) MyClass { ... }
-// PROTOBUF_ALIGNAS(16) int array[4];
-//
-// In most places you can use the C++11 keyword "alignas", which is preferred.
-//
-// But compilers have trouble mixing __attribute__((...)) syntax with
-// alignas(...) syntax.
-//
-// Doesn't work in clang or gcc:
-// struct alignas(16) __attribute__((packed)) S { char c; };
-// Works in clang but not gcc:
-// struct __attribute__((packed)) alignas(16) S2 { char c; };
-// Works in clang and gcc:
-// struct alignas(16) S3 { char c; } __attribute__((packed));
-//
-// There are also some attributes that must be specified *before* a class
-// definition: visibility (used for exporting functions/classes) is one of
-// these attributes. This means that it is not possible to use alignas() with a
-// class that is marked as exported.
-#if defined(_MSC_VER)
-#define PROTOBUF_ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
-#elif defined(__GNUC__)
-#define PROTOBUF_ALIGNAS(byte_alignment) \
- __attribute__((aligned(byte_alignment)))
-#else
-#define PROTOBUF_ALIGNAS(byte_alignment) alignas(byte_alignment)
-#endif
-
-#define PROTOBUF_FINAL final
-
-#if defined(_MSC_VER)
-#define PROTOBUF_THREAD_LOCAL __declspec(thread)
-#else
-#define PROTOBUF_THREAD_LOCAL __thread
-#endif
-
-// For enabling message owned arena, one major blocker is semantic change from
-// moving to copying when there is ownership transfer (e.g., move ctor, swap,
-// set allocated, release). This change not only causes performance regression
-// but also breaks users code (e.g., dangling reference). For top-level
-// messages, since it owns the arena, we can mitigate the issue by transferring
-// ownership of arena. However, we cannot do that for nested messages. In order
-// to tell how many usages of nested messages affected by message owned arena,
-// we need to simulate the arena ownership.
-// This experiment is purely for the purpose of gathering data. All code guarded
-// by this flag is supposed to be removed after this experiment.
-// #define PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
-
-// Our use of constinit does not yet work with GCC:
-// https://github.com/protocolbuffers/protobuf/issues/8310
-#if defined(__cpp_constinit) && !defined(__GNUC__)
-#define PROTOBUF_CONSTINIT constinit
-#elif defined(__has_cpp_attribute)
-#if __has_cpp_attribute(clang::require_constant_initialization)
-#define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]
-#endif
-#endif
-#ifndef PROTOBUF_CONSTINIT
-#define PROTOBUF_CONSTINIT
-#endif
-
-// Some globals with an empty non-trivial destructor are annotated with
-// no_destroy for performance reasons. It reduces the cost of these globals in
-// non-opt mode and under sanitizers.
-#if defined(__has_cpp_attribute)
-#if __has_cpp_attribute(clang::no_destroy)
-#define PROTOBUF_ATTRIBUTE_NO_DESTROY [[clang::no_destroy]]
-#endif
-#endif
-#if !defined(PROTOBUF_ATTRIBUTE_NO_DESTROY)
-#define PROTOBUF_ATTRIBUTE_NO_DESTROY
-#endif
-
-#if defined(__GNUC__)
-// Protobuf extensions and reflection require registration of the protos linked
-// in the binary. Not until everything is registered does the runtime have a
-// complete view on all protos. When code is using reflection or extensions
-// in between registration calls this can lead to surprising behavior. By
-// having the registration run first we mitigate this scenario.
-// Highest priority is 101. We use 102 to allow code that really wants to
-// higher priority to still beat us.
-#define PROTOBUF_ATTRIBUTE_INIT_PRIORITY __attribute__((init_priority((102))))
-#else
-#define PROTOBUF_ATTRIBUTE_INIT_PRIORITY
-#endif
-
-#if _MSC_VER
-#define PROTOBUF_PRAGMA_INIT_SEG __pragma(init_seg(lib))
-#else
-#define PROTOBUF_PRAGMA_INIT_SEG
-#endif
-
-#if defined(__has_attribute) && !defined(__MINGW32__)
-#if __has_attribute(weak)
-#define PROTOBUF_ATTRIBUTE_WEAK __attribute__((weak))
-#endif
-#endif
-#if !defined(PROTOBUF_ATTRIBUTE_WEAK)
-#define PROTOBUF_ATTRIBUTE_WEAK
-#endif
-
// Silence some MSVC warnings in all our code.
#if _MSC_VER
#pragma warning(push)
@@ -628,3 +647,28 @@
// To silence the fact that we will pop this push from another file
#pragma warning(disable : 5031)
#endif
+
+// We don't want code outside port_def doing complex testing, so
+// remove our portable condition test macros to nudge folks away from
+// using it themselves.
+#ifdef PROTOBUF_has_cpp_attribute_DEFINED_
+# undef __has_cpp_attribute
+# undef PROTOBUF_has_cpp_attribute_DEFINED_
+#endif
+#ifdef PROTOBUF_has_feature_DEFINED_
+# undef __has_feature
+# undef PROTOBUF_has_feature_DEFINED_
+#endif
+#ifdef PROTOBUF_has_warning_DEFINED_
+# undef __has_warning
+# undef PROTOBUF_has_warning_DEFINED_
+#endif
+#ifdef PROTOBUF_has_attribute_DEFINED_
+# undef __has_attribute
+# undef PROTOBUF_has_attribute_DEFINED_
+#endif
+#ifdef PROTOBUF_has_builtin_DEFINED_
+# undef __has_builtin
+# undef PROTOBUF_has_builtin_DEFINED_
+#endif
+#undef PROTOBUF_GNUC_MIN
diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc
index 8591762..82fe794 100644
--- a/src/google/protobuf/port_undef.inc
+++ b/src/google/protobuf/port_undef.inc
@@ -55,10 +55,6 @@
#undef PROTOBUF_MIN_PROTOC_VERSION
#undef PROTOBUF_PREDICT_TRUE
#undef PROTOBUF_PREDICT_FALSE
-#undef PROTOBUF_LONGLONG
-#undef PROTOBUF_ULONGLONG
-#undef PROTOBUF_LL_FORMAT
-#undef PROTOBUF_GUARDED_BY
#undef PROTOBUF_FALLTHROUGH_INTENDED
#undef PROTOBUF_EXPORT
#undef PROTOC_EXPORT
@@ -70,7 +66,6 @@
#undef PROTOBUF_EXPORT_TEMPLATE_DECLARE
#undef PROTOBUF_EXPORT_TEMPLATE_DEFINE
#undef PROTOBUF_ALIGNAS
-#undef PROTOBUF_FINAL
#undef PROTOBUF_THREAD_LOCAL
#undef PROTOBUF_MESSAGE_OWNED_ARENA_EXPERIMENT
#undef PROTOBUF_CONSTINIT
@@ -78,6 +73,13 @@
#undef PROTOBUF_ATTRIBUTE_NO_DESTROY
#undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY
#undef PROTOBUF_PRAGMA_INIT_SEG
+#undef PROTOBUF_ASAN
+#undef PROTOBUF_MSAN
+#undef PROTOBUF_TSAN
+#undef PROTOBUF_EXCLUSIVE_LOCKS_REQUIRED
+#undef PROTOBUF_LOCKS_EXCLUDED
+#undef PROTOBUF_NO_THREAD_SAFETY_ANALYSIS
+#undef PROTOBUF_GUARDED_BY
#ifdef PROTOBUF_FUTURE_BREAKING_CHANGES
#undef PROTOBUF_FUTURE_BREAKING_CHANGES
@@ -86,9 +88,11 @@
// Restore macro that may have been #undef'd in port_def.inc.
#ifdef _MSC_VER
#pragma pop_macro("CREATE_NEW")
+#pragma pop_macro("DELETE")
#pragma pop_macro("DOUBLE_CLICK")
#pragma pop_macro("ERROR")
#pragma pop_macro("ERROR_BUSY")
+#pragma pop_macro("ERROR_INSTALL_FAILED")
#pragma pop_macro("ERROR_NOT_FOUND")
#pragma pop_macro("GetMessage")
#pragma pop_macro("IGNORE")
diff --git a/src/google/protobuf/proto3_arena_unittest.cc b/src/google/protobuf/proto3_arena_unittest.cc
index 83be3d8..5588f91 100644
--- a/src/google/protobuf/proto3_arena_unittest.cc
+++ b/src/google/protobuf/proto3_arena_unittest.cc
@@ -42,6 +42,9 @@
#include <gtest/gtest.h>
#include <google/protobuf/stubs/strutil.h>
+// Must be included last.
+#include <google/protobuf/port_def.inc>
+
using proto3_arena_unittest::ForeignMessage;
using proto3_arena_unittest::TestAllTypes;
@@ -166,8 +169,6 @@
auto* arena_repeated_submessage1 =
arena_message1->add_repeated_foreign_message();
EXPECT_EQ(&arena, arena_message1->GetArena());
- EXPECT_EQ(&arena,
- internal::Proto3ArenaTestHelper::GetOwningArena(*arena_message1));
EXPECT_EQ(&arena, arena_submessage1->GetArena());
EXPECT_EQ(&arena, arena_repeated_submessage1->GetArena());
@@ -180,17 +181,11 @@
const auto& repeated_submessage2 =
arena_message2->repeated_foreign_message(0);
EXPECT_EQ(nullptr, submessage2.GetArena());
- EXPECT_EQ(&arena,
- internal::Proto3ArenaTestHelper::GetOwningArena(submessage2));
EXPECT_EQ(nullptr, repeated_submessage2.GetArena());
- EXPECT_EQ(&arena, internal::Proto3ArenaTestHelper::GetOwningArena(
- repeated_submessage2));
// Tests message created by Arena::Create.
auto* arena_message3 = Arena::Create<TestAllTypes>(&arena);
EXPECT_EQ(nullptr, arena_message3->GetArena());
- EXPECT_EQ(&arena,
- internal::Proto3ArenaTestHelper::GetOwningArena(*arena_message3));
}
TEST(Proto3ArenaTest, GetArenaWithUnknown) {
@@ -206,8 +201,6 @@
arena_repeated_submessage1->GetReflection()->MutableUnknownFields(
arena_repeated_submessage1);
EXPECT_EQ(&arena, arena_message1->GetArena());
- EXPECT_EQ(&arena,
- internal::Proto3ArenaTestHelper::GetOwningArena(*arena_message1));
EXPECT_EQ(&arena, arena_submessage1->GetArena());
EXPECT_EQ(&arena, arena_repeated_submessage1->GetArena());
@@ -223,11 +216,7 @@
repeated_submessage2->GetReflection()->MutableUnknownFields(
repeated_submessage2);
EXPECT_EQ(nullptr, submessage2->GetArena());
- EXPECT_EQ(&arena,
- internal::Proto3ArenaTestHelper::GetOwningArena(*submessage2));
EXPECT_EQ(nullptr, repeated_submessage2->GetArena());
- EXPECT_EQ(&arena, internal::Proto3ArenaTestHelper::GetOwningArena(
- *repeated_submessage2));
}
TEST(Proto3ArenaTest, Swap) {
diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc
index 9a622f4..1c521e4 100644
--- a/src/google/protobuf/reflection_ops.cc
+++ b/src/google/protobuf/reflection_ops.cc
@@ -418,19 +418,24 @@
}
}
-void GenericSwap(Message* m1, Message* m2) {
- Arena* m2_arena = m2->GetArena();
- GOOGLE_DCHECK(m1->GetArena() != m2_arena);
+void GenericSwap(Message* lhs, Message* rhs) {
+ GOOGLE_DCHECK(Arena::InternalHelper<Message>::GetOwningArena(lhs) !=
+ Arena::InternalHelper<Message>::GetOwningArena(rhs));
+ // At least one of these must have an arena, so make `rhs` point to it.
+ Arena* arena = Arena::InternalHelper<Message>::GetOwningArena(rhs);
+ if (arena == nullptr) {
+ std::swap(lhs, rhs);
+ arena = Arena::InternalHelper<Message>::GetOwningArena(rhs);
+ }
- // Copy semantics in this case. We try to improve efficiency by placing the
- // temporary on |m2|'s arena so that messages are copied twice rather than
- // three times.
- Message* tmp = m2->New(m2_arena);
- std::unique_ptr<Message> tmp_deleter(m2_arena == nullptr ? tmp : nullptr);
- tmp->CheckTypeAndMergeFrom(*m1);
- m1->Clear();
- m1->CheckTypeAndMergeFrom(*m2);
- m2->GetReflection()->Swap(tmp, m2);
+ // Improve efficiency by placing the temporary on an arena so that messages
+ // are copied twice rather than three times.
+ GOOGLE_DCHECK(arena != nullptr);
+ Message* tmp = rhs->New(arena);
+ tmp->CheckTypeAndMergeFrom(*lhs);
+ lhs->Clear();
+ lhs->CheckTypeAndMergeFrom(*rhs);
+ rhs->GetReflection()->Swap(tmp, rhs);
}
} // namespace internal
diff --git a/src/google/protobuf/reflection_ops_unittest.cc b/src/google/protobuf/reflection_ops_unittest.cc
index dee2af2..8c4da21 100644
--- a/src/google/protobuf/reflection_ops_unittest.cc
+++ b/src/google/protobuf/reflection_ops_unittest.cc
@@ -535,8 +535,8 @@
TestUtil::ExpectAllFieldsSet(message);
TestUtil::ExpectClear(*arena_message);
- // The temp shouldn't be allocated on the arena in this case.
- EXPECT_EQ(arena.SpaceUsed(), initial_arena_size);
+ // The temp should be allocated on the arena in this case.
+ EXPECT_GT(arena.SpaceUsed(), initial_arena_size);
}
}
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 58190e3..57bc7ee 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -595,12 +595,10 @@
#endif
}
- public:
// Must be called from destructor.
template <typename TypeHandler>
void Destroy();
- protected:
bool empty() const;
int size() const;
@@ -688,7 +686,7 @@
void UnsafeArenaAddAllocated(typename TypeHandler::Type* value);
template <typename TypeHandler>
- typename TypeHandler::Type* ReleaseLast() {
+ PROTOBUF_FUTURE_MUST_USE_RESULT typename TypeHandler::Type* ReleaseLast() {
typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t;
return ReleaseLastInternal<TypeHandler>(t);
}
@@ -702,7 +700,7 @@
template <typename TypeHandler>
void AddCleared(typename TypeHandler::Type* value);
template <typename TypeHandler>
- typename TypeHandler::Type* ReleaseCleared();
+ PROTOBUF_FUTURE_MUST_USE_RESULT typename TypeHandler::Type* ReleaseCleared();
template <typename TypeHandler>
void AddAllocatedInternal(typename TypeHandler::Type* value, std::true_type);
@@ -800,6 +798,7 @@
// reinterpreting pointers as being to Message instead of a specific Message
// subclass.
friend class MapFieldBase;
+ friend class MapFieldBaseStub;
// The table-driven MergePartialFromCodedStream implementation needs to
// operate on RepeatedPtrField<MessageLite>.
@@ -830,11 +829,8 @@
delete value;
}
}
- static inline Arena* GetArena(GenericType* value) {
- return Arena::GetArena<Type>(value);
- }
- static inline void* GetMaybeArenaPointer(GenericType* value) {
- return Arena::GetArena<Type>(value);
+ static inline Arena* GetOwningArena(GenericType* value) {
+ return Arena::GetOwningArena<Type>(value);
}
static inline void Clear(GenericType* value) { value->Clear(); }
@@ -863,13 +859,9 @@
MessageLite* GenericTypeHandler<MessageLite>::NewFromPrototype(
const MessageLite* prototype, Arena* arena);
template <>
-inline Arena* GenericTypeHandler<MessageLite>::GetArena(MessageLite* value) {
- return value->GetArena();
-}
-template <>
-inline void* GenericTypeHandler<MessageLite>::GetMaybeArenaPointer(
+inline Arena* GenericTypeHandler<MessageLite>::GetOwningArena(
MessageLite* value) {
- return value->GetMaybeArenaPointer();
+ return value->GetOwningArena();
}
template <>
void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from,
@@ -889,9 +881,7 @@
PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype(
const Message* prototype, Arena* arena);
template <>
-PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetArena(Message* value);
-template <>
-PROTOBUF_EXPORT void* GenericTypeHandler<Message>::GetMaybeArenaPointer(
+PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetOwningArena(
Message* value);
class StringTypeHandler {
@@ -909,10 +899,7 @@
Arena* arena) {
return New(arena);
}
- static inline Arena* GetArena(std::string*) { return NULL; }
- static inline void* GetMaybeArenaPointer(std::string* /* value */) {
- return NULL;
- }
+ static inline Arena* GetOwningArena(std::string*) { return nullptr; }
static inline void Delete(std::string* value, Arena* arena) {
if (arena == NULL) {
delete value;
@@ -1084,7 +1071,7 @@
// If this RepeatedPtrField is on an arena, an object copy is required to pass
// ownership back to the user (for compatible semantics). Use
// UnsafeArenaReleaseLast() if this behavior is undesired.
- Element* ReleaseLast();
+ PROTOBUF_FUTURE_MUST_USE_RESULT Element* ReleaseLast();
// Add an already-allocated object, skipping arena-ownership checks. The user
// must guarantee that the given object is in the same arena as this
@@ -1154,7 +1141,7 @@
//
// This method cannot be called when the repeated field is on an arena; doing
// so will trigger a GOOGLE_DCHECK-failure.
- Element* ReleaseCleared();
+ PROTOBUF_FUTURE_MUST_USE_RESULT Element* ReleaseCleared();
// Removes the element referenced by position.
//
@@ -1496,7 +1483,6 @@
template <typename Element>
inline void RepeatedField<Element>::InternalSwap(RepeatedField* other) {
GOOGLE_DCHECK(this != other);
- GOOGLE_DCHECK(GetArena() == other->GetArena());
// Swap all fields at once.
static_assert(std::is_standard_layout<RepeatedField<Element>>::value,
@@ -1944,7 +1930,7 @@
void RepeatedPtrFieldBase::AddAllocatedInternal(
typename TypeHandler::Type* value, std::true_type) {
Arena* element_arena =
- reinterpret_cast<Arena*>(TypeHandler::GetMaybeArenaPointer(value));
+ reinterpret_cast<Arena*>(TypeHandler::GetOwningArena(value));
Arena* arena = GetArena();
if (arena == element_arena && rep_ && rep_->allocated_size < total_size_) {
// Fast path: underlying arena representation (tagged pointer) is equal to
@@ -1960,8 +1946,7 @@
current_size_ = current_size_ + 1;
rep_->allocated_size = rep_->allocated_size + 1;
} else {
- AddAllocatedSlowWithCopy<TypeHandler>(value, TypeHandler::GetArena(value),
- arena);
+ AddAllocatedSlowWithCopy<TypeHandler>(value, element_arena, arena);
}
}
@@ -2093,7 +2078,7 @@
typename TypeHandler::Type* value) {
GOOGLE_DCHECK(GetArena() == NULL)
<< "AddCleared() can only be used on a RepeatedPtrField not on an arena.";
- GOOGLE_DCHECK(TypeHandler::GetArena(value) == NULL)
+ GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr)
<< "AddCleared() can only accept values not on an arena.";
if (!rep_ || rep_->allocated_size == total_size_) {
Reserve(total_size_ + 1);
@@ -2635,17 +2620,14 @@
void RepeatedPtrFieldBase::InternalSwap(RepeatedPtrFieldBase* other) {
GOOGLE_DCHECK(this != other);
- GOOGLE_DCHECK(GetArena() == other->GetArena());
// Swap all fields at once.
static_assert(std::is_standard_layout<RepeatedPtrFieldBase>::value,
"offsetof() requires standard layout before c++17");
internal::memswap<offsetof(RepeatedPtrFieldBase, rep_) + sizeof(this->rep_) -
- offsetof(RepeatedPtrFieldBase, current_size_)>(
- reinterpret_cast<char*>(this) +
- offsetof(RepeatedPtrFieldBase, current_size_),
- reinterpret_cast<char*>(other) +
- offsetof(RepeatedPtrFieldBase, current_size_));
+ offsetof(RepeatedPtrFieldBase, arena_)>(
+ reinterpret_cast<char*>(this) + offsetof(RepeatedPtrFieldBase, arena_),
+ reinterpret_cast<char*>(other) + offsetof(RepeatedPtrFieldBase, arena_));
}
} // namespace internal
diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
index f3e8c2d..b270885 100644
--- a/src/google/protobuf/repeated_field_unittest.cc
+++ b/src/google/protobuf/repeated_field_unittest.cc
@@ -333,7 +333,7 @@
EXPECT_GE(huge_field.Capacity(), min_clamping_size);
ASSERT_LT(huge_field.Capacity(), std::numeric_limits<int>::max() - 1);
-#ifndef ADDRESS_SANITIZER
+#ifndef PROTOBUF_ASAN
// The array containing all the fields is, in theory, up to MAXINT-1 in size.
// However, some compilers can't handle a struct whose size is larger
// than 2GB, and the protocol buffer format doesn't handle more than 2GB of
@@ -344,7 +344,7 @@
// size must still be clamped to a valid range.
huge_field.Reserve(huge_field.Capacity() + 1);
EXPECT_EQ(huge_field.Capacity(), std::numeric_limits<int>::max());
-#endif
+#endif // PROTOBUF_ASAN
#endif // PROTOBUF_TEST_ALLOW_LARGE_ALLOC
}
diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc
index 3994ceb..019e045 100644
--- a/src/google/protobuf/source_context.pb.cc
+++ b/src/google/protobuf/source_context.pb.cc
@@ -91,7 +91,7 @@
file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_file_name().empty()) {
file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_file_name(),
- GetArena());
+ GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext)
}
@@ -107,7 +107,7 @@
}
void SourceContext::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
file_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -176,7 +176,7 @@
(void) cached_has_bits;
// string file_name = 1;
- if (this->file_name().size() > 0) {
+ if (!this->file_name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_file_name().data(), static_cast<int>(this->_internal_file_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -202,7 +202,7 @@
(void) cached_has_bits;
// string file_name = 1;
- if (this->file_name().size() > 0) {
+ if (!this->file_name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_file_name());
@@ -239,7 +239,7 @@
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
- if (from.file_name().size() > 0) {
+ if (!from.file_name().empty()) {
_internal_set_file_name(from._internal_file_name());
}
}
@@ -264,8 +264,12 @@
void SourceContext::InternalSwap(SourceContext* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- file_name_.Swap(&other->file_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &file_name_, GetArenaForAllocation(),
+ &other->file_name_, other->GetArenaForAllocation()
+ );
}
::PROTOBUF_NAMESPACE_ID::Metadata SourceContext::GetMetadata() const {
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index ef58998..d89a908 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -65,7 +65,7 @@
// ===================================================================
-class PROTOBUF_EXPORT SourceContext PROTOBUF_FINAL :
+class PROTOBUF_EXPORT SourceContext final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.SourceContext) */ {
public:
inline SourceContext() : SourceContext(nullptr) {}
@@ -83,8 +83,9 @@
return *this;
}
inline SourceContext& operator=(SourceContext&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -115,7 +116,7 @@
}
inline void Swap(SourceContext* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -123,14 +124,14 @@
}
void UnsafeArenaSwap(SourceContext* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SourceContext* New() const final {
- return CreateMaybeMessage<SourceContext>(nullptr);
+ return new SourceContext();
}
SourceContext* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -150,8 +151,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SourceContext* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -180,11 +181,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_file_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_file_name();
- std::string* release_file_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_file_name();
void set_allocated_file_name(std::string* file_name);
private:
const std::string& _internal_file_name() const;
- void _internal_set_file_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_file_name(const std::string& value);
std::string* _internal_mutable_file_name();
public:
@@ -219,10 +220,10 @@
return _internal_file_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void SourceContext::set_file_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void SourceContext::set_file_name(ArgT0&& arg0, ArgT... args) {
- file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.SourceContext.file_name)
}
inline std::string* SourceContext::mutable_file_name() {
@@ -234,15 +235,15 @@
}
inline void SourceContext::_internal_set_file_name(const std::string& value) {
- file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* SourceContext::_internal_mutable_file_name() {
- return file_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return file_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* SourceContext::release_file_name() {
// @@protoc_insertion_point(field_release:google.protobuf.SourceContext.file_name)
- return file_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return file_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void SourceContext::set_allocated_file_name(std::string* file_name) {
if (file_name != nullptr) {
@@ -251,7 +252,7 @@
}
file_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), file_name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name)
}
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index fbe98e7..960b29c 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -213,14 +213,18 @@
}
void Struct::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void Struct::ArenaDtor(void* object) {
Struct* _this = reinterpret_cast< Struct* >(object);
(void)_this;
+ _this->fields_. ~MapField();
}
-void Struct::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
+inline void Struct::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena* arena) {
+ if (arena != nullptr) {
+ arena->OwnCustomDestructor(this, &Struct::ArenaDtor);
+ }
}
void Struct::SetCachedSize(int size) const {
_cached_size_.Set(size);
@@ -291,6 +295,7 @@
typedef ::PROTOBUF_NAMESPACE_ID::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
+ (void)p;
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), static_cast<int>(p->first.length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -403,8 +408,8 @@
void Struct::InternalSwap(Struct* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- fields_.Swap(&other->fields_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ fields_.InternalSwap(&other->fields_);
}
::PROTOBUF_NAMESPACE_ID::Metadata Struct::GetMetadata() const {
@@ -430,11 +435,11 @@
return *msg->kind_.list_value_;
}
void Value::set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_kind();
if (struct_value) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(struct_value);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::Struct>::GetOwningArena(struct_value);
if (message_arena != submessage_arena) {
struct_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, struct_value, submessage_arena);
@@ -445,11 +450,11 @@
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
}
void Value::set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
clear_kind();
if (list_value) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- ::PROTOBUF_NAMESPACE_ID::Arena::GetArena(list_value);
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<PROTOBUF_NAMESPACE_ID::ListValue>::GetOwningArena(list_value);
if (message_arena != submessage_arena) {
list_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, list_value, submessage_arena);
@@ -512,7 +517,7 @@
}
void Value::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
if (has_kind()) {
clear_kind();
}
@@ -540,7 +545,7 @@
break;
}
case kStringValue: {
- kind_.string_value_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ kind_.string_value_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
break;
}
case kBoolValue: {
@@ -548,13 +553,13 @@
break;
}
case kStructValue: {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete kind_.struct_value_;
}
break;
}
case kListValue: {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete kind_.list_value_;
}
break;
@@ -842,7 +847,7 @@
void Value::InternalSwap(Value* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(kind_, other->kind_);
swap(_oneof_case_[0], other->_oneof_case_[0]);
}
@@ -883,7 +888,7 @@
}
void ListValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void ListValue::ArenaDtor(void* object) {
@@ -1038,7 +1043,7 @@
void ListValue::InternalSwap(ListValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
values_.InternalSwap(&other->values_);
}
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index f0ee367..35ca3b6 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -130,7 +130,7 @@
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Struct PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Struct final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Struct) */ {
public:
inline Struct() : Struct(nullptr) {}
@@ -148,8 +148,9 @@
return *this;
}
inline Struct& operator=(Struct&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -180,7 +181,7 @@
}
inline void Swap(Struct* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -188,14 +189,14 @@
}
void UnsafeArenaSwap(Struct* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Struct* New() const final {
- return CreateMaybeMessage<Struct>(nullptr);
+ return new Struct();
}
Struct* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -215,8 +216,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Struct* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -274,7 +275,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Value PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Value final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Value) */ {
public:
inline Value() : Value(nullptr) {}
@@ -292,8 +293,9 @@
return *this;
}
inline Value& operator=(Value&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -334,7 +336,7 @@
}
inline void Swap(Value* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -342,14 +344,14 @@
}
void UnsafeArenaSwap(Value* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Value* New() const final {
- return CreateMaybeMessage<Value>(nullptr);
+ return new Value();
}
Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -369,8 +371,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Value* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -434,11 +436,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_string_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_string_value();
- std::string* release_string_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_string_value();
void set_allocated_string_value(std::string* string_value);
private:
const std::string& _internal_string_value() const;
- void _internal_set_string_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_string_value(const std::string& value);
std::string* _internal_mutable_string_value();
public:
@@ -462,7 +464,7 @@
public:
void clear_struct_value();
const PROTOBUF_NAMESPACE_ID::Struct& struct_value() const;
- PROTOBUF_NAMESPACE_ID::Struct* release_struct_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::Struct* release_struct_value();
PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value();
void set_allocated_struct_value(PROTOBUF_NAMESPACE_ID::Struct* struct_value);
private:
@@ -480,7 +482,7 @@
public:
void clear_list_value();
const PROTOBUF_NAMESPACE_ID::ListValue& list_value() const;
- PROTOBUF_NAMESPACE_ID::ListValue* release_list_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::ListValue* release_list_value();
PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value();
void set_allocated_list_value(PROTOBUF_NAMESPACE_ID::ListValue* list_value);
private:
@@ -526,7 +528,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT ListValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT ListValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ListValue) */ {
public:
inline ListValue() : ListValue(nullptr) {}
@@ -544,8 +546,9 @@
return *this;
}
inline ListValue& operator=(ListValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -576,7 +579,7 @@
}
inline void Swap(ListValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -584,14 +587,14 @@
}
void UnsafeArenaSwap(ListValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline ListValue* New() const final {
- return CreateMaybeMessage<ListValue>(nullptr);
+ return new ListValue();
}
ListValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -611,8 +614,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(ListValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -798,7 +801,7 @@
}
inline void Value::clear_string_value() {
if (_internal_has_string_value()) {
- kind_.string_value_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ kind_.string_value_.Destroy(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
clear_has_kind();
}
}
@@ -813,7 +816,7 @@
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
- kind_.string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ kind_.string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
}
inline std::string* Value::mutable_string_value() {
@@ -832,7 +835,7 @@
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
- kind_.string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ kind_.string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Value::_internal_mutable_string_value() {
if (!_internal_has_string_value()) {
@@ -841,13 +844,13 @@
kind_.string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
return kind_.string_value_.Mutable(
- ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Value::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.string_value)
if (_internal_has_string_value()) {
clear_has_kind();
- return kind_.string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return kind_.string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
} else {
return nullptr;
}
@@ -859,7 +862,7 @@
if (string_value != nullptr) {
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(string_value);
- ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* arena = GetArenaForAllocation();
if (arena != nullptr) {
arena->Own(string_value);
}
@@ -917,7 +920,7 @@
}
inline void Value::clear_struct_value() {
if (_internal_has_struct_value()) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete kind_.struct_value_;
}
clear_has_kind();
@@ -928,7 +931,7 @@
if (_internal_has_struct_value()) {
clear_has_kind();
PROTOBUF_NAMESPACE_ID::Struct* temp = kind_.struct_value_;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
kind_.struct_value_ = nullptr;
@@ -969,7 +972,7 @@
if (!_internal_has_struct_value()) {
clear_kind();
set_has_struct_value();
- kind_.struct_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct >(GetArena());
+ kind_.struct_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::Struct >(GetArenaForAllocation());
}
return kind_.struct_value_;
}
@@ -990,7 +993,7 @@
}
inline void Value::clear_list_value() {
if (_internal_has_list_value()) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete kind_.list_value_;
}
clear_has_kind();
@@ -1001,7 +1004,7 @@
if (_internal_has_list_value()) {
clear_has_kind();
PROTOBUF_NAMESPACE_ID::ListValue* temp = kind_.list_value_;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
kind_.list_value_ = nullptr;
@@ -1042,7 +1045,7 @@
if (!_internal_has_list_value()) {
clear_kind();
set_has_list_value();
- kind_.list_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ListValue >(GetArena());
+ kind_.list_value_ = CreateMaybeMessage< PROTOBUF_NAMESPACE_ID::ListValue >(GetArenaForAllocation());
}
return kind_.list_value_;
}
diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc
index f2859e9..9067818 100644
--- a/src/google/protobuf/stubs/common.cc
+++ b/src/google/protobuf/stubs/common.cc
@@ -211,32 +211,29 @@
return *this;
}
-// Since this is just for logging, we don't care if the current locale changes
-// the results -- in fact, we probably prefer that. So we use snprintf()
-// instead of Simple*toa().
+LogMessage& LogMessage::operator<<(char value) {
+ return *this << StringPiece(&value, 1);
+}
+
+LogMessage& LogMessage::operator<<(void* value) {
+ StrAppend(&message_, strings::Hex(reinterpret_cast<uintptr_t>(value)));
+ return *this;
+}
+
#undef DECLARE_STREAM_OPERATOR
-#define DECLARE_STREAM_OPERATOR(TYPE, FORMAT) \
- LogMessage& LogMessage::operator<<(TYPE value) { \
- /* 128 bytes should be big enough for any of the primitive */ \
- /* values which we print with this, but well use snprintf() */ \
- /* anyway to be extra safe. */ \
- char buffer[128]; \
- snprintf(buffer, sizeof(buffer), FORMAT, value); \
- /* Guard against broken MSVC snprintf(). */ \
- buffer[sizeof(buffer)-1] = '\0'; \
- message_ += buffer; \
- return *this; \
+#define DECLARE_STREAM_OPERATOR(TYPE) \
+ LogMessage& LogMessage::operator<<(TYPE value) { \
+ StrAppend(&message_, value); \
+ return *this; \
}
-DECLARE_STREAM_OPERATOR(char , "%c" )
-DECLARE_STREAM_OPERATOR(int , "%d" )
-DECLARE_STREAM_OPERATOR(unsigned int , "%u" )
-DECLARE_STREAM_OPERATOR(long , "%ld")
-DECLARE_STREAM_OPERATOR(unsigned long, "%lu")
-DECLARE_STREAM_OPERATOR(double , "%g" )
-DECLARE_STREAM_OPERATOR(void* , "%p" )
-DECLARE_STREAM_OPERATOR(long long , "%" PROTOBUF_LL_FORMAT "d")
-DECLARE_STREAM_OPERATOR(unsigned long long, "%" PROTOBUF_LL_FORMAT "u")
+DECLARE_STREAM_OPERATOR(int)
+DECLARE_STREAM_OPERATOR(unsigned int)
+DECLARE_STREAM_OPERATOR(long) // NOLINT(runtime/int)
+DECLARE_STREAM_OPERATOR(unsigned long) // NOLINT(runtime/int)
+DECLARE_STREAM_OPERATOR(double)
+DECLARE_STREAM_OPERATOR(long long) // NOLINT(runtime/int)
+DECLARE_STREAM_OPERATOR(unsigned long long) // NOLINT(runtime/int)
#undef DECLARE_STREAM_OPERATOR
LogMessage::LogMessage(LogLevel level, const char* filename, int line)
diff --git a/src/google/protobuf/stubs/int128.cc b/src/google/protobuf/stubs/int128.cc
index 7fc7dd8..e5e159e 100644
--- a/src/google/protobuf/stubs/int128.cc
+++ b/src/google/protobuf/stubs/int128.cc
@@ -41,10 +41,8 @@
namespace google {
namespace protobuf {
-const uint128_pod kuint128max = {
- static_cast<uint64>(PROTOBUF_LONGLONG(0xFFFFFFFFFFFFFFFF)),
- static_cast<uint64>(PROTOBUF_LONGLONG(0xFFFFFFFFFFFFFFFF))
-};
+const uint128_pod kuint128max = {uint64_t{0xFFFFFFFFFFFFFFFFu},
+ uint64_t{0xFFFFFFFFFFFFFFFFu}};
// Returns the 0-based position of the last set bit (i.e., most significant bit)
// in the given uint64. The argument may not be 0.
@@ -67,7 +65,7 @@
STEP(uint32, n32, pos, 0x10);
STEP(uint32, n32, pos, 0x08);
STEP(uint32, n32, pos, 0x04);
- return pos + ((PROTOBUF_ULONGLONG(0x3333333322221100) >> (n32 << 2)) & 0x3);
+ return pos + ((uint64_t{0x3333333322221100u} >> (n32 << 2)) & 0x3);
}
#undef STEP
@@ -134,17 +132,17 @@
switch (flags & std::ios::basefield) {
case std::ios::hex:
div =
- static_cast<uint64>(PROTOBUF_ULONGLONG(0x1000000000000000)); // 16^15
+ static_cast<uint64>(uint64_t{0x1000000000000000u}); // 16^15
div_base_log = 15;
break;
case std::ios::oct:
div = static_cast<uint64>(
- PROTOBUF_ULONGLONG(01000000000000000000000)); // 8^21
+ uint64_t{01000000000000000000000u}); // 8^21
div_base_log = 21;
break;
default: // std::ios::dec
div = static_cast<uint64>(
- PROTOBUF_ULONGLONG(10000000000000000000)); // 10^19
+ uint64_t{10000000000000000000u}); // 10^19
div_base_log = 19;
break;
}
diff --git a/src/google/protobuf/stubs/int128_unittest.cc b/src/google/protobuf/stubs/int128_unittest.cc
index 53dbd09..77e41cc 100644
--- a/src/google/protobuf/stubs/int128_unittest.cc
+++ b/src/google/protobuf/stubs/int128_unittest.cc
@@ -293,26 +293,20 @@
}
// Verified with dc.
- a = uint128(PROTOBUF_ULONGLONG(0xffffeeeeddddcccc),
- PROTOBUF_ULONGLONG(0xbbbbaaaa99998888));
- b = uint128(PROTOBUF_ULONGLONG(0x7777666655554444),
- PROTOBUF_ULONGLONG(0x3333222211110000));
+ a = uint128(uint64_t{0xffffeeeeddddccccu}, uint64_t{0xbbbbaaaa99998888u});
+ b = uint128(uint64_t{0x7777666655554444u}, uint64_t{0x3333222211110000u});
c = a * b;
- EXPECT_EQ(uint128(PROTOBUF_ULONGLONG(0x530EDA741C71D4C3),
- PROTOBUF_ULONGLONG(0xBF25975319080000)),
- c);
+ EXPECT_EQ(
+ uint128(uint64_t{0x530EDA741C71D4C3u}, uint64_t{0xBF25975319080000u}), c);
EXPECT_EQ(0, c - b * a);
EXPECT_EQ(a * a - b * b, (a + b) * (a - b));
// Verified with dc.
- a = uint128(PROTOBUF_ULONGLONG(0x0123456789abcdef),
- PROTOBUF_ULONGLONG(0xfedcba9876543210));
- b = uint128(PROTOBUF_ULONGLONG(0x02468ace13579bdf),
- PROTOBUF_ULONGLONG(0xfdb97531eca86420));
+ a = uint128(uint64_t{0x0123456789abcdefu}, uint64_t{0xfedcba9876543210u});
+ b = uint128(uint64_t{0x02468ace13579bdfu}, uint64_t{0xfdb97531eca86420u});
c = a * b;
- EXPECT_EQ(uint128(PROTOBUF_ULONGLONG(0x97a87f4f261ba3f2),
- PROTOBUF_ULONGLONG(0x342d0bbf48948200)),
- c);
+ EXPECT_EQ(
+ uint128(uint64_t{0x97a87f4f261ba3f2u}, uint64_t{0x342d0bbf48948200u}), c);
EXPECT_EQ(0, c - b * a);
EXPECT_EQ(a*a - b*b, (a+b) * (a-b));
}
@@ -359,10 +353,8 @@
EXPECT_EQ(0, q);
EXPECT_EQ(0, r);
- a = uint128(PROTOBUF_ULONGLONG(0x530eda741c71d4c3),
- PROTOBUF_ULONGLONG(0xbf25975319080000));
- q = uint128(PROTOBUF_ULONGLONG(0x4de2cab081),
- PROTOBUF_ULONGLONG(0x14c34ab4676e4bab));
+ a = uint128(uint64_t{0x530eda741c71d4c3u}, uint64_t{0xbf25975319080000u});
+ q = uint128(uint64_t{0x4de2cab081u}, uint64_t{0x14c34ab4676e4babu});
b = uint128(0x1110001);
r = uint128(0x3eb455);
ASSERT_EQ(a, q * b + r); // Sanity-check.
@@ -400,8 +392,8 @@
// Try a large remainder.
b = a / 2 + 1;
- uint128 expected_r(PROTOBUF_ULONGLONG(0x29876d3a0e38ea61),
- PROTOBUF_ULONGLONG(0xdf92cba98c83ffff));
+ uint128 expected_r(uint64_t{0x29876d3a0e38ea61u},
+ uint64_t{0xdf92cba98c83ffffu});
// Sanity checks.
ASSERT_EQ(a / 2 - 1, expected_r);
ASSERT_EQ(a, b + expected_r);
@@ -471,12 +463,12 @@
{uint128(1, 0), std::ios::oct, 0, '_', "2000000000000000000000"},
{uint128(1, 0), std::ios::hex, 0, '_', "10000000000000000"},
// just the top bit
- {uint128(PROTOBUF_ULONGLONG(0x8000000000000000), 0), std::ios::dec, 0,
- '_', "170141183460469231731687303715884105728"},
- {uint128(PROTOBUF_ULONGLONG(0x8000000000000000), 0), std::ios::oct, 0,
- '_', "2000000000000000000000000000000000000000000"},
- {uint128(PROTOBUF_ULONGLONG(0x8000000000000000), 0), std::ios::hex, 0,
- '_', "80000000000000000000000000000000"},
+ {uint128(uint64_t{0x8000000000000000u}, 0), std::ios::dec, 0, '_',
+ "170141183460469231731687303715884105728"},
+ {uint128(uint64_t{0x8000000000000000u}, 0), std::ios::oct, 0, '_',
+ "2000000000000000000000000000000000000000000"},
+ {uint128(uint64_t{0x8000000000000000u}, 0), std::ios::hex, 0, '_',
+ "80000000000000000000000000000000"},
// maximum uint128 value
{uint128(-1, -1), std::ios::dec, 0, '_',
"340282366920938463463374607431768211455"},
diff --git a/src/google/protobuf/stubs/macros.h b/src/google/protobuf/stubs/macros.h
index fcb0687..ae9a8b9 100644
--- a/src/google/protobuf/stubs/macros.h
+++ b/src/google/protobuf/stubs/macros.h
@@ -35,8 +35,8 @@
namespace protobuf {
#undef GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
-#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
- TypeName(const TypeName&) = delete; \
+#define GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
+ TypeName(const TypeName&) = delete; \
void operator=(const TypeName&) = delete
#undef GOOGLE_DISALLOW_IMPLICIT_CONSTRUCTORS
diff --git a/src/google/protobuf/stubs/mutex.h b/src/google/protobuf/stubs/mutex.h
index 82b62a6..bff9681 100644
--- a/src/google/protobuf/stubs/mutex.h
+++ b/src/google/protobuf/stubs/mutex.h
@@ -116,7 +116,7 @@
// mutexes.
class GOOGLE_PROTOBUF_CAPABILITY("mutex") PROTOBUF_EXPORT WrappedMutex {
public:
- constexpr WrappedMutex() = default;
+ constexpr WrappedMutex() {}
void Lock() GOOGLE_PROTOBUF_ACQUIRE() { mu_.lock(); }
void Unlock() GOOGLE_PROTOBUF_RELEASE() { mu_.unlock(); }
// Crash if this Mutex is not held exclusively by this thread.
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h
index 0f3b5aa..eec96fa 100644
--- a/src/google/protobuf/stubs/port.h
+++ b/src/google/protobuf/stubs/port.h
@@ -78,7 +78,7 @@
#include <intrin.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
-#elif defined(__GLIBC__) || defined(__BIONIC__) || defined(__CYGWIN__)
+#elif defined(__linux__) || defined(__ANDROID__) || defined(__CYGWIN__)
#include <byteswap.h> // IWYU pragma: export
#endif
@@ -136,10 +136,10 @@
static const int32 kint32max = 0x7FFFFFFF;
static const int32 kint32min = -kint32max - 1;
-static const int64 kint64max = PROTOBUF_LONGLONG(0x7FFFFFFFFFFFFFFF);
+static const int64 kint64max = int64_t{0x7FFFFFFFFFFFFFFF};
static const int64 kint64min = -kint64max - 1;
static const uint32 kuint32max = 0xFFFFFFFFu;
-static const uint64 kuint64max = PROTOBUF_ULONGLONG(0xFFFFFFFFFFFFFFFF);
+static const uint64 kuint64max = uint64_t{0xFFFFFFFFFFFFFFFFu};
#if defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) ||\
defined(MEMORY_SANITIZER)
@@ -242,7 +242,7 @@
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)
-#elif !defined(__GLIBC__) && !defined(__BIONIC__) && !defined(__CYGWIN__)
+#elif !defined(__linux__) && !defined(__ANDROID__) && !defined(__CYGWIN__)
#ifndef bswap_16
static inline uint16 bswap_16(uint16 x) {
@@ -263,14 +263,14 @@
#ifndef bswap_64
static inline uint64 bswap_64(uint64 x) {
- return (((x & PROTOBUF_ULONGLONG(0xFF)) << 56) |
- ((x & PROTOBUF_ULONGLONG(0xFF00)) << 40) |
- ((x & PROTOBUF_ULONGLONG(0xFF0000)) << 24) |
- ((x & PROTOBUF_ULONGLONG(0xFF000000)) << 8) |
- ((x & PROTOBUF_ULONGLONG(0xFF00000000)) >> 8) |
- ((x & PROTOBUF_ULONGLONG(0xFF0000000000)) >> 24) |
- ((x & PROTOBUF_ULONGLONG(0xFF000000000000)) >> 40) |
- ((x & PROTOBUF_ULONGLONG(0xFF00000000000000)) >> 56));
+ return (((x & uint64_t{0xFFu)) << 56) |
+ ((x & uint64_t{0xFF00u)) << 40) |
+ ((x & uint64_t{0xFF0000u)) << 24) |
+ ((x & uint64_t{0xFF000000u)) << 8) |
+ ((x & uint64_t{0xFF00000000u)) >> 8) |
+ ((x & uint64_t{0xFF0000000000u)) >> 24) |
+ ((x & uint64_t{0xFF000000000000u)) >> 40) |
+ ((x & uint64_t{0xFF00000000000000u)) >> 56));
}
#define bswap_64(x) bswap_64(x)
#endif
diff --git a/src/google/protobuf/stubs/stringpiece.cc b/src/google/protobuf/stubs/stringpiece.cc
index a014d1f..7188046 100644
--- a/src/google/protobuf/stubs/stringpiece.cc
+++ b/src/google/protobuf/stubs/stringpiece.cc
@@ -46,6 +46,10 @@
return o;
}
+void StringPiece::LogFatalSizeTooBig(size_t size, const char* details) {
+ GOOGLE_LOG(FATAL) << "size too big: " << size << " details: " << details;
+}
+
void StringPiece::CopyToString(std::string* target) const {
target->assign(ptr_, length_);
}
@@ -71,8 +75,8 @@
return false;
}
-StringPiece::size_type StringPiece::copy(
- char* buf, size_type n, size_type pos) const {
+StringPiece::size_type StringPiece::copy(char* buf, size_type n,
+ size_type pos) const {
size_type ret = std::min(length_ - pos, n);
memcpy(buf, ptr_ + pos, ret);
return ret;
@@ -82,8 +86,7 @@
return find(s, 0) != npos;
}
-StringPiece::size_type StringPiece::find(
- StringPiece s, size_type pos) const {
+StringPiece::size_type StringPiece::find(StringPiece s, size_type pos) const {
if (length_ <= 0 || pos > static_cast<size_type>(length_)) {
if (length_ == 0 && pos == 0 && s.length_ == 0) return 0;
return npos;
@@ -116,12 +119,11 @@
StringPiece::size_type StringPiece::rfind(char c, size_type pos) const {
// Note: memrchr() is not available on Windows.
if (empty()) return npos;
- for (difference_type i =
- std::min(pos, static_cast<size_type>(length_ - 1));
- i >= 0; --i) {
+ for (size_type i = std::min(pos, length_ - 1);; --i) {
if (ptr_[i] == c) {
return i;
}
+ if (i == 0) break;
}
return npos;
}
@@ -143,8 +145,8 @@
}
}
-StringPiece::size_type StringPiece::find_first_of(
- StringPiece s, size_type pos) const {
+StringPiece::size_type StringPiece::find_first_of(StringPiece s,
+ size_type pos) const {
if (empty() || s.empty()) {
return npos;
}
@@ -161,8 +163,8 @@
return npos;
}
-StringPiece::size_type StringPiece::find_first_not_of(
- StringPiece s, size_type pos) const {
+StringPiece::size_type StringPiece::find_first_not_of(StringPiece s,
+ size_type pos) const {
if (empty()) return npos;
if (s.empty()) return 0;
// Avoid the cost of BuildLookupTable() for a single-character search.
@@ -178,8 +180,8 @@
return npos;
}
-StringPiece::size_type StringPiece::find_first_not_of(
- char c, size_type pos) const {
+StringPiece::size_type StringPiece::find_first_not_of(char c,
+ size_type pos) const {
if (empty()) return npos;
for (; pos < static_cast<size_type>(length_); ++pos) {
@@ -190,28 +192,28 @@
return npos;
}
-StringPiece::size_type StringPiece::find_last_of(
- StringPiece s, size_type pos) const {
+StringPiece::size_type StringPiece::find_last_of(StringPiece s,
+ size_type pos) const {
if (empty() || s.empty()) return npos;
// Avoid the cost of BuildLookupTable() for a single-character search.
if (s.length_ == 1) return find_last_of(s.ptr_[0], pos);
bool lookup[UCHAR_MAX + 1] = { false };
BuildLookupTable(s, lookup);
- for (difference_type i =
- std::min(pos, static_cast<size_type>(length_ - 1)); i >= 0; --i) {
+ for (size_type i = std::min(pos, length_ - 1);; --i) {
if (lookup[static_cast<unsigned char>(ptr_[i])]) {
return i;
}
+ if (i == 0) break;
}
return npos;
}
-StringPiece::size_type StringPiece::find_last_not_of(
- StringPiece s, size_type pos) const {
+StringPiece::size_type StringPiece::find_last_not_of(StringPiece s,
+ size_type pos) const {
if (empty()) return npos;
- size_type i = std::min(pos, length()-1);
+ size_type i = std::min(pos, length() - 1);
if (s.empty()) return i;
// Avoid the cost of BuildLookupTable() for a single-character search.
@@ -219,23 +221,24 @@
bool lookup[UCHAR_MAX + 1] = { false };
BuildLookupTable(s, lookup);
- for (; i >= 0; --i) {
+ for (;; --i) {
if (!lookup[static_cast<unsigned char>(ptr_[i])]) {
return i;
}
+ if (i == 0) break;
}
return npos;
}
-StringPiece::size_type StringPiece::find_last_not_of(
- char c, size_type pos) const {
+StringPiece::size_type StringPiece::find_last_not_of(char c,
+ size_type pos) const {
if (empty()) return npos;
-
- for (difference_type i =
- std::min(pos, static_cast<size_type>(length_ - 1)); i >= 0; --i) {
+ size_type i = std::min(pos, length_ - 1);
+ for (;; --i) {
if (ptr_[i] != c) {
return i;
}
+ if (i == 0) break;
}
return npos;
}
diff --git a/src/google/protobuf/stubs/stringpiece.h b/src/google/protobuf/stubs/stringpiece.h
index 1e896e0..e6f5c71 100644
--- a/src/google/protobuf/stubs/stringpiece.h
+++ b/src/google/protobuf/stubs/stringpiece.h
@@ -175,6 +175,23 @@
const char* ptr_;
size_type length_;
+ static constexpr size_type kMaxSize =
+ (std::numeric_limits<difference_type>::max)();
+
+ static size_type CheckSize(size_type size) {
+#if !defined(NDEBUG) || defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
+ if (PROTOBUF_PREDICT_FALSE(size > kMaxSize)) {
+ // Some people grep for this message in logs
+ // so take care if you ever change it.
+ LogFatalSizeTooBig(size, "string length exceeds max size");
+ }
+#endif
+ return size;
+ }
+
+ // Out-of-line error path.
+ static void LogFatalSizeTooBig(size_type size, const char* details);
+
public:
// We provide non-explicit singleton constructors so users can pass
// in a "const char*" or a "string" wherever a "StringPiece" is
@@ -187,7 +204,7 @@
StringPiece(const char* str) // NOLINT(runtime/explicit)
: ptr_(str), length_(0) {
if (str != nullptr) {
- length_ = strlen(str);
+ length_ = CheckSize(strlen(str));
}
}
@@ -195,11 +212,11 @@
StringPiece( // NOLINT(runtime/explicit)
const std::basic_string<char, std::char_traits<char>, Allocator>& str)
: ptr_(str.data()), length_(0) {
- length_ = str.size();
+ length_ = CheckSize(str.size());
}
StringPiece(const char* offset, size_type len)
- : ptr_(offset), length_(len) {}
+ : ptr_(offset), length_(CheckSize(len)) {}
// data() may return a pointer to a buffer with embedded NULs, and the
// returned buffer may or may not be null terminated. Therefore it is
@@ -304,8 +321,7 @@
size_type find_last_of(char c, size_type pos = npos) const {
return rfind(c, pos);
}
- size_type find_last_not_of(StringPiece s,
- size_type pos = npos) const;
+ size_type find_last_not_of(StringPiece s, size_type pos = npos) const;
size_type find_last_not_of(char c, size_type pos = npos) const;
StringPiece substr(size_type pos, size_type n = npos) const;
diff --git a/src/google/protobuf/stubs/stringpiece_unittest.cc b/src/google/protobuf/stubs/stringpiece_unittest.cc
index e85a2e5..ba904cb 100644
--- a/src/google/protobuf/stubs/stringpiece_unittest.cc
+++ b/src/google/protobuf/stubs/stringpiece_unittest.cc
@@ -590,13 +590,13 @@
}
{
- StringPiece str("foobar");
- EXPECT_TRUE(str.ConsumeFromEnd("bar"));
- EXPECT_EQ(str, "foo");
- EXPECT_FALSE(str.ConsumeFromEnd("bar"));
- EXPECT_FALSE(str.ConsumeFromEnd("foofoo"));
- EXPECT_FALSE(str.ConsumeFromEnd("fo"));
- EXPECT_EQ(str, "foo");
+ StringPiece str("foobar");
+ EXPECT_TRUE(str.ConsumeFromEnd("bar"));
+ EXPECT_EQ(str, "foo");
+ EXPECT_FALSE(str.ConsumeFromEnd("bar"));
+ EXPECT_FALSE(str.ConsumeFromEnd("foofoo"));
+ EXPECT_FALSE(str.ConsumeFromEnd("fo"));
+ EXPECT_EQ(str, "foo");
}
}
@@ -685,7 +685,7 @@
#ifdef PROTOBUF_HAS_DEATH_TEST
#ifndef NDEBUG
TEST(NonNegativeLenTest, NonNegativeLen) {
- EXPECT_DEATH(StringPiece("xyz", -1), "len >= 0");
+ EXPECT_DEATH(StringPiece("xyz", -1), "string length exceeds max size");
}
#endif // ndef DEBUG
#endif // PROTOBUF_HAS_DEATH_TEST
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 84ea62e..bbc581e 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -1622,7 +1622,8 @@
for (StringPiece::size_type match_pos =
s->find(substring.data(), pos, substring.length());
match_pos != std::string::npos; pos = match_pos + substring.length(),
- match_pos = s->find(substring.data(), pos, substring.length())) {
+ match_pos = s->find(substring.data(), pos,
+ substring.length())) {
++num_replacements;
// Append the original content before the match.
tmp.append(*s, pos, match_pos - pos);
diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index 2abd927..449a5a6 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -65,6 +65,7 @@
// Must be included last.
#include <google/protobuf/port_def.inc>
+#define DEBUG_STRING_SILENT_MARKER "\t "
namespace google {
namespace protobuf {
@@ -1247,6 +1248,18 @@
buffer_size_(0),
at_start_of_line_(true),
failed_(false),
+ insert_silent_marker_(false),
+ indent_level_(initial_indent_level),
+ initial_indent_level_(initial_indent_level) {}
+
+ explicit TextGenerator(io::ZeroCopyOutputStream* output,
+ bool insert_silent_marker, int initial_indent_level)
+ : output_(output),
+ buffer_(nullptr),
+ buffer_size_(0),
+ at_start_of_line_(true),
+ failed_(false),
+ insert_silent_marker_(insert_silent_marker),
indent_level_(initial_indent_level),
initial_indent_level_(initial_indent_level) {}
@@ -1309,6 +1322,22 @@
// error.)
bool failed() const { return failed_; }
+ void PrintMaybeWithMarker(StringPiece text) {
+ Print(text.data(), text.size());
+ if (ConsumeInsertSilentMarker()) {
+ PrintLiteral(DEBUG_STRING_SILENT_MARKER);
+ }
+ }
+
+ void PrintMaybeWithMarker(StringPiece text_head,
+ StringPiece text_tail) {
+ Print(text_head.data(), text_head.size());
+ if (ConsumeInsertSilentMarker()) {
+ PrintLiteral(DEBUG_STRING_SILENT_MARKER);
+ }
+ Print(text_tail.data(), text_tail.size());
+ }
+
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TextGenerator);
@@ -1369,17 +1398,68 @@
buffer_size_ -= size;
}
+ // Return the current value of insert_silent_marker_. If it is true, set it
+ // to false as we assume that a silent marker is inserted after a call to this
+ // function.
+ bool ConsumeInsertSilentMarker() {
+ if (insert_silent_marker_) {
+ insert_silent_marker_ = false;
+ return true;
+ }
+ return false;
+ }
+
io::ZeroCopyOutputStream* const output_;
char* buffer_;
int buffer_size_;
bool at_start_of_line_;
bool failed_;
+ // This flag is false when inserting silent marker is disabled or a silent
+ // marker has been inserted.
+ bool insert_silent_marker_;
int indent_level_;
int initial_indent_level_;
};
// ===========================================================================
+// An internal field value printer that may insert a silent marker in
+// DebugStrings.
+class TextFormat::Printer::DebugStringFieldValuePrinter
+ : public TextFormat::FastFieldValuePrinter {
+ public:
+ void PrintMessageStart(const Message& message, int field_index,
+ int field_count, bool single_line_mode,
+ BaseTextGenerator* generator) const override {
+ // This is safe as only TextGenerator is used with
+ // DebugStringFieldValuePrinter.
+ TextGenerator* text_generator = static_cast<TextGenerator*>(generator);
+ if (single_line_mode) {
+ text_generator->PrintMaybeWithMarker(" ", "{ ");
+ } else {
+ text_generator->PrintMaybeWithMarker(" ", "{\n");
+ }
+ }
+};
+
+// ===========================================================================
+// An internal field value printer that escape UTF8 strings.
+class TextFormat::Printer::FastFieldValuePrinterUtf8Escaping
+ : public TextFormat::Printer::DebugStringFieldValuePrinter {
+ public:
+ void PrintString(const std::string& val,
+ TextFormat::BaseTextGenerator* generator) const override {
+ generator->PrintLiteral("\"");
+ generator->PrintString(strings::Utf8SafeCEscape(val));
+ generator->PrintLiteral("\"");
+ }
+ void PrintBytes(const std::string& val,
+ TextFormat::BaseTextGenerator* generator) const override {
+ return FastFieldValuePrinter::PrintString(val, generator);
+ }
+};
+
+// ===========================================================================
// Implementation of the default Finder for extensions.
TextFormat::Finder::~Finder() {}
@@ -1808,22 +1888,6 @@
std::unique_ptr<const TextFormat::FieldValuePrinter> delegate_;
};
-// Our own specialization: for UTF8 escaped strings.
-class FastFieldValuePrinterUtf8Escaping
- : public TextFormat::FastFieldValuePrinter {
- public:
- void PrintString(const std::string& val,
- TextFormat::BaseTextGenerator* generator) const override {
- generator->PrintLiteral("\"");
- generator->PrintString(strings::Utf8SafeCEscape(val));
- generator->PrintLiteral("\"");
- }
- void PrintBytes(const std::string& val,
- TextFormat::BaseTextGenerator* generator) const override {
- return FastFieldValuePrinter::PrintString(val, generator);
- }
-};
-
} // namespace
const char* const TextFormat::Printer::kDoNotParse =
@@ -1834,6 +1898,7 @@
single_line_mode_(false),
use_field_number_(false),
use_short_repeated_primitives_(false),
+ insert_silent_marker_(false),
hide_unknown_fields_(false),
print_message_fields_in_index_order_(false),
expand_any_(false),
@@ -1844,7 +1909,7 @@
void TextFormat::Printer::SetUseUtf8StringEscaping(bool as_utf8) {
SetDefaultFieldValuePrinter(as_utf8 ? new FastFieldValuePrinterUtf8Escaping()
- : new FastFieldValuePrinter());
+ : new DebugStringFieldValuePrinter());
}
void TextFormat::Printer::SetDefaultFieldValuePrinter(
@@ -1924,7 +1989,7 @@
bool TextFormat::Printer::Print(const Message& message,
io::ZeroCopyOutputStream* output) const {
- TextGenerator generator(output, initial_indent_level_);
+ TextGenerator generator(output, insert_silent_marker_, initial_indent_level_);
Print(message, &generator);
@@ -2302,7 +2367,7 @@
printer->PrintMessageEnd(sub_message, field_index, count,
single_line_mode_, generator);
} else {
- generator->PrintLiteral(": ");
+ generator->PrintMaybeWithMarker(": ");
// Write the field value.
PrintFieldValue(message, reflection, field, field_index, generator);
if (single_line_mode_) {
@@ -2327,7 +2392,7 @@
int size = reflection->FieldSize(message, field);
PrintFieldName(message, /*field_index=*/-1, /*field_count=*/size, reflection,
field, generator);
- generator->PrintLiteral(": [");
+ generator->PrintMaybeWithMarker(": ", "[");
for (int i = 0; i < size; i++) {
if (i > 0) generator->PrintLiteral(", ");
PrintFieldValue(message, reflection, field, i, generator);
@@ -2481,7 +2546,7 @@
switch (field.type()) {
case UnknownField::TYPE_VARINT:
generator->PrintString(field_number);
- generator->PrintLiteral(": ");
+ generator->PrintMaybeWithMarker(": ");
generator->PrintString(StrCat(field.varint()));
if (single_line_mode_) {
generator->PrintLiteral(" ");
@@ -2491,7 +2556,7 @@
break;
case UnknownField::TYPE_FIXED32: {
generator->PrintString(field_number);
- generator->PrintLiteral(": 0x");
+ generator->PrintMaybeWithMarker(": ", "0x");
generator->PrintString(
StrCat(strings::Hex(field.fixed32(), strings::ZERO_PAD_8)));
if (single_line_mode_) {
@@ -2503,7 +2568,7 @@
}
case UnknownField::TYPE_FIXED64: {
generator->PrintString(field_number);
- generator->PrintLiteral(": 0x");
+ generator->PrintMaybeWithMarker(": ", "0x");
generator->PrintString(
StrCat(strings::Hex(field.fixed64(), strings::ZERO_PAD_16)));
if (single_line_mode_) {
@@ -2528,9 +2593,9 @@
// This field is parseable as a Message.
// So it is probably an embedded message.
if (single_line_mode_) {
- generator->PrintLiteral(" { ");
+ generator->PrintMaybeWithMarker(" ", "{ ");
} else {
- generator->PrintLiteral(" {\n");
+ generator->PrintMaybeWithMarker(" ", "{\n");
generator->Indent();
}
PrintUnknownFields(embedded_unknown_fields, generator,
@@ -2544,7 +2609,7 @@
} else {
// This field is not parseable as a Message (or we ran out of
// recursion budget). So it is probably just a plain string.
- generator->PrintLiteral(": \"");
+ generator->PrintMaybeWithMarker(": ", "\"");
generator->PrintString(CEscape(value));
if (single_line_mode_) {
generator->PrintLiteral("\" ");
@@ -2557,9 +2622,9 @@
case UnknownField::TYPE_GROUP:
generator->PrintString(field_number);
if (single_line_mode_) {
- generator->PrintLiteral(" { ");
+ generator->PrintMaybeWithMarker(" ", "{ ");
} else {
- generator->PrintLiteral(" {\n");
+ generator->PrintMaybeWithMarker(" ", "{\n");
generator->Indent();
}
// For groups, we recurse without checking the budget. This is OK,
diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h
index 3a3ee15..ce4d1f4 100644
--- a/src/google/protobuf/text_format.h
+++ b/src/google/protobuf/text_format.h
@@ -62,9 +62,9 @@
class ErrorCollector; // tokenizer.h
}
-// This class implements protocol buffer text format. Printing and parsing
-// protocol messages in text format is useful for debugging and human editing
-// of messages.
+// This class implements protocol buffer text format, colloquially known as text
+// proto. Printing and parsing protocol messages in text format is useful for
+// debugging and human editing of messages.
//
// This class is really a namespace that contains only static methods.
class PROTOBUF_EXPORT TextFormat {
@@ -369,6 +369,14 @@
// output to the OutputStream (see text_format.cc for implementation).
class TextGenerator;
+ // Forward declaration of an internal class used to print field values for
+ // DebugString APIs (see text_format.cc for implementation).
+ class DebugStringFieldValuePrinter;
+
+ // Forward declaration of an internal class used to print UTF-8 escaped
+ // strings (see text_format.cc for implementation).
+ class FastFieldValuePrinterUtf8Escaping;
+
static const char* const kDoNotParse;
// Internal Print method, used for writing to the OutputStream via
@@ -419,6 +427,7 @@
bool single_line_mode_;
bool use_field_number_;
bool use_short_repeated_primitives_;
+ bool insert_silent_marker_;
bool hide_unknown_fields_;
bool print_message_fields_in_index_order_;
bool expand_any_;
diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc
index 449a78c..cedc928 100644
--- a/src/google/protobuf/text_format_unittest.cc
+++ b/src/google/protobuf/text_format_unittest.cc
@@ -1069,13 +1069,8 @@
TEST_F(TextFormatTest, PrintExotic) {
unittest::TestAllTypes message;
- // Note: In C, a negative integer literal is actually the unary negation
- // operator being applied to a positive integer literal, and
- // 9223372036854775808 is outside the range of int64. However, it is not
- // outside the range of uint64. Confusingly, this means that everything
- // works if we make the literal unsigned, even though we are negating it.
- message.add_repeated_int64(-PROTOBUF_ULONGLONG(9223372036854775808));
- message.add_repeated_uint64(PROTOBUF_ULONGLONG(18446744073709551615));
+ message.add_repeated_int64(int64_t{-9223372036854775807} - 1);
+ message.add_repeated_uint64(uint64_t{18446744073709551615u});
message.add_repeated_double(123.456);
message.add_repeated_double(1.23e21);
message.add_repeated_double(1.23e-18);
@@ -1240,32 +1235,19 @@
ASSERT_EQ(2, message.repeated_int32_size());
EXPECT_EQ(-1, message.repeated_int32(0));
- // Note: In C, a negative integer literal is actually the unary negation
- // operator being applied to a positive integer literal, and 2147483648 is
- // outside the range of int32. However, it is not outside the range of
- // uint32. Confusingly, this means that everything works if we make the
- // literal unsigned, even though we are negating it.
- EXPECT_EQ(-2147483648u, message.repeated_int32(1));
+ EXPECT_EQ(-2147483648, message.repeated_int32(1));
ASSERT_EQ(2, message.repeated_int64_size());
EXPECT_EQ(-1, message.repeated_int64(0));
- // Note: In C, a negative integer literal is actually the unary negation
- // operator being applied to a positive integer literal, and
- // 9223372036854775808 is outside the range of int64. However, it is not
- // outside the range of uint64. Confusingly, this means that everything
- // works if we make the literal unsigned, even though we are negating it.
- EXPECT_EQ(-PROTOBUF_ULONGLONG(9223372036854775808),
- message.repeated_int64(1));
+ EXPECT_EQ(int64_t{-9223372036854775807} - 1, message.repeated_int64(1));
ASSERT_EQ(2, message.repeated_uint32_size());
EXPECT_EQ(4294967295u, message.repeated_uint32(0));
EXPECT_EQ(2147483648u, message.repeated_uint32(1));
ASSERT_EQ(2, message.repeated_uint64_size());
- EXPECT_EQ(PROTOBUF_ULONGLONG(18446744073709551615),
- message.repeated_uint64(0));
- EXPECT_EQ(PROTOBUF_ULONGLONG(9223372036854775808),
- message.repeated_uint64(1));
+ EXPECT_EQ(uint64_t{18446744073709551615u}, message.repeated_uint64(0));
+ EXPECT_EQ(uint64_t{9223372036854775808u}, message.repeated_uint64(1));
ASSERT_EQ(13, message.repeated_double_size());
EXPECT_EQ(123.0, message.repeated_double(0));
diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc
index a3040a6..d83037e 100644
--- a/src/google/protobuf/timestamp.pb.cc
+++ b/src/google/protobuf/timestamp.pb.cc
@@ -19,7 +19,7 @@
PROTOBUF_NAMESPACE_OPEN
constexpr Timestamp::Timestamp(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : seconds_(PROTOBUF_LONGLONG(0))
+ : seconds_(int64_t{0})
, nanos_(0){}
struct TimestampDefaultTypeInternal {
constexpr TimestampDefaultTypeInternal()
@@ -110,7 +110,7 @@
}
void Timestamp::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void Timestamp::ArenaDtor(void* object) {
@@ -285,7 +285,7 @@
void Timestamp::InternalSwap(Timestamp* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Timestamp, nanos_)
+ sizeof(Timestamp::nanos_)
diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h
index cc5efca..0f4fd72 100644
--- a/src/google/protobuf/timestamp.pb.h
+++ b/src/google/protobuf/timestamp.pb.h
@@ -65,7 +65,7 @@
// ===================================================================
-class PROTOBUF_EXPORT Timestamp PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Timestamp final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Timestamp) */ {
public:
inline Timestamp() : Timestamp(nullptr) {}
@@ -83,8 +83,9 @@
return *this;
}
inline Timestamp& operator=(Timestamp&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -115,7 +116,7 @@
}
inline void Swap(Timestamp* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -123,14 +124,14 @@
}
void UnsafeArenaSwap(Timestamp* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Timestamp* New() const final {
- return CreateMaybeMessage<Timestamp>(nullptr);
+ return new Timestamp();
}
Timestamp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -150,8 +151,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Timestamp* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -218,7 +219,7 @@
// int64 seconds = 1;
inline void Timestamp::clear_seconds() {
- seconds_ = PROTOBUF_LONGLONG(0);
+ seconds_ = int64_t{0};
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::_internal_seconds() const {
return seconds_;
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 024b277..8120721 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -343,7 +343,7 @@
return *msg->source_context_;
}
void Type::clear_source_context() {
- if (GetArena() == nullptr && source_context_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
}
source_context_ = nullptr;
@@ -366,7 +366,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_);
@@ -392,7 +392,7 @@
}
void Type::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete source_context_;
}
@@ -417,7 +417,7 @@
oneofs_.Clear();
options_.Clear();
name_.ClearToEmpty();
- if (GetArena() == nullptr && source_context_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
}
source_context_ = nullptr;
@@ -523,7 +523,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -612,7 +612,7 @@
}
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
@@ -665,7 +665,7 @@
fields_.MergeFrom(from.fields_);
oneofs_.MergeFrom(from.oneofs_);
options_.MergeFrom(from.options_);
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
if (from.has_source_context()) {
@@ -696,11 +696,15 @@
void Type::InternalSwap(Type* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
fields_.InternalSwap(&other->fields_);
oneofs_.InternalSwap(&other->oneofs_);
options_.InternalSwap(&other->options_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Type, syntax_)
+ sizeof(Type::syntax_)
@@ -735,22 +739,22 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_type_url().empty()) {
type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(),
- GetArena());
+ GetArenaForAllocation());
}
json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_json_name().empty()) {
json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(),
- GetArena());
+ GetArenaForAllocation());
}
default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_default_value().empty()) {
default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(),
- GetArena());
+ GetArenaForAllocation());
}
::memcpy(&kind_, &from.kind_,
static_cast<size_t>(reinterpret_cast<char*>(&packed_) -
@@ -776,7 +780,7 @@
}
void Field::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
type_url_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
json_name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
@@ -951,7 +955,7 @@
}
// string name = 4;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -961,7 +965,7 @@
}
// string type_url = 6;
- if (this->type_url().size() > 0) {
+ if (!this->type_url().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_type_url().data(), static_cast<int>(this->_internal_type_url().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -991,7 +995,7 @@
}
// string json_name = 10;
- if (this->json_name().size() > 0) {
+ if (!this->json_name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_json_name().data(), static_cast<int>(this->_internal_json_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1001,7 +1005,7 @@
}
// string default_value = 11;
- if (this->default_value().size() > 0) {
+ if (!this->default_value().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_default_value().data(), static_cast<int>(this->_internal_default_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1034,28 +1038,28 @@
}
// string name = 4;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
}
// string type_url = 6;
- if (this->type_url().size() > 0) {
+ if (!this->type_url().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_type_url());
}
// string json_name = 10;
- if (this->json_name().size() > 0) {
+ if (!this->json_name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_json_name());
}
// string default_value = 11;
- if (this->default_value().size() > 0) {
+ if (!this->default_value().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_default_value());
@@ -1124,16 +1128,16 @@
(void) cached_has_bits;
options_.MergeFrom(from.options_);
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
- if (from.type_url().size() > 0) {
+ if (!from.type_url().empty()) {
_internal_set_type_url(from._internal_type_url());
}
- if (from.json_name().size() > 0) {
+ if (!from.json_name().empty()) {
_internal_set_json_name(from._internal_json_name());
}
- if (from.default_value().size() > 0) {
+ if (!from.default_value().empty()) {
_internal_set_default_value(from._internal_default_value());
}
if (from.kind() != 0) {
@@ -1173,12 +1177,28 @@
void Field::InternalSwap(Field* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- type_url_.Swap(&other->type_url_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- json_name_.Swap(&other->json_name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
- default_value_.Swap(&other->default_value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &type_url_, GetArenaForAllocation(),
+ &other->type_url_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &json_name_, GetArenaForAllocation(),
+ &other->json_name_, other->GetArenaForAllocation()
+ );
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &default_value_, GetArenaForAllocation(),
+ &other->default_value_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Field, packed_)
+ sizeof(Field::packed_)
@@ -1205,7 +1225,7 @@
return *msg->source_context_;
}
void Enum::clear_source_context() {
- if (GetArena() == nullptr && source_context_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
}
source_context_ = nullptr;
@@ -1226,7 +1246,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_source_context()) {
source_context_ = new PROTOBUF_NAMESPACE_ID::SourceContext(*from.source_context_);
@@ -1252,7 +1272,7 @@
}
void Enum::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete source_context_;
}
@@ -1276,7 +1296,7 @@
enumvalue_.Clear();
options_.Clear();
name_.ClearToEmpty();
- if (GetArena() == nullptr && source_context_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && source_context_ != nullptr) {
delete source_context_;
}
source_context_ = nullptr;
@@ -1368,7 +1388,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1439,7 +1459,7 @@
}
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
@@ -1491,7 +1511,7 @@
enumvalue_.MergeFrom(from.enumvalue_);
options_.MergeFrom(from.options_);
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
if (from.has_source_context()) {
@@ -1522,10 +1542,14 @@
void Enum::InternalSwap(Enum* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
enumvalue_.InternalSwap(&other->enumvalue_);
options_.InternalSwap(&other->options_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
::PROTOBUF_NAMESPACE_ID::internal::memswap<
PROTOBUF_FIELD_OFFSET(Enum, syntax_)
+ sizeof(Enum::syntax_)
@@ -1560,7 +1584,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
number_ = from.number_;
// @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue)
@@ -1578,7 +1602,7 @@
}
void EnumValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -1668,7 +1692,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1715,7 +1739,7 @@
}
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
@@ -1760,7 +1784,7 @@
(void) cached_has_bits;
options_.MergeFrom(from.options_);
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
if (from.number() != 0) {
@@ -1788,9 +1812,13 @@
void EnumValue::InternalSwap(EnumValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
options_.InternalSwap(&other->options_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
swap(number_, other->number_);
}
@@ -1812,7 +1840,7 @@
return *msg->value_;
}
void Option::clear_value() {
- if (GetArena() == nullptr && value_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && value_ != nullptr) {
delete value_;
}
value_ = nullptr;
@@ -1829,7 +1857,7 @@
name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_name().empty()) {
name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(),
- GetArena());
+ GetArenaForAllocation());
}
if (from._internal_has_value()) {
value_ = new PROTOBUF_NAMESPACE_ID::Any(*from.value_);
@@ -1851,7 +1879,7 @@
}
void Option::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
name_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (this != internal_default_instance()) delete value_;
}
@@ -1873,7 +1901,7 @@
(void) cached_has_bits;
name_.ClearToEmpty();
- if (GetArena() == nullptr && value_ != nullptr) {
+ if (GetArenaForAllocation() == nullptr && value_ != nullptr) {
delete value_;
}
value_ = nullptr;
@@ -1932,7 +1960,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1966,7 +1994,7 @@
(void) cached_has_bits;
// string name = 1;
- if (this->name().size() > 0) {
+ if (!this->name().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_name());
@@ -2010,7 +2038,7 @@
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
- if (from.name().size() > 0) {
+ if (!from.name().empty()) {
_internal_set_name(from._internal_name());
}
if (from.has_value()) {
@@ -2038,8 +2066,12 @@
void Option::InternalSwap(Option* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- name_.Swap(&other->name_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &name_, GetArenaForAllocation(),
+ &other->name_, other->GetArenaForAllocation()
+ );
swap(value_, other->value_);
}
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index a34fd60..45414e7 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -178,7 +178,7 @@
}
// ===================================================================
-class PROTOBUF_EXPORT Type PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Type final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Type) */ {
public:
inline Type() : Type(nullptr) {}
@@ -196,8 +196,9 @@
return *this;
}
inline Type& operator=(Type&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -228,7 +229,7 @@
}
inline void Swap(Type* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -236,14 +237,14 @@
}
void UnsafeArenaSwap(Type* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Type* New() const final {
- return CreateMaybeMessage<Type>(nullptr);
+ return new Type();
}
Type* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -263,8 +264,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Type* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -358,11 +359,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -373,7 +374,7 @@
public:
void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
- PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
private:
@@ -411,7 +412,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Field PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Field final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Field) */ {
public:
inline Field() : Field(nullptr) {}
@@ -429,8 +430,9 @@
return *this;
}
inline Field& operator=(Field&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -461,7 +463,7 @@
}
inline void Swap(Field* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -469,14 +471,14 @@
}
void UnsafeArenaSwap(Field* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Field* New() const final {
- return CreateMaybeMessage<Field>(nullptr);
+ return new Field();
}
Field* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -496,8 +498,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Field* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -651,11 +653,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -665,11 +667,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_type_url(ArgT0&& arg0, ArgT... args);
std::string* mutable_type_url();
- std::string* release_type_url();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_type_url();
void set_allocated_type_url(std::string* type_url);
private:
const std::string& _internal_type_url() const;
- void _internal_set_type_url(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_type_url(const std::string& value);
std::string* _internal_mutable_type_url();
public:
@@ -679,11 +681,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_json_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_json_name();
- std::string* release_json_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_json_name();
void set_allocated_json_name(std::string* json_name);
private:
const std::string& _internal_json_name() const;
- void _internal_set_json_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_json_name(const std::string& value);
std::string* _internal_mutable_json_name();
public:
@@ -693,11 +695,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_default_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_default_value();
- std::string* release_default_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_default_value();
void set_allocated_default_value(std::string* default_value);
private:
const std::string& _internal_default_value() const;
- void _internal_set_default_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_default_value(const std::string& value);
std::string* _internal_mutable_default_value();
public:
@@ -768,7 +770,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Enum PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Enum final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Enum) */ {
public:
inline Enum() : Enum(nullptr) {}
@@ -786,8 +788,9 @@
return *this;
}
inline Enum& operator=(Enum&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -818,7 +821,7 @@
}
inline void Swap(Enum* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -826,14 +829,14 @@
}
void UnsafeArenaSwap(Enum* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Enum* New() const final {
- return CreateMaybeMessage<Enum>(nullptr);
+ return new Enum();
}
Enum* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -853,8 +856,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Enum* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -923,11 +926,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -938,7 +941,7 @@
public:
void clear_source_context();
const PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
- PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
void set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
private:
@@ -975,7 +978,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT EnumValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT EnumValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.EnumValue) */ {
public:
inline EnumValue() : EnumValue(nullptr) {}
@@ -993,8 +996,9 @@
return *this;
}
inline EnumValue& operator=(EnumValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1025,7 +1029,7 @@
}
inline void Swap(EnumValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1033,14 +1037,14 @@
}
void UnsafeArenaSwap(EnumValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline EnumValue* New() const final {
- return CreateMaybeMessage<EnumValue>(nullptr);
+ return new EnumValue();
}
EnumValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1060,8 +1064,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(EnumValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1110,11 +1114,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -1142,7 +1146,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Option PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Option final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Option) */ {
public:
inline Option() : Option(nullptr) {}
@@ -1160,8 +1164,9 @@
return *this;
}
inline Option& operator=(Option&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1192,7 +1197,7 @@
}
inline void Swap(Option* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1200,14 +1205,14 @@
}
void UnsafeArenaSwap(Option* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Option* New() const final {
- return CreateMaybeMessage<Option>(nullptr);
+ return new Option();
}
Option* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1227,8 +1232,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Option* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1258,11 +1263,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_name(ArgT0&& arg0, ArgT... args);
std::string* mutable_name();
- std::string* release_name();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_name();
void set_allocated_name(std::string* name);
private:
const std::string& _internal_name() const;
- void _internal_set_name(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value);
std::string* _internal_mutable_name();
public:
@@ -1273,7 +1278,7 @@
public:
void clear_value();
const PROTOBUF_NAMESPACE_ID::Any& value() const;
- PROTOBUF_NAMESPACE_ID::Any* release_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT PROTOBUF_NAMESPACE_ID::Any* release_value();
PROTOBUF_NAMESPACE_ID::Any* mutable_value();
void set_allocated_value(PROTOBUF_NAMESPACE_ID::Any* value);
private:
@@ -1316,10 +1321,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Type::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Type::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Type.name)
}
inline std::string* Type::mutable_name() {
@@ -1331,15 +1336,15 @@
}
inline void Type::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Type::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Type::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Type.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Type::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1348,7 +1353,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
}
@@ -1522,7 +1527,7 @@
}
inline void Type::unsafe_arena_set_allocated_source_context(
PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
}
source_context_ = source_context;
@@ -1537,7 +1542,7 @@
PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -1552,7 +1557,7 @@
inline PROTOBUF_NAMESPACE_ID::SourceContext* Type::_internal_mutable_source_context() {
if (source_context_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation());
source_context_ = p;
}
return source_context_;
@@ -1562,13 +1567,15 @@
return _internal_mutable_source_context();
}
inline void Type::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context)->GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
+ ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context));
if (message_arena != submessage_arena) {
source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, source_context, submessage_arena);
@@ -1674,10 +1681,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Field::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Field::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.name)
}
inline std::string* Field::mutable_name() {
@@ -1689,15 +1696,15 @@
}
inline void Field::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Field::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Field::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1706,7 +1713,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
}
@@ -1719,10 +1726,10 @@
return _internal_type_url();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Field::set_type_url(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Field::set_type_url(ArgT0&& arg0, ArgT... args) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.type_url)
}
inline std::string* Field::mutable_type_url() {
@@ -1734,15 +1741,15 @@
}
inline void Field::_internal_set_type_url(const std::string& value) {
- type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_type_url() {
- return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return type_url_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Field::release_type_url() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.type_url)
- return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return type_url_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Field::set_allocated_type_url(std::string* type_url) {
if (type_url != nullptr) {
@@ -1751,7 +1758,7 @@
}
type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
}
@@ -1843,10 +1850,10 @@
return _internal_json_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Field::set_json_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Field::set_json_name(ArgT0&& arg0, ArgT... args) {
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.json_name)
}
inline std::string* Field::mutable_json_name() {
@@ -1858,15 +1865,15 @@
}
inline void Field::_internal_set_json_name(const std::string& value) {
- json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_json_name() {
- return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return json_name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Field::release_json_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.json_name)
- return json_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return json_name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Field::set_allocated_json_name(std::string* json_name) {
if (json_name != nullptr) {
@@ -1875,7 +1882,7 @@
}
json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
}
@@ -1888,10 +1895,10 @@
return _internal_default_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Field::set_default_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Field::set_default_value(ArgT0&& arg0, ArgT... args) {
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Field.default_value)
}
inline std::string* Field::mutable_default_value() {
@@ -1903,15 +1910,15 @@
}
inline void Field::_internal_set_default_value(const std::string& value) {
- default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Field::_internal_mutable_default_value() {
- return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return default_value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Field::release_default_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Field.default_value)
- return default_value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return default_value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Field::set_allocated_default_value(std::string* default_value) {
if (default_value != nullptr) {
@@ -1920,7 +1927,7 @@
}
default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
}
@@ -1937,10 +1944,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Enum::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Enum::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Enum.name)
}
inline std::string* Enum::mutable_name() {
@@ -1952,15 +1959,15 @@
}
inline void Enum::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Enum::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Enum::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Enum.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Enum::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -1969,7 +1976,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
}
@@ -2069,7 +2076,7 @@
}
inline void Enum::unsafe_arena_set_allocated_source_context(
PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
}
source_context_ = source_context;
@@ -2084,7 +2091,7 @@
PROTOBUF_NAMESPACE_ID::SourceContext* temp = source_context_;
source_context_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -2099,7 +2106,7 @@
inline PROTOBUF_NAMESPACE_ID::SourceContext* Enum::_internal_mutable_source_context() {
if (source_context_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::SourceContext>(GetArenaForAllocation());
source_context_ = p;
}
return source_context_;
@@ -2109,13 +2116,15 @@
return _internal_mutable_source_context();
}
inline void Enum::set_allocated_source_context(PROTOBUF_NAMESPACE_ID::SourceContext* source_context) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context_);
}
if (source_context) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context)->GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
+ ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(source_context));
if (message_arena != submessage_arena) {
source_context = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, source_context, submessage_arena);
@@ -2161,10 +2170,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void EnumValue::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void EnumValue::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.EnumValue.name)
}
inline std::string* EnumValue::mutable_name() {
@@ -2176,15 +2185,15 @@
}
inline void EnumValue::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* EnumValue::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* EnumValue::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.EnumValue.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void EnumValue::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -2193,7 +2202,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
}
@@ -2269,10 +2278,10 @@
return _internal_name();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void Option::set_name(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void Option::set_name(ArgT0&& arg0, ArgT... args) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.Option.name)
}
inline std::string* Option::mutable_name() {
@@ -2284,15 +2293,15 @@
}
inline void Option::_internal_set_name(const std::string& value) {
- name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* Option::_internal_mutable_name() {
- return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return name_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* Option::release_name() {
// @@protoc_insertion_point(field_release:google.protobuf.Option.name)
- return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return name_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void Option::set_allocated_name(std::string* name) {
if (name != nullptr) {
@@ -2301,7 +2310,7 @@
}
name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
}
@@ -2323,7 +2332,7 @@
}
inline void Option::unsafe_arena_set_allocated_value(
PROTOBUF_NAMESPACE_ID::Any* value) {
- if (GetArena() == nullptr) {
+ if (GetArenaForAllocation() == nullptr) {
delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(value_);
}
value_ = value;
@@ -2338,7 +2347,7 @@
PROTOBUF_NAMESPACE_ID::Any* temp = value_;
value_ = nullptr;
- if (GetArena() != nullptr) {
+ if (GetArenaForAllocation() != nullptr) {
temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp);
}
return temp;
@@ -2353,7 +2362,7 @@
inline PROTOBUF_NAMESPACE_ID::Any* Option::_internal_mutable_value() {
if (value_ == nullptr) {
- auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Any>(GetArena());
+ auto* p = CreateMaybeMessage<PROTOBUF_NAMESPACE_ID::Any>(GetArenaForAllocation());
value_ = p;
}
return value_;
@@ -2363,13 +2372,15 @@
return _internal_mutable_value();
}
inline void Option::set_allocated_value(PROTOBUF_NAMESPACE_ID::Any* value) {
- ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
if (message_arena == nullptr) {
delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(value_);
}
if (value) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
- reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(value)->GetArena();
+ ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper<
+ ::PROTOBUF_NAMESPACE_ID::MessageLite>::GetOwningArena(
+ reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(value));
if (message_arena != submessage_arena) {
value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, value, submessage_arena);
diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto
index 75b65f0..032a880 100644
--- a/src/google/protobuf/unittest.proto
+++ b/src/google/protobuf/unittest.proto
@@ -364,6 +364,12 @@
}
}
+message TestChildExtension {
+ optional string a = 1;
+ optional string b = 2;
+ optional TestAllExtensions optional_extension = 3;
+}
+
// We have separate messages for testing required fields because it's
// annoying to have to fill in required fields in TestProto in order to
// do anything with it. Note that we don't need to test every type of
diff --git a/src/google/protobuf/unittest_proto3_arena.proto b/src/google/protobuf/unittest_proto3_arena.proto
index fa26488..1752939 100644
--- a/src/google/protobuf/unittest_proto3_arena.proto
+++ b/src/google/protobuf/unittest_proto3_arena.proto
@@ -116,6 +116,23 @@
repeated string repeated_string = 44;
repeated bytes repeated_bytes = 45;
+ // Optional
+ optional int32 proto3_optional_int32 = 116;
+ optional int64 proto3_optional_int64 = 117;
+ optional uint32 proto3_optional_uint32 = 118;
+ optional uint64 proto3_optional_uint64 = 119;
+ optional sint32 proto3_optional_sint32 = 120;
+ optional sint64 proto3_optional_sint64 = 121;
+ optional fixed32 proto3_optional_fixed32 = 122;
+ optional fixed64 proto3_optional_fixed64 = 123;
+ optional sfixed32 proto3_optional_sfixed32 = 124;
+ optional sfixed64 proto3_optional_sfixed64 = 125;
+ optional float proto3_optional_float = 126;
+ optional double proto3_optional_double = 127;
+ optional bool proto3_optional_bool = 128;
+ optional string proto3_optional_string = 129;
+ optional bytes proto3_optional_bytes = 130;
+
// Groups are not allowed in proto3.
// repeated group RepeatedGroup = 46 {
// optional int32 a = 47;
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.cc b/src/google/protobuf/util/internal/protostream_objectwriter.cc
index 9878826..ec9a2ce 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter.cc
+++ b/src/google/protobuf/util/internal/protostream_objectwriter.cc
@@ -1238,6 +1238,19 @@
return this;
}
+ if (IsRepeated(*field) && !current_->is_list()) {
+ if (options_.disable_implicit_scalar_list) {
+ if (!options_.suppress_implicit_scalar_list_error) {
+ InvalidValue(
+ field->name(),
+ "Starting an primitive in a repeated field but the parent field "
+ "is not a list");
+ }
+
+ return this;
+ }
+ }
+
ProtoWriter::RenderDataPiece(name, data);
return this;
}
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.h b/src/google/protobuf/util/internal/protostream_objectwriter.h
index be810ed..0befd1c 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter.h
+++ b/src/google/protobuf/util/internal/protostream_objectwriter.h
@@ -108,6 +108,13 @@
// is disabled.
bool suppress_implicit_message_list_error;
+ // If true, disable implicitly creating scalar list.
+ bool disable_implicit_scalar_list;
+
+ // If true, suppress the error of implicitly creating scalar list when it
+ // is disabled.
+ bool suppress_implicit_scalar_list_error;
+
// If true, suppress the error of rendering scalar field if the source is an
// object.
bool suppress_object_to_scalar_error;
@@ -125,6 +132,8 @@
use_legacy_json_map_format(false),
disable_implicit_message_list(false),
suppress_implicit_message_list_error(false),
+ disable_implicit_scalar_list(false),
+ suppress_implicit_scalar_list_error(false),
suppress_object_to_scalar_error(false),
use_json_name_in_missing_fields(false) {}
diff --git a/src/google/protobuf/util/internal/protostream_objectwriter_test.cc b/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
index 211b7bc..2232bec 100644
--- a/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
+++ b/src/google/protobuf/util/internal/protostream_objectwriter_test.cc
@@ -699,6 +699,61 @@
CheckOutput(expected);
}
+TEST_P(ProtoStreamObjectWriterTest, DisableImplicitMessageList) {
+ options_.disable_implicit_message_list = true;
+ options_.suppress_implicit_message_list_error = true;
+ ResetProtoWriter();
+
+ Book expected;
+ // The repeated friend field of the author is empty.
+ expected.mutable_author();
+
+ EXPECT_CALL(listener_, InvalidValue(_, _, _)).Times(0);
+
+ ow_->StartObject("")
+ ->StartObject("author")
+ ->StartObject("friend")
+ ->RenderString("name", "first")
+ ->EndObject()
+ ->StartObject("friend")
+ ->RenderString("name", "second")
+ ->EndObject()
+ ->EndObject()
+ ->EndObject();
+ CheckOutput(expected);
+}
+
+TEST_P(ProtoStreamObjectWriterTest,
+ DisableImplicitMessageListWithoutErrorSuppressed) {
+ options_.disable_implicit_message_list = true;
+ ResetProtoWriter();
+
+ Book expected;
+ // The repeated friend field of the author is empty.
+ expected.mutable_author();
+ EXPECT_CALL(
+ listener_,
+ InvalidValue(
+ _, StringPiece("friend"),
+ StringPiece(
+ "Starting an object in a repeated field but the parent object "
+ "is not a list")))
+ .With(Args<0>(HasObjectLocation("author")))
+ .Times(2);
+
+ ow_->StartObject("")
+ ->StartObject("author")
+ ->StartObject("friend")
+ ->RenderString("name", "first")
+ ->EndObject()
+ ->StartObject("friend")
+ ->RenderString("name", "second")
+ ->EndObject()
+ ->EndObject()
+ ->EndObject();
+ CheckOutput(expected);
+}
+
TEST_P(ProtoStreamObjectWriterTest,
LastWriteWinsOnNonRepeatedMessageFieldWithDuplicates) {
Book expected;
diff --git a/src/google/protobuf/util/message_differencer.cc b/src/google/protobuf/util/message_differencer.cc
index 4815178..88e01df 100644
--- a/src/google/protobuf/util/message_differencer.cc
+++ b/src/google/protobuf/util/message_differencer.cc
@@ -266,7 +266,6 @@
MessageDifferencer::MessageDifferencer()
: reporter_(NULL),
- field_comparator_(NULL),
message_field_comparison_(EQUAL),
scope_(FULL),
repeated_field_comparison_(AS_LIST),
@@ -289,9 +288,19 @@
void MessageDifferencer::set_field_comparator(FieldComparator* comparator) {
GOOGLE_CHECK(comparator) << "Field comparator can't be NULL.";
- field_comparator_ = comparator;
+ field_comparator_kind_ = kFCBase;
+ field_comparator_.base = comparator;
}
+#ifdef PROTOBUF_FUTURE_BREAKING_CHANGES
+void MessageDifferencer::set_field_comparator(
+ DefaultFieldComparator* comparator) {
+ GOOGLE_CHECK(comparator) << "Field comparator can't be NULL.";
+ field_comparator_kind_ = kFCDefault;
+ field_comparator_.default_impl = comparator;
+}
+#endif // PROTOBUF_FUTURE_BREAKING_CHANGES
+
void MessageDifferencer::set_message_field_comparison(
MessageFieldComparison comparison) {
message_field_comparison_ = comparison;
@@ -1008,44 +1017,29 @@
const Reflection* reflection2 = message2.GetReflection();
// When both map fields are on map, do not sync to repeated field.
- // TODO(jieluo): Add support for reporter
- if (reporter_ == nullptr &&
+ if (reflection1->GetMapData(message1, repeated_field)->IsMapValid() &&
+ reflection2->GetMapData(message2, repeated_field)->IsMapValid() &&
+ // TODO(jieluo): Add support for reporter
+ reporter_ == nullptr &&
// Users didn't set custom map field key comparator
map_field_key_comparator_.find(repeated_field) ==
map_field_key_comparator_.end() &&
// Users didn't set repeated field comparison
- repeated_field_comparison_ == AS_LIST) {
- DefaultFieldComparator* map_field_comparator =
- field_comparator_ ? nullptr : &default_field_comparator_;
-#if PROTOBUF_RTTI
- // Inherit class from DefaultFieldComparator can not get the benefit
- // because DefaultFieldComparator::Compare() method might be overwrote.
- if (field_comparator_ &&
- typeid(*field_comparator_) == typeid(default_field_comparator_)) {
- map_field_comparator =
- static_cast<DefaultFieldComparator*>(field_comparator_);
- }
-#endif
- if (map_field_comparator) {
- const FieldDescriptor* key_des =
- repeated_field->message_type()->map_key();
- const FieldDescriptor* val_des =
- repeated_field->message_type()->map_value();
- const internal::MapFieldBase* map_field1 =
- reflection1->GetMapData(message1, repeated_field);
- const internal::MapFieldBase* map_field2 =
- reflection2->GetMapData(message2, repeated_field);
- std::vector<SpecificField> current_parent_fields(*parent_fields);
- SpecificField specific_field;
- specific_field.field = repeated_field;
- current_parent_fields.push_back(specific_field);
- if (map_field1->IsMapValid() && map_field2->IsMapValid() &&
- !IsIgnored(message1, message2, key_des, current_parent_fields) &&
- !IsIgnored(message1, message2, val_des, current_parent_fields)) {
- return CompareMapFieldByMapReflection(
- message1, message2, repeated_field, ¤t_parent_fields,
- map_field_comparator);
- }
+ repeated_field_comparison_ == AS_LIST &&
+ // Users didn't set their own FieldComparator implementation
+ field_comparator_kind_ == kFCDefault) {
+ const FieldDescriptor* key_des = repeated_field->message_type()->map_key();
+ const FieldDescriptor* val_des =
+ repeated_field->message_type()->map_value();
+ std::vector<SpecificField> current_parent_fields(*parent_fields);
+ SpecificField specific_field;
+ specific_field.field = repeated_field;
+ current_parent_fields.push_back(specific_field);
+ if (!IsIgnored(message1, message2, key_des, current_parent_fields) &&
+ !IsIgnored(message1, message2, val_des, current_parent_fields)) {
+ return CompareMapFieldByMapReflection(message1, message2, repeated_field,
+ ¤t_parent_fields,
+ field_comparator_.default_impl);
}
}
@@ -1869,9 +1863,9 @@
const Message& message1, const Message& message2,
const FieldDescriptor* field, int index1, int index2,
const FieldContext* field_context) {
- FieldComparator* comparator = field_comparator_ != NULL
- ? field_comparator_
- : &default_field_comparator_;
+ FieldComparator* comparator = field_comparator_kind_ == kFCBase
+ ? field_comparator_.base
+ : field_comparator_.default_impl;
return comparator->Compare(message1, message2, field, index1, index2,
field_context);
}
diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h
index 943a0db..4cdb817 100644
--- a/src/google/protobuf/util/message_differencer.h
+++ b/src/google/protobuf/util/message_differencer.h
@@ -533,6 +533,9 @@
// Note that this method must be called before Compare for the comparator to
// be used.
void set_field_comparator(FieldComparator* comparator);
+#ifdef PROTOBUF_FUTURE_BREAKING_CHANGES
+ void set_field_comparator(DefaultFieldComparator* comparator);
+#endif // PROTOBUF_FUTURE_BREAKING_CHANGES
// DEPRECATED. Pass a DefaultFieldComparator instance instead.
// Sets the fraction and margin for the float comparison of a given field.
@@ -904,7 +907,6 @@
Reporter* reporter_;
DefaultFieldComparator default_field_comparator_;
- FieldComparator* field_comparator_;
MessageFieldComparison message_field_comparison_;
Scope scope_;
RepeatedFieldComparison repeated_field_comparison_;
@@ -925,6 +927,12 @@
FieldSet ignored_fields_;
+ union {
+ DefaultFieldComparator* default_impl;
+ FieldComparator* base;
+ } field_comparator_ = {&default_field_comparator_};
+ enum { kFCDefault, kFCBase } field_comparator_kind_ = kFCDefault;
+
bool report_matches_;
bool report_moves_;
bool report_ignores_;
diff --git a/src/google/protobuf/wire_format_unittest.cc b/src/google/protobuf/wire_format_unittest.cc
index e75fc31..4393066 100644
--- a/src/google/protobuf/wire_format_unittest.cc
+++ b/src/google/protobuf/wire_format_unittest.cc
@@ -641,7 +641,7 @@
io::CodedOutputStream* coded_output) {
WireFormatLite::WriteTag(15, // i
WireFormatLite::WIRETYPE_VARINT, coded_output);
- coded_output->WriteVarint32(message.i());
+ coded_output->WriteVarint64(message.i());
WireFormatLite::WriteTag(16, // recursive
WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
coded_output);
@@ -692,6 +692,66 @@
EXPECT_FALSE(message_set.ParseFromString(data));
}
+TEST(WireFormatTest, ParseFailMalformedMessageSet) {
+ constexpr int kDepth = 5;
+ std::string data;
+ {
+ proto2_wireformat_unittest::TestMessageSet message_set;
+ proto2_wireformat_unittest::TestMessageSet* mset = &message_set;
+ for (int i = 0; i < kDepth; i++) {
+ auto m = mset->MutableExtension(
+ unittest::TestMessageSetExtension1::message_set_extension);
+ m->set_i(i);
+ mset = m->mutable_recursive();
+ }
+ auto m = mset->MutableExtension(
+ unittest::TestMessageSetExtension1::message_set_extension);
+ // -1 becomes \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1
+ m->set_i(-1);
+
+ EXPECT_TRUE(message_set.SerializeToString(&data));
+ // Make the proto mal-formed.
+ data[data.size() - 2 - kDepth] = 0xFF;
+ }
+
+ proto2_wireformat_unittest::TestMessageSet message_set;
+ EXPECT_FALSE(message_set.ParseFromString(data));
+}
+
+TEST(WireFormatTest, ParseFailMalformedMessageSetReverseOrder) {
+ constexpr int kDepth = 5;
+ std::string data;
+ {
+ proto2_wireformat_unittest::TestMessageSet message_set;
+ proto2_wireformat_unittest::TestMessageSet* mset = &message_set;
+ for (int i = 0; i < kDepth; i++) {
+ auto m = mset->MutableExtension(
+ unittest::TestMessageSetExtension1::message_set_extension);
+ m->set_i(i);
+ mset = m->mutable_recursive();
+ }
+ auto m = mset->MutableExtension(
+ unittest::TestMessageSetExtension1::message_set_extension);
+ // -1 becomes \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1
+ m->set_i(-1);
+ // SerializeReverseOrder() assumes "recursive" is always present.
+ m->mutable_recursive();
+
+ message_set.ByteSizeLong();
+
+ // Serialize with reverse payload tag order
+ io::StringOutputStream output_stream(&data);
+ io::CodedOutputStream coded_output(&output_stream);
+ SerializeReverseOrder(message_set, &coded_output);
+ }
+
+ // Make varint for -1 malformed.
+ data[data.size() - 5 * (kDepth + 1) - 4] = 0xFF;
+
+ proto2_wireformat_unittest::TestMessageSet message_set;
+ EXPECT_FALSE(message_set.ParseFromString(data));
+}
+
TEST(WireFormatTest, ParseBrokenMessageSet) {
proto2_wireformat_unittest::TestMessageSet message_set;
std::string input("goodbye"); // Invalid wire format data.
@@ -751,8 +811,8 @@
TEST(WireFormatTest, ZigZag) {
// avoid line-wrapping
-#define LL(x) PROTOBUF_LONGLONG(x)
-#define ULL(x) PROTOBUF_ULONGLONG(x)
+#define LL(x) static_cast<int64_t>(ULL(x))
+#define ULL(x) uint64_t{x##u}
#define ZigZagEncode32(x) WireFormatLite::ZigZagEncode32(x)
#define ZigZagDecode32(x) WireFormatLite::ZigZagDecode32(x)
#define ZigZagEncode64(x) WireFormatLite::ZigZagEncode64(x)
diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc
index c791d05..6f346ee 100644
--- a/src/google/protobuf/wrappers.pb.cc
+++ b/src/google/protobuf/wrappers.pb.cc
@@ -43,7 +43,7 @@
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT FloatValueDefaultTypeInternal _FloatValue_default_instance_;
constexpr Int64Value::Int64Value(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : value_(PROTOBUF_LONGLONG(0)){}
+ : value_(int64_t{0}){}
struct Int64ValueDefaultTypeInternal {
constexpr Int64ValueDefaultTypeInternal()
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
@@ -55,7 +55,7 @@
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Int64ValueDefaultTypeInternal _Int64Value_default_instance_;
constexpr UInt64Value::UInt64Value(
::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
- : value_(PROTOBUF_ULONGLONG(0)){}
+ : value_(uint64_t{0u}){}
struct UInt64ValueDefaultTypeInternal {
constexpr UInt64ValueDefaultTypeInternal()
: _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
@@ -269,7 +269,7 @@
}
void DoubleValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void DoubleValue::ArenaDtor(void* object) {
@@ -417,7 +417,7 @@
void DoubleValue::InternalSwap(DoubleValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -457,7 +457,7 @@
}
void FloatValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void FloatValue::ArenaDtor(void* object) {
@@ -605,7 +605,7 @@
void FloatValue::InternalSwap(FloatValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -635,7 +635,7 @@
}
void Int64Value::SharedCtor() {
-value_ = PROTOBUF_LONGLONG(0);
+value_ = int64_t{0};
}
Int64Value::~Int64Value() {
@@ -645,7 +645,7 @@
}
void Int64Value::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void Int64Value::ArenaDtor(void* object) {
@@ -664,7 +664,7 @@
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- value_ = PROTOBUF_LONGLONG(0);
+ value_ = int64_t{0};
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@@ -795,7 +795,7 @@
void Int64Value::InternalSwap(Int64Value* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -825,7 +825,7 @@
}
void UInt64Value::SharedCtor() {
-value_ = PROTOBUF_ULONGLONG(0);
+value_ = uint64_t{0u};
}
UInt64Value::~UInt64Value() {
@@ -835,7 +835,7 @@
}
void UInt64Value::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void UInt64Value::ArenaDtor(void* object) {
@@ -854,7 +854,7 @@
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
- value_ = PROTOBUF_ULONGLONG(0);
+ value_ = uint64_t{0u};
_internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}
@@ -985,7 +985,7 @@
void UInt64Value::InternalSwap(UInt64Value* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -1025,7 +1025,7 @@
}
void Int32Value::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void Int32Value::ArenaDtor(void* object) {
@@ -1175,7 +1175,7 @@
void Int32Value::InternalSwap(Int32Value* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -1215,7 +1215,7 @@
}
void UInt32Value::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void UInt32Value::ArenaDtor(void* object) {
@@ -1365,7 +1365,7 @@
void UInt32Value::InternalSwap(UInt32Value* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -1405,7 +1405,7 @@
}
void BoolValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}
void BoolValue::ArenaDtor(void* object) {
@@ -1553,7 +1553,7 @@
void BoolValue::InternalSwap(BoolValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
swap(value_, other->value_);
}
@@ -1581,7 +1581,7 @@
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
- GetArena());
+ GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue)
}
@@ -1597,7 +1597,7 @@
}
void StringValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -1666,7 +1666,7 @@
(void) cached_has_bits;
// string value = 1;
- if (this->value().size() > 0) {
+ if (!this->value().empty()) {
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String(
this->_internal_value().data(), static_cast<int>(this->_internal_value().length()),
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE,
@@ -1692,7 +1692,7 @@
(void) cached_has_bits;
// string value = 1;
- if (this->value().size() > 0) {
+ if (!this->value().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
this->_internal_value());
@@ -1729,7 +1729,7 @@
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
- if (from.value().size() > 0) {
+ if (!from.value().empty()) {
_internal_set_value(from._internal_value());
}
}
@@ -1754,8 +1754,12 @@
void StringValue::InternalSwap(StringValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &value_, GetArenaForAllocation(),
+ &other->value_, other->GetArenaForAllocation()
+ );
}
::PROTOBUF_NAMESPACE_ID::Metadata StringValue::GetMetadata() const {
@@ -1782,7 +1786,7 @@
value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
if (!from._internal_value().empty()) {
value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(),
- GetArena());
+ GetArenaForAllocation());
}
// @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue)
}
@@ -1798,7 +1802,7 @@
}
void BytesValue::SharedDtor() {
- GOOGLE_DCHECK(GetArena() == nullptr);
+ GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
value_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
@@ -1866,7 +1870,7 @@
(void) cached_has_bits;
// bytes value = 1;
- if (this->value().size() > 0) {
+ if (!this->value().empty()) {
target = stream->WriteBytesMaybeAliased(
1, this->_internal_value(), target);
}
@@ -1888,7 +1892,7 @@
(void) cached_has_bits;
// bytes value = 1;
- if (this->value().size() > 0) {
+ if (!this->value().empty()) {
total_size += 1 +
::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::BytesSize(
this->_internal_value());
@@ -1925,7 +1929,7 @@
::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
(void) cached_has_bits;
- if (from.value().size() > 0) {
+ if (!from.value().empty()) {
_internal_set_value(from._internal_value());
}
}
@@ -1950,8 +1954,12 @@
void BytesValue::InternalSwap(BytesValue* other) {
using std::swap;
- _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
- value_.Swap(&other->value_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ _internal_metadata_.InternalSwap(&other->_internal_metadata_);
+ ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap(
+ &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
+ &value_, GetArenaForAllocation(),
+ &other->value_, other->GetArenaForAllocation()
+ );
}
::PROTOBUF_NAMESPACE_ID::Metadata BytesValue::GetMetadata() const {
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index 5659b5f..6027868 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -97,7 +97,7 @@
// ===================================================================
-class PROTOBUF_EXPORT DoubleValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT DoubleValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.DoubleValue) */ {
public:
inline DoubleValue() : DoubleValue(nullptr) {}
@@ -115,8 +115,9 @@
return *this;
}
inline DoubleValue& operator=(DoubleValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -147,7 +148,7 @@
}
inline void Swap(DoubleValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -155,14 +156,14 @@
}
void UnsafeArenaSwap(DoubleValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline DoubleValue* New() const final {
- return CreateMaybeMessage<DoubleValue>(nullptr);
+ return new DoubleValue();
}
DoubleValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -182,8 +183,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(DoubleValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -228,7 +229,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT FloatValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT FloatValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.FloatValue) */ {
public:
inline FloatValue() : FloatValue(nullptr) {}
@@ -246,8 +247,9 @@
return *this;
}
inline FloatValue& operator=(FloatValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -278,7 +280,7 @@
}
inline void Swap(FloatValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -286,14 +288,14 @@
}
void UnsafeArenaSwap(FloatValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FloatValue* New() const final {
- return CreateMaybeMessage<FloatValue>(nullptr);
+ return new FloatValue();
}
FloatValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -313,8 +315,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FloatValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -359,7 +361,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Int64Value PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Int64Value final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int64Value) */ {
public:
inline Int64Value() : Int64Value(nullptr) {}
@@ -377,8 +379,9 @@
return *this;
}
inline Int64Value& operator=(Int64Value&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -409,7 +412,7 @@
}
inline void Swap(Int64Value* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -417,14 +420,14 @@
}
void UnsafeArenaSwap(Int64Value* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Int64Value* New() const final {
- return CreateMaybeMessage<Int64Value>(nullptr);
+ return new Int64Value();
}
Int64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -444,8 +447,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Int64Value* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -490,7 +493,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT UInt64Value PROTOBUF_FINAL :
+class PROTOBUF_EXPORT UInt64Value final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt64Value) */ {
public:
inline UInt64Value() : UInt64Value(nullptr) {}
@@ -508,8 +511,9 @@
return *this;
}
inline UInt64Value& operator=(UInt64Value&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -540,7 +544,7 @@
}
inline void Swap(UInt64Value* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -548,14 +552,14 @@
}
void UnsafeArenaSwap(UInt64Value* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline UInt64Value* New() const final {
- return CreateMaybeMessage<UInt64Value>(nullptr);
+ return new UInt64Value();
}
UInt64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -575,8 +579,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(UInt64Value* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -621,7 +625,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT Int32Value PROTOBUF_FINAL :
+class PROTOBUF_EXPORT Int32Value final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Int32Value) */ {
public:
inline Int32Value() : Int32Value(nullptr) {}
@@ -639,8 +643,9 @@
return *this;
}
inline Int32Value& operator=(Int32Value&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -671,7 +676,7 @@
}
inline void Swap(Int32Value* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -679,14 +684,14 @@
}
void UnsafeArenaSwap(Int32Value* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Int32Value* New() const final {
- return CreateMaybeMessage<Int32Value>(nullptr);
+ return new Int32Value();
}
Int32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -706,8 +711,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Int32Value* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -752,7 +757,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT UInt32Value PROTOBUF_FINAL :
+class PROTOBUF_EXPORT UInt32Value final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.UInt32Value) */ {
public:
inline UInt32Value() : UInt32Value(nullptr) {}
@@ -770,8 +775,9 @@
return *this;
}
inline UInt32Value& operator=(UInt32Value&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -802,7 +808,7 @@
}
inline void Swap(UInt32Value* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -810,14 +816,14 @@
}
void UnsafeArenaSwap(UInt32Value* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline UInt32Value* New() const final {
- return CreateMaybeMessage<UInt32Value>(nullptr);
+ return new UInt32Value();
}
UInt32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -837,8 +843,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(UInt32Value* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -883,7 +889,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT BoolValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT BoolValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BoolValue) */ {
public:
inline BoolValue() : BoolValue(nullptr) {}
@@ -901,8 +907,9 @@
return *this;
}
inline BoolValue& operator=(BoolValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -933,7 +940,7 @@
}
inline void Swap(BoolValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -941,14 +948,14 @@
}
void UnsafeArenaSwap(BoolValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline BoolValue* New() const final {
- return CreateMaybeMessage<BoolValue>(nullptr);
+ return new BoolValue();
}
BoolValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -968,8 +975,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(BoolValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1014,7 +1021,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT StringValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT StringValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.StringValue) */ {
public:
inline StringValue() : StringValue(nullptr) {}
@@ -1032,8 +1039,9 @@
return *this;
}
inline StringValue& operator=(StringValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1064,7 +1072,7 @@
}
inline void Swap(StringValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1072,14 +1080,14 @@
}
void UnsafeArenaSwap(StringValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline StringValue* New() const final {
- return CreateMaybeMessage<StringValue>(nullptr);
+ return new StringValue();
}
StringValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1099,8 +1107,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(StringValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1129,11 +1137,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_value();
- std::string* release_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_value();
void set_allocated_value(std::string* value);
private:
const std::string& _internal_value() const;
- void _internal_set_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value);
std::string* _internal_mutable_value();
public:
@@ -1150,7 +1158,7 @@
};
// -------------------------------------------------------------------
-class PROTOBUF_EXPORT BytesValue PROTOBUF_FINAL :
+class PROTOBUF_EXPORT BytesValue final :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:google.protobuf.BytesValue) */ {
public:
inline BytesValue() : BytesValue(nullptr) {}
@@ -1168,8 +1176,9 @@
return *this;
}
inline BytesValue& operator=(BytesValue&& from) noexcept {
- if (GetArena() == from.GetArena()) {
- if (this != &from) InternalSwap(&from);
+ if (this == &from) return *this;
+ if (GetOwningArena() == from.GetOwningArena()) {
+ InternalSwap(&from);
} else {
CopyFrom(from);
}
@@ -1200,7 +1209,7 @@
}
inline void Swap(BytesValue* other) {
if (other == this) return;
- if (GetArena() == other->GetArena()) {
+ if (GetOwningArena() == other->GetOwningArena()) {
InternalSwap(other);
} else {
::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1208,14 +1217,14 @@
}
void UnsafeArenaSwap(BytesValue* other) {
if (other == this) return;
- GOOGLE_DCHECK(GetArena() == other->GetArena());
+ GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena());
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline BytesValue* New() const final {
- return CreateMaybeMessage<BytesValue>(nullptr);
+ return new BytesValue();
}
BytesValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
@@ -1235,8 +1244,8 @@
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
- inline void SharedCtor();
- inline void SharedDtor();
+ void SharedCtor();
+ void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(BytesValue* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
@@ -1265,11 +1274,11 @@
template <typename ArgT0 = const std::string&, typename... ArgT>
void set_value(ArgT0&& arg0, ArgT... args);
std::string* mutable_value();
- std::string* release_value();
+ PROTOBUF_FUTURE_MUST_USE_RESULT std::string* release_value();
void set_allocated_value(std::string* value);
private:
const std::string& _internal_value() const;
- void _internal_set_value(const std::string& value);
+ inline PROTOBUF_ALWAYS_INLINE void _internal_set_value(const std::string& value);
std::string* _internal_mutable_value();
public:
@@ -1345,7 +1354,7 @@
// int64 value = 1;
inline void Int64Value::clear_value() {
- value_ = PROTOBUF_LONGLONG(0);
+ value_ = int64_t{0};
}
inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::_internal_value() const {
return value_;
@@ -1369,7 +1378,7 @@
// uint64 value = 1;
inline void UInt64Value::clear_value() {
- value_ = PROTOBUF_ULONGLONG(0);
+ value_ = uint64_t{0u};
}
inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::_internal_value() const {
return value_;
@@ -1472,10 +1481,10 @@
return _internal_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void StringValue::set_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void StringValue::set_value(ArgT0&& arg0, ArgT... args) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.StringValue.value)
}
inline std::string* StringValue::mutable_value() {
@@ -1487,15 +1496,15 @@
}
inline void StringValue::_internal_set_value(const std::string& value) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* StringValue::_internal_mutable_value() {
- return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* StringValue::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.StringValue.value)
- return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void StringValue::set_allocated_value(std::string* value) {
if (value != nullptr) {
@@ -1504,7 +1513,7 @@
}
value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value)
}
@@ -1521,10 +1530,10 @@
return _internal_value();
}
template <typename ArgT0, typename... ArgT>
-PROTOBUF_ALWAYS_INLINE
-inline void BytesValue::set_value(ArgT0&& arg0, ArgT... args) {
+inline PROTOBUF_ALWAYS_INLINE
+void BytesValue::set_value(ArgT0&& arg0, ArgT... args) {
- value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArena());
+ value_.SetBytes(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, static_cast<ArgT0 &&>(arg0), args..., GetArenaForAllocation());
// @@protoc_insertion_point(field_set:google.protobuf.BytesValue.value)
}
inline std::string* BytesValue::mutable_value() {
@@ -1536,15 +1545,15 @@
}
inline void BytesValue::_internal_set_value(const std::string& value) {
- value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArena());
+ value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, value, GetArenaForAllocation());
}
inline std::string* BytesValue::_internal_mutable_value() {
- return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArena());
+ return value_.Mutable(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, GetArenaForAllocation());
}
inline std::string* BytesValue::release_value() {
// @@protoc_insertion_point(field_release:google.protobuf.BytesValue.value)
- return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
+ return value_.Release(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
}
inline void BytesValue::set_allocated_value(std::string* value) {
if (value != nullptr) {
@@ -1553,7 +1562,7 @@
}
value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
- GetArena());
+ GetArenaForAllocation());
// @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value)
}
diff --git a/tests.sh b/tests.sh
index 1135f95..972e64f 100755
--- a/tests.sh
+++ b/tests.sh
@@ -62,7 +62,7 @@
# List all files that should be included in the distribution package.
git ls-files | grep "^\(java\|python\|objectivec\|csharp\|js\|ruby\|php\|cmake\|examples\|src/google/protobuf/.*\.proto\)" |\
- grep -v ".gitignore" | grep -v "java/compatibility_tests" | grep -v "java/lite/proguard.pgcfg" |\
+ grep -v ".gitignore" | grep -v "java/lite/proguard.pgcfg" |\
grep -v "python/compatibility_tests" | grep -v "python/docs" | grep -v "python/.repo-metadata.json" |\
grep -v "python/protobuf_distutils" | grep -v "csharp/compatibility_tests" > dist.lst
# Unzip the dist tar file.
@@ -234,17 +234,6 @@
use_java oracle7
build_java oracle7
}
-build_java_compatibility() {
- use_java jdk7
- internal_build_cpp
- # Use the unit-tests extracted from 2.5.0 to test the compatibility between
- # 3.0.0-beta-4 and the current version.
- cd java/compatibility_tests/v2.5.0
- ./test.sh 3.0.0-beta-4
-
- # Test the last released and current version.
- ./test.sh $LAST_RELEASED
-}
build_java_linkage_monitor() {
# Linkage Monitor checks compatibility with other Google libraries
# https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
@@ -416,19 +405,6 @@
build_python_cpp_version py39-cpp
}
-build_python_compatibility() {
- internal_build_cpp
- # Use the unit-tests extracted from 2.5.0 to test the compatibility.
- cd python/compatibility_tests/v2.5.0
- # Test between 2.5.0 and the current version.
- ./test.sh 2.5.0
- # Test between 3.0.0-beta-1 and the current version.
- ./test.sh 3.0.0-beta-1
-
- # Test between last released and current version.
- ./test.sh $LAST_RELEASED
-}
-
build_ruby23() {
internal_build_cpp # For conformance tests.
cd ruby && bash travis-test.sh ruby-2.3.8 && cd ..
@@ -478,14 +454,8 @@
internal_build_cpp
}
-use_php_zts() {
- VERSION=$1
- export PATH=/usr/local/php-${VERSION}-zts/bin:$PATH
- internal_build_cpp
-}
-
-build_php5.6() {
- use_php 5.6
+build_php() {
+ use_php $1
pushd php
rm -rf vendor
composer update
@@ -494,41 +464,18 @@
(cd conformance && make test_php)
}
-build_php7.0() {
- use_php 7.0
+test_php_c() {
pushd php
rm -rf vendor
composer update
- composer test
+ composer test_c
popd
- (cd conformance && make test_php)
+ (cd conformance && make test_php_c)
}
-build_php7.0_c() {
- use_php 7.0
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
-}
-
-build_php7.0_mixed() {
- use_php 7.0
- pushd php
- rm -rf vendor
- composer update
- tests/compile_extension.sh
- tests/generate_protos.sh
- php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
- popd
-}
-
-build_php7.0_zts_c() {
- use_php_zts 7.0
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
+build_php_c() {
+ use_php $1
+ test_php_c
}
build_php7.0_mac() {
@@ -539,14 +486,17 @@
test ! -z "$PHP_FOLDER"
export PATH="$PHP_FOLDER/bin:$PATH"
+ # Install Composer
+ wget https://getcomposer.org/download/2.0.13/composer.phar --progress=dot:mega -O /usr/local/bin/composer
+ chmod a+x /usr/local/bin/composer
+
# Install valgrind
echo "#! /bin/bash" > valgrind
chmod ug+x valgrind
sudo mv valgrind /usr/local/bin/valgrind
# Test
- php/tests/test.sh
- (cd conformance && make test_php_c)
+ test_php_c
}
build_php7.3_mac() {
@@ -559,14 +509,17 @@
test ! -z "$PHP_FOLDER"
export PATH="$PHP_FOLDER/bin:$PATH"
+ # Install Composer
+ wget https://getcomposer.org/download/2.0.13/composer.phar --progress=dot:mega -O /usr/local/bin/composer
+ chmod a+x /usr/local/bin/composer
+
# Install valgrind
echo "#! /bin/bash" > valgrind
chmod ug+x valgrind
sudo mv valgrind /usr/local/bin/valgrind
# Test
- php/tests/test.sh
- (cd conformance && make test_php_c)
+ test_php_c
}
build_php_compatibility() {
@@ -579,137 +532,25 @@
php/tests/multirequest.sh
}
-build_php7.1() {
- use_php 7.1
- pushd php
- rm -rf vendor
- composer update
- composer test
- popd
- (cd conformance && make test_php)
-}
-
-build_php7.1_c() {
- use_php 7.1
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
-}
-
-build_php7.1_mixed() {
- use_php 7.1
- pushd php
- rm -rf vendor
- composer update
- tests/compile_extension.sh
- tests/generate_protos.sh
- php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
- popd
-}
-
-build_php7.1_zts_c() {
- use_php_zts 7.1
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
-}
-
-build_php7.4() {
- use_php 7.4
- pushd php
- rm -rf vendor
- composer update
- composer test
- popd
- (cd conformance && make test_php)
-}
-
-build_php7.4_c() {
- use_php 7.4
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
-}
-
-build_php7.4_mixed() {
- use_php 7.4
- pushd php
- rm -rf vendor
- composer update
- tests/compile_extension.sh
- tests/generate_protos.sh
- php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
- popd
-}
-
-build_php7.4_zts_c() {
- use_php_zts 7.4
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
-}
-
-build_php8.0() {
- use_php 8.0
- pushd php
- rm -rf vendor
- composer update
- composer test
- popd
- (cd conformance && make test_php)
-}
-
-build_php8.0_c() {
- use_php 8.0
- php/tests/test.sh
- pushd conformance
- make test_php_c
- popd
-}
-
-build_php8.0_c_64() {
- build_php8.0_c true
-}
-
-build_php8.0_mixed() {
- use_php 8.0
- pushd php
- rm -rf vendor
- composer update
- tests/compile_extension.sh
- tests/generate_protos.sh
- php -dextension=./ext/google/protobuf/modules/protobuf.so ./vendor/bin/phpunit
- popd
-}
-
build_php8.0_all() {
- build_php8.0
- build_php8.0_c_64
- build_php8.0_mixed
+ build_php 8.0
+ build_php_c 8.0
}
build_php_all_32() {
- build_php5.6
- build_php7.0
- build_php7.1
- build_php7.4
- build_php7.0_c $1
- build_php7.1_c $1
- build_php7.4_c $1
- build_php7.0_mixed
- build_php7.1_mixed
- build_php7.4_mixed
- build_php7.0_zts_c $1
- build_php7.1_zts_c $1
- build_php7.4_zts_c $1
+ build_php 7.0
+ build_php 7.1
+ build_php 7.4
+ build_php_c 7.0
+ build_php_c 7.1
+ build_php_c 7.4
+ build_php_c 7.1-zts
+ build_php_c 7.2-zts
+ build_php_c 7.5-zts
}
build_php_all() {
- build_php_all_32 true
+ build_php_all_32
build_php_multirequest
build_php_compatibility
}
@@ -728,7 +569,6 @@
csharp |
java_jdk7 |
java_oracle7 |
- java_compatibility |
java_linkage_monitor |
objectivec_ios |
objectivec_ios_debug |
@@ -749,13 +589,10 @@
ruby30 |
jruby |
ruby_all |
- php7.0 |
- php7.0_c |
- php_compatibility |
- php7.1 |
- php7.1_c |
php_all |
- php8.0_all |
+ php_all_32 |
+ php7.0_mac |
+ php7.3_mac |
dist_install |
benchmark)
"