Merge remote-tracking branch 'refs/remotes/upstream/main' into sync-stage
# Conflicts:
# src/google/protobuf/compiler/objectivec/objectivec_enum.cc
# src/google/protobuf/compiler/objectivec/objectivec_extension.cc
# src/google/protobuf/compiler/objectivec/objectivec_field.cc
# src/google/protobuf/compiler/objectivec/objectivec_file.cc
# src/google/protobuf/compiler/objectivec/objectivec_generator.cc
# src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
# src/google/protobuf/compiler/objectivec/objectivec_message.cc
# src/google/protobuf/compiler/objectivec/objectivec_oneof.cc
# src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
# src/google/protobuf/compiler/plugin.pb.h
# src/google/protobuf/descriptor.pb.h
diff --git a/BUILD.bazel b/BUILD.bazel
index b63b7bf..fd9ee70 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -325,6 +325,12 @@
################################################################################
alias(
+ name = "lite_test_proto_srcs",
+ actual = "//src/google/protobuf:lite_test_proto_srcs", # proto_library
+ visibility = ["//:__subpackages__"],
+)
+
+alias(
name = "lite_test_protos",
actual = "//src/google/protobuf:lite_test_protos", # proto_library
visibility = ["//:__subpackages__"],
diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec
index 2043adb..8ab70d0 100644
--- a/Protobuf-C++.podspec
+++ b/Protobuf-C++.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
- s.version = '3.21.5'
+ s.version = '3.21.6'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = 'BSD-3-Clause'
diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake
index fa5c479..056250e 100644
--- a/cmake/conformance.cmake
+++ b/cmake/conformance.cmake
@@ -1,6 +1,8 @@
add_custom_command(
- OUTPUT ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
+ OUTPUT
+ ${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
+ ${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/conformance/conformance.proto
--proto_path=${protobuf_SOURCE_DIR}/conformance
@@ -8,8 +10,11 @@
)
add_custom_command(
- OUTPUT ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
+ OUTPUT
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
DEPENDS ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.proto
COMMAND ${protobuf_PROTOC_EXE} ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.proto
@@ -21,6 +26,7 @@
add_executable(conformance_test_runner
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.cc
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.h
+ ${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
${protobuf_SOURCE_DIR}/conformance/conformance_test.cc
${protobuf_SOURCE_DIR}/conformance/conformance_test_runner.cc
@@ -29,14 +35,19 @@
${protobuf_SOURCE_DIR}/conformance/text_format_conformance_suite.h
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/json.h
${protobuf_SOURCE_DIR}/conformance/third_party/jsoncpp/jsoncpp.cpp
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
)
add_executable(conformance_cpp
+ ${protobuf_SOURCE_DIR}/conformance/conformance.pb.h
${protobuf_SOURCE_DIR}/conformance/conformance.pb.cc
${protobuf_SOURCE_DIR}/conformance/conformance_cpp.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto2.pb.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_messages_proto3.pb.cc
)
diff --git a/cmake/push_auto_update.sh b/cmake/push_auto_update.sh
new file mode 100755
index 0000000..abae4f4
--- /dev/null
+++ b/cmake/push_auto_update.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# This script updates the CMake file lists (i.e. src/file_lists.cmake), commits
+# the resulting change, and pushes it. This does not do anything useful when
+# run manually, but should be run by our GitHub action instead.
+
+set -ex
+
+# Exit early if the previous commit was made by the bot. This reduces the risk
+# of a bug causing an infinite loop of auto-generated commits.
+if (git log -1 --pretty=format:'%an' | grep -q "Protobuf Team Bot"); then
+ echo "Previous commit was authored by bot"
+ exit 0
+fi
+
+$(dirname -- "$0")/update_file_lists.sh
+
+# Try to determine the most recent pull request number.
+title=$(git log -1 --pretty='%s')
+pr_from_merge=$(echo "$title" | sed -n 's/^Merge pull request #\([0-9]\+\).*/\1/p')
+pr_from_squash=$(echo "$title" | sed -n 's/^.*(#\([0-9]\+\))$/\1/p')
+
+pr=""
+if [ ! -z "$pr_from_merge" ]; then
+ pr="$pr_from_merge"
+elif [ ! -z "$pr_from_squash" ]; then
+ pr="$pr_from_squash"
+fi
+
+if [ ! -z "$pr" ]; then
+ commit_message="Auto-generate CMake file lists after PR #$pr"
+else
+ # If we are unable to determine the pull request number, we fall back on this
+ # default commit message. Typically this should not occur, but could happen
+ # if a pull request was merged via a rebase.
+ commit_message="Auto-generate CMake file lists"
+fi
+
+git add -A
+git diff --staged --quiet || git commit -am "$commit_message"
+git push
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index a9fdd52..530a66b 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -43,19 +43,20 @@
include(${protobuf_SOURCE_DIR}/src/file_lists.cmake)
set(lite_test_protos
- ${protobuf_lite_test_protos_proto_srcs}
+ ${protobuf_lite_test_protos_files}
)
set(tests_protos
- ${protobuf_test_protos_proto_srcs}
+ ${protobuf_test_protos_files}
${compiler_test_protos_files}
${util_test_protos_files}
)
macro(compile_proto_file filename)
- string(REPLACE .proto .pb.cc pb_file ${filename})
+ string(REPLACE .proto .pb.h pb_hdr ${filename})
+ string(REPLACE .proto .pb.cc pb_src ${filename})
add_custom_command(
- OUTPUT ${pb_file}
+ OUTPUT ${pb_hdr} ${pb_src}
DEPENDS ${protobuf_PROTOC_EXE} ${filename}
COMMAND ${protobuf_PROTOC_EXE} ${filename}
--proto_path=${protobuf_SOURCE_DIR}/src
@@ -67,13 +68,13 @@
set(lite_test_proto_files)
foreach(proto_file ${lite_test_protos})
compile_proto_file(${proto_file})
- set(lite_test_proto_files ${lite_test_proto_files} ${pb_file})
+ set(lite_test_proto_files ${lite_test_proto_files} ${pb_src} ${pb_hdr})
endforeach(proto_file)
set(tests_proto_files)
foreach(proto_file ${tests_protos})
compile_proto_file(${proto_file})
- set(tests_proto_files ${tests_proto_files} ${pb_file})
+ set(tests_proto_files ${tests_proto_files} ${pb_src} ${pb_hdr})
endforeach(proto_file)
add_library(protobuf-lite-test-common STATIC
@@ -85,8 +86,8 @@
set(common_test_files
${test_util_hdrs}
${test_util_srcs}
- ${mock_code_generator_srcs}
- ${testing_srcs}
+ ${common_test_hdrs}
+ ${common_test_srcs}
)
add_library(protobuf-test-common STATIC
@@ -138,8 +139,8 @@
set(test_plugin_files
${test_plugin_files}
- ${mock_code_generator_srcs}
- ${testing_srcs}
+ ${common_test_hdrs}
+ ${common_test_srcs}
)
add_executable(test_plugin ${test_plugin_files})
@@ -172,13 +173,23 @@
add_custom_target(remove-installed-headers)
add_custom_target(restore-installed-headers)
-# Explicitly skip the bootstrapping headers as it's directly used in tests
-set(_installed_hdrs ${libprotobuf_hdrs} ${libprotoc_hdrs})
-list(REMOVE_ITEM _installed_hdrs
+file(GLOB_RECURSE _local_hdrs
+ "${PROJECT_SOURCE_DIR}/src/*.h"
+ "${PROJECT_SOURCE_DIR}/src/*.inc")
+
+# Exclude the bootstrapping that are directly used by tests.
+set(_exclude_hdrs
"${protobuf_SOURCE_DIR}/src/google/protobuf/descriptor.pb.h"
"${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin.pb.h")
-foreach(_hdr ${_installed_hdrs})
+# Exclude test library headers.
+list(APPEND _exclude_hdrs ${test_util_hdrs} ${lite_test_util_hdrs} ${common_test_hdrs}
+ ${compiler_test_utils_hdrs})
+foreach(_hdr ${_exclude_hdrs})
+ list(REMOVE_ITEM _local_hdrs ${_hdr})
+endforeach()
+
+foreach(_hdr ${_local_hdrs})
string(REPLACE "${protobuf_SOURCE_DIR}/src" "" _file ${_hdr})
set(_tmp_file "${CMAKE_BINARY_DIR}/tmp-install-test/${_file}")
add_custom_command(TARGET remove-installed-headers PRE_BUILD
@@ -193,6 +204,6 @@
add_dependencies(remove-installed-headers save-installed-headers)
if(protobuf_REMOVE_INSTALLED_HEADERS)
- add_dependencies(protobuf-lite-test-common remove-installed-headers)
- add_dependencies(protobuf-test-common remove-installed-headers)
+ # Make sure we remove all the headers *before* any codegen occurs.
+ add_dependencies(${protobuf_PROTOC_EXE} remove-installed-headers)
endif()
diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel
index 65dc37c..4eda549 100644
--- a/pkg/BUILD.bazel
+++ b/pkg/BUILD.bazel
@@ -314,20 +314,18 @@
"//src/google/protobuf:descriptor_proto": "descriptor_proto",
"//src/google/protobuf/compiler:plugin_proto": "plugin_proto",
# Test libraries:
+ ":common_test": "common_test",
":lite_test_util": "lite_test_util",
":test_util": "test_util",
# Tests and test-only protos:
"//src/google/protobuf:full_test_srcs": "protobuf_test",
- "//src/google/protobuf:test_protos": "protobuf_test_protos",
+ "//src/google/protobuf:test_proto_srcs": "protobuf_test_protos",
"//src/google/protobuf:lite_test_srcs": "protobuf_lite_test",
- "//src/google/protobuf:lite_test_protos": "protobuf_lite_test_protos",
+ "//src/google/protobuf:lite_test_proto_srcs": "protobuf_lite_test_protos",
"//src/google/protobuf/compiler:test_srcs": "compiler_test",
- ":compiler_annotation_test_util": "annotation_test_util",
- ":compiler_mock_code_generator": "mock_code_generator",
"//src/google/protobuf/compiler:test_proto_srcs": "compiler_test_protos",
"//src/google/protobuf/compiler:test_plugin_srcs": "test_plugin",
"//src/google/protobuf/io:test_srcs": "io_test",
- ":testinglib": "testing",
"//src/google/protobuf/util:test_srcs": "util_test",
"//src/google/protobuf/util:test_proto_srcs": "util_test_protos",
"//src/google/protobuf/stubs:test_srcs": "stubs_test",
@@ -369,6 +367,7 @@
"//src/google/protobuf:protobuf_nowkt",
"//src/google/protobuf:arena",
"//src/google/protobuf:protobuf_lite",
+ "//src/google/protobuf:port_def",
"//src/google/protobuf/compiler:importer",
"//src/google/protobuf/io",
"//src/google/protobuf/io:gzip_stream",
@@ -384,6 +383,7 @@
"//src/google/protobuf/util:json_util",
"//src/google/protobuf/util:time_util",
"//src/google/protobuf/util:type_resolver_util",
+ "//src/google/protobuf/util/internal:constants",
"//src/google/protobuf/util/internal:datapiece",
"//src/google/protobuf/util/internal:default_value",
"//src/google/protobuf/util/internal:field_mask_utility",
@@ -422,29 +422,27 @@
name = "test_util",
testonly = 1,
tags = ["manual"],
- deps = ["//src/google/protobuf:test_util"],
+ deps = [
+ "//src/google/protobuf:test_util",
+ "//src/google/protobuf:test_util2",
+ "//src/google/protobuf/util/internal:expecting_objectwriter",
+ "//src/google/protobuf/util/internal:mock_error_listener",
+ "//src/google/protobuf/util/internal:type_info_test_helper",
+ "//src/google/protobuf/compiler:annotation_test_util",
+ "//src/google/protobuf/compiler/cpp:unittest_lib",
+ ],
)
cc_dist_library(
- name = "compiler_annotation_test_util",
+ name = "common_test",
testonly = 1,
tags = ["manual"],
- deps = ["//src/google/protobuf/compiler:annotation_test_util"],
+ deps = [
+ "//src/google/protobuf/testing",
+ "//src/google/protobuf/compiler:mock_code_generator",
+ ],
)
-cc_dist_library(
- name = "compiler_mock_code_generator",
- testonly = 1,
- tags = ["manual"],
- deps = ["//src/google/protobuf/compiler:mock_code_generator"],
-)
-
-cc_dist_library(
- name = "testinglib",
- testonly = 1,
- tags = ["manual"],
- deps = ["//src/google/protobuf/testing"],
-)
################################################################################
# Distribution sources
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index 4d288e2..9ba2b78 100644
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved.
-__version__ = '4.21.5'
+__version__ = '4.21.6'
diff --git a/src/file_lists.cmake b/src/file_lists.cmake
index be3d61e..2a76933 100644
--- a/src/file_lists.cmake
+++ b/src/file_lists.cmake
@@ -157,6 +157,8 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/metadata_lite.h
${protobuf_SOURCE_DIR}/src/google/protobuf/parse_context.h
${protobuf_SOURCE_DIR}/src/google/protobuf/port.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/port_def.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/port_undef.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection.h
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_internal.h
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_ops.h
@@ -179,6 +181,7 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_comparator.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/field_mask_util.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/constants.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/datapiece.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/default_value_objectwriter.h
${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/error_listener.h
@@ -524,6 +527,20 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/plugin_proto-descriptor-set.proto.bin
)
+# //pkg:common_test
+set(common_test_srcs
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.cc
+)
+
+# //pkg:common_test
+set(common_test_hdrs
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.h
+)
+
# //pkg:lite_test_util
set(lite_test_util_srcs
${protobuf_SOURCE_DIR}/src/google/protobuf/arena_test_util.cc
@@ -542,12 +559,17 @@
# //pkg:test_util
set(test_util_srcs
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_tester.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/test_util.cc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.cc
)
# //pkg:test_util
set(test_util_hdrs
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/unittest.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/unittest.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test.inc
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test_util.h
${protobuf_SOURCE_DIR}/src/google/protobuf/map_test_util.inc
@@ -555,7 +577,11 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/reflection_tester.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_util.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_util.inc
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/test_util2.h
${protobuf_SOURCE_DIR}/src/google/protobuf/test_util_lite.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/expecting_objectwriter.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/mock_error_listener.h
+ ${protobuf_SOURCE_DIR}/src/google/protobuf/util/internal/type_info_test_helper.h
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.inc
)
@@ -590,8 +616,8 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/wire_format_unittest.cc
)
-# //src/google/protobuf:test_protos
-set(protobuf_test_protos_proto_srcs
+# //src/google/protobuf:test_proto_srcs
+set(protobuf_test_protos_files
${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/map_proto2_unittest.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/map_unittest.proto
@@ -623,112 +649,20 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_well_known_types.proto
)
-# //src/google/protobuf:test_protos
-set(protobuf_test_protos_srcs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/map_proto2_unittest.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/map_unittest.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_arena.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_custom_options.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_drop_unknown_fields.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_embed_optimize_for.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_empty.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_enormous_descriptor.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_enum.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite_imports_nonlite.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset_wire_format.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_field_presence.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_generic_services.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_optimize_for.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum2.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena_lite.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_lite.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_optional.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_well_known_types.proto.pb.cc
-)
-
-# //src/google/protobuf:test_protos
-set(protobuf_test_protos_hdrs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/any_test.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/map_proto2_unittest.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/map_unittest.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_arena.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_custom_options.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_drop_unknown_fields.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_embed_optimize_for.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_empty.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_enormous_descriptor.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_custom_option.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lazy_dependencies_enum.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite_imports_nonlite.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_mset_wire_format.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_field_presence.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_no_generic_services.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_optimize_for.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_preserve_unknown_enum2.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_arena_lite.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_lite.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_proto3_optional.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_well_known_types.proto.pb.h
-)
-
-# //src/google/protobuf:test_protos
-set(protobuf_test_protos_files
- ${protobuf_SOURCE_DIR}/src/google/protobuf/test_protos-descriptor-set.proto.bin
-)
-
# //src/google/protobuf:lite_test_srcs
set(protobuf_lite_test_files
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_arena_unittest.cc
${protobuf_SOURCE_DIR}/src/google/protobuf/lite_unittest.cc
)
-# //src/google/protobuf:lite_test_protos
-set(protobuf_lite_test_protos_proto_srcs
+# //src/google/protobuf:lite_test_proto_srcs
+set(protobuf_lite_test_protos_files
${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_unittest.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_lite.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public_lite.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto
)
-# //src/google/protobuf:lite_test_protos
-set(protobuf_lite_test_protos_srcs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_unittest.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_lite.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public_lite.proto.pb.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto.pb.cc
-)
-
-# //src/google/protobuf:lite_test_protos
-set(protobuf_lite_test_protos_hdrs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/map_lite_unittest.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_lite.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_import_public_lite.proto.pb.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/unittest_lite.proto.pb.h
-)
-
-# //src/google/protobuf:lite_test_protos
-set(protobuf_lite_test_protos_files
- ${protobuf_SOURCE_DIR}/src/google/protobuf/lite_test_protos-descriptor-set.proto.bin
-)
-
# //src/google/protobuf/compiler:test_srcs
set(compiler_test_files
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -750,26 +684,6 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc
)
-# //pkg:compiler_annotation_test_util
-set(annotation_test_util_srcs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.cc
-)
-
-# //pkg:compiler_annotation_test_util
-set(annotation_test_util_hdrs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/annotation_test_util.h
-)
-
-# //pkg:compiler_mock_code_generator
-set(mock_code_generator_srcs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.cc
-)
-
-# //pkg:compiler_mock_code_generator
-set(mock_code_generator_hdrs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/mock_code_generator.h
-)
-
# //src/google/protobuf/compiler:test_proto_srcs
set(compiler_test_protos_files
${protobuf_SOURCE_DIR}/src/google/protobuf/compiler/cpp/test_bad_identifiers.proto
@@ -792,18 +706,6 @@
${protobuf_SOURCE_DIR}/src/google/protobuf/io/zero_copy_stream_unittest.cc
)
-# //pkg:testinglib
-set(testing_srcs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.cc
- ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.cc
-)
-
-# //pkg:testinglib
-set(testing_hdrs
- ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/file.h
- ${protobuf_SOURCE_DIR}/src/google/protobuf/testing/googletest.h
-)
-
# //src/google/protobuf/util:test_srcs
set(util_test_files
${protobuf_SOURCE_DIR}/src/google/protobuf/util/delimited_message_util_test.cc
diff --git a/src/google/protobuf/BUILD.bazel b/src/google/protobuf/BUILD.bazel
index 91aaab9..8eaa011 100644
--- a/src/google/protobuf/BUILD.bazel
+++ b/src/google/protobuf/BUILD.bazel
@@ -392,14 +392,20 @@
],
)
-proto_library(
- name = "lite_test_protos",
+filegroup(
+ name = "lite_test_proto_srcs",
srcs = [
"map_lite_unittest.proto",
"unittest_import_lite.proto",
"unittest_import_public_lite.proto",
"unittest_lite.proto",
],
+ visibility = ["//:__subpackages__"],
+)
+
+proto_library(
+ name = "lite_test_protos",
+ srcs = [":lite_test_proto_srcs"],
strip_import_prefix = "/src",
visibility = ["//:__subpackages__"],
deps = [
diff --git a/src/google/protobuf/compiler/cpp/BUILD.bazel b/src/google/protobuf/compiler/cpp/BUILD.bazel
index bf95ffe..4463a09 100644
--- a/src/google/protobuf/compiler/cpp/BUILD.bazel
+++ b/src/google/protobuf/compiler/cpp/BUILD.bazel
@@ -98,6 +98,7 @@
"unittest.inc",
],
strip_include_prefix = "/src",
+ visibility = ["//pkg:__pkg__"],
)
cc_test(
diff --git a/src/google/protobuf/compiler/cpp/message_size_unittest.cc b/src/google/protobuf/compiler/cpp/message_size_unittest.cc
index a75d77a..ed4a90e 100644
--- a/src/google/protobuf/compiler/cpp/message_size_unittest.cc
+++ b/src/google/protobuf/compiler/cpp/message_size_unittest.cc
@@ -139,9 +139,9 @@
TEST(GeneratedMessageTest, MoreStringSize) {
struct MockGenerated : public MockMessageBase { // 16 bytes
- int has_bits[1]; // 4 bytes
int cached_size; // 4 bytes
MockRepeatedPtrField data; // 24 bytes
+ // + 4 bytes padding
};
GOOGLE_CHECK_MESSAGE_SIZE(MockGenerated, 48);
EXPECT_EQ(sizeof(protobuf_unittest::MoreString), sizeof(MockGenerated));
diff --git a/src/google/protobuf/compiler/java/enum_field.cc b/src/google/protobuf/compiler/java/enum_field.cc
index ea74d8b..ab799f0 100644
--- a/src/google/protobuf/compiler/java/enum_field.cc
+++ b/src/google/protobuf/compiler/java/enum_field.cc
@@ -276,7 +276,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ var $kt_name$: $kt_type$\n"
+ "$kt_deprecation$public 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"
@@ -299,7 +299,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -308,7 +308,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
@@ -1085,12 +1085,12 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -1103,7 +1103,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1115,7 +1115,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
@@ -1126,7 +1126,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1139,7 +1139,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1151,7 +1151,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1162,7 +1162,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/enum_field_lite.cc b/src/google/protobuf/compiler/java/enum_field_lite.cc
index 713f805..c221a33 100644
--- a/src/google/protobuf/compiler/java/enum_field_lite.cc
+++ b/src/google/protobuf/compiler/java/enum_field_lite.cc
@@ -311,7 +311,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ "$kt_deprecation$public 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"
@@ -334,7 +334,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -343,7 +343,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
@@ -870,12 +870,12 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -888,7 +888,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -900,7 +900,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
@@ -911,7 +911,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -924,7 +924,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -936,7 +936,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -947,7 +947,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/map_field.cc b/src/google/protobuf/compiler/java/map_field.cc
index 66d7fbb..0a59a32 100644
--- a/src/google/protobuf/compiler/java/map_field.cc
+++ b/src/google/protobuf/compiler/java/map_field.cc
@@ -727,13 +727,13 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(
variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -746,7 +746,7 @@
printer->Print(
variables_,
"@JvmName(\"put$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -758,7 +758,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"set$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -769,7 +769,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"remove$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -780,7 +780,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"putAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -792,7 +792,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
diff --git a/src/google/protobuf/compiler/java/map_field_lite.cc b/src/google/protobuf/compiler/java/map_field_lite.cc
index e116d1e..471bbda 100644
--- a/src/google/protobuf/compiler/java/map_field_lite.cc
+++ b/src/google/protobuf/compiler/java/map_field_lite.cc
@@ -871,13 +871,13 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(
variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslMap"
"<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -890,7 +890,7 @@
printer->Print(
variables_,
"@JvmName(\"put$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -902,7 +902,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"set$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -913,7 +913,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"remove$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -924,7 +924,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"putAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
@@ -936,7 +936,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslMap"
+ "public 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"
diff --git a/src/google/protobuf/compiler/java/message.cc b/src/google/protobuf/compiler/java/message.cc
index 52768bb..af64911 100644
--- a/src/google/protobuf/compiler/java/message.cc
+++ b/src/google/protobuf/compiler/java/message.cc
@@ -1409,10 +1409,10 @@
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"@com.google.protobuf.kotlin.ProtoDslMarker\n");
printer->Print(
- "class Dsl private constructor(\n"
+ "public class Dsl private constructor(\n"
" private val _builder: $message$.Builder\n"
") {\n"
- " companion object {\n"
+ " public companion object {\n"
" @kotlin.jvm.JvmSynthetic\n"
" @kotlin.PublishedApi\n"
" internal fun _create(builder: $message$.Builder): Dsl = "
@@ -1435,10 +1435,10 @@
for (auto oneof : oneofs_) {
printer->Print(
- "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
+ "public 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"
+ "public fun clear$oneof_capitalized_name$() {\n"
" _builder.clear$oneof_capitalized_name$()\n"
"}\n",
"oneof_name", context_->GetOneofGeneratorInfo(oneof)->name,
@@ -1466,7 +1466,7 @@
}
printer->Print(
- "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> "
+ "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> "
"kotlin.Unit): "
"$message$ "
"=\n"
@@ -1480,7 +1480,7 @@
EscapeKotlinKeywords(name_resolver_->GetClassName(descriptor_, true)));
WriteMessageDocComment(printer, descriptor_, /* kdoc */ true);
- printer->Print("object $name$Kt {\n", "name", descriptor_->name());
+ printer->Print("public object $name$Kt {\n", "name", descriptor_->name());
printer->Indent();
GenerateKotlinDsl(printer);
for (int i = 0; i < descriptor_->nested_type_count(); i++) {
@@ -1501,7 +1501,7 @@
}
printer->Print(
- "inline fun $message$.copy(block: $message_kt$.Dsl.() -> "
+ "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> "
"kotlin.Unit): $message$ =\n"
" $message_kt$.Dsl._create(this.toBuilder()).apply { block() "
"}._build()\n\n",
@@ -1546,7 +1546,7 @@
printer->Print(
"@Suppress(\"UNCHECKED_CAST\")\n"
"@kotlin.jvm.JvmSynthetic\n"
- "operator fun <T : kotlin.Any> get(extension: "
+ "public operator fun <T : kotlin.Any> get(extension: "
"com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
" return if (extension.isRepeated) {\n"
" get(extension as com.google.protobuf.ExtensionLite<$message$, "
@@ -1562,7 +1562,7 @@
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
- "operator fun <E : kotlin.Any> get(\n"
+ "public operator fun <E : kotlin.Any> 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, "
@@ -1572,7 +1572,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "operator fun contains(extension: "
+ "public operator fun contains(extension: "
"com.google.protobuf.ExtensionLite<$message$, *>): "
"Boolean {\n"
" return _builder.hasExtension(extension)\n"
@@ -1581,7 +1581,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "fun clear(extension: "
+ "public fun clear(extension: "
"com.google.protobuf.ExtensionLite<$message$, *>) "
"{\n"
" _builder.clearExtension(extension)\n"
@@ -1601,7 +1601,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <T : Comparable<T>> set(\n"
+ "public inline operator fun <T : Comparable<T>> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
") {\n"
@@ -1612,7 +1612,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun set(\n"
+ "public inline operator fun set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, "
"com.google.protobuf.ByteString>,\n"
" value: com.google.protobuf.ByteString\n"
@@ -1624,7 +1624,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
+ "public inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
") {\n"
@@ -1634,7 +1634,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "fun <E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
+ "public fun <E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.add(value: E) {\n"
" _builder.addExtension(this.extension, value)\n"
"}\n\n",
@@ -1643,7 +1643,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <E : kotlin.Any> "
+ "public inline operator fun <E : kotlin.Any> "
"com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign"
"(value: E) {\n"
@@ -1653,7 +1653,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "fun <E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
+ "public fun <E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.addAll(values: Iterable<E>) {\n"
" for (value in values) {\n"
" add(value)\n"
@@ -1664,7 +1664,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <E : kotlin.Any> "
+ "public inline operator fun <E : kotlin.Any> "
"com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign(values: "
"Iterable<E>) {\n"
@@ -1674,7 +1674,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "operator fun <E : kotlin.Any> "
+ "public operator fun <E : kotlin.Any> "
"com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.set(index: Int, value: "
"E) {\n"
@@ -1685,7 +1685,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline fun com.google.protobuf.kotlin.ExtensionList<*, "
+ "public inline fun com.google.protobuf.kotlin.ExtensionList<*, "
"$message$>.clear() {\n"
" clear(extension)\n"
"}\n\n",
diff --git a/src/google/protobuf/compiler/java/message_field.cc b/src/google/protobuf/compiler/java/message_field.cc
index 32da1b7..c51c71a 100644
--- a/src/google/protobuf/compiler/java/message_field.cc
+++ b/src/google/protobuf/compiler/java/message_field.cc
@@ -426,7 +426,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ "$kt_deprecation$public 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"
@@ -437,7 +437,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -445,7 +445,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
@@ -455,7 +455,7 @@
void ImmutableMessageFieldGenerator::GenerateKotlinOrNull(io::Printer* printer) const {
if (descriptor_->has_optional_keyword()) {
printer->Print(variables_,
- "val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n"
+ "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n"
" get() = $kt_dsl_builder$.$name$OrNull\n");
}
}
@@ -1425,12 +1425,12 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -1443,7 +1443,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1455,7 +1455,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
@@ -1466,7 +1466,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1479,7 +1479,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1491,7 +1491,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1502,7 +1502,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/message_field_lite.cc b/src/google/protobuf/compiler/java/message_field_lite.cc
index ad685eb..5a05939 100644
--- a/src/google/protobuf/compiler/java/message_field_lite.cc
+++ b/src/google/protobuf/compiler/java/message_field_lite.cc
@@ -293,7 +293,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ "$kt_deprecation$public 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"
@@ -304,7 +304,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -312,7 +312,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
GenerateKotlinOrNull(printer);
@@ -321,7 +321,7 @@
void ImmutableMessageFieldLiteGenerator::GenerateKotlinOrNull(io::Printer* printer) const {
if (descriptor_->has_optional_keyword()) {
printer->Print(variables_,
- "val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n"
+ "public val $classname$Kt.Dsl.$name$OrNull: $kt_type$?\n"
" get() = $kt_dsl_builder$.$name$OrNull\n");
}
}
@@ -819,12 +819,12 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -837,7 +837,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -849,7 +849,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
@@ -860,7 +860,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -873,7 +873,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -885,7 +885,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -896,7 +896,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/message_lite.cc b/src/google/protobuf/compiler/java/message_lite.cc
index fc98ef5..504e072 100644
--- a/src/google/protobuf/compiler/java/message_lite.cc
+++ b/src/google/protobuf/compiler/java/message_lite.cc
@@ -746,10 +746,10 @@
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"@com.google.protobuf.kotlin.ProtoDslMarker\n");
printer->Print(
- "class Dsl private constructor(\n"
+ "public class Dsl private constructor(\n"
" private val _builder: $message$.Builder\n"
") {\n"
- " companion object {\n"
+ " public companion object {\n"
" @kotlin.jvm.JvmSynthetic\n"
" @kotlin.PublishedApi\n"
" internal fun _create(builder: $message$.Builder): Dsl = "
@@ -772,10 +772,10 @@
for (auto oneof : oneofs_) {
printer->Print(
- "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
+ "public 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"
+ "public fun clear$oneof_capitalized_name$() {\n"
" _builder.clear$oneof_capitalized_name$()\n"
"}\n",
"oneof_name", context_->GetOneofGeneratorInfo(oneof)->name,
@@ -802,7 +802,7 @@
printer->Print("@com.google.errorprone.annotations.CheckReturnValue\n");
}
printer->Print(
- "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> "
+ "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> "
"kotlin.Unit): $message$ =\n"
" $message_kt$.Dsl._create($message$.newBuilder()).apply { block() "
"}._build()\n",
@@ -814,7 +814,7 @@
EscapeKotlinKeywords(name_resolver_->GetClassName(descriptor_, true)));
WriteMessageDocComment(printer, descriptor_, /* kdoc */ true);
- printer->Print("object $name$Kt {\n", "name", descriptor_->name());
+ printer->Print("public object $name$Kt {\n", "name", descriptor_->name());
printer->Indent();
GenerateKotlinDsl(printer);
for (int i = 0; i < descriptor_->nested_type_count(); i++) {
@@ -832,7 +832,7 @@
printer->Print("@com.google.errorprone.annotations.CheckReturnValue\n");
}
printer->Print(
- "inline fun $message$.copy(block: $message_kt$.Dsl.() -> "
+ "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> "
"kotlin.Unit): $message$ =\n"
" $message_kt$.Dsl._create(this.toBuilder()).apply { block() "
"}._build()\n\n",
@@ -879,7 +879,7 @@
printer->Print(
"@Suppress(\"UNCHECKED_CAST\")\n"
"@kotlin.jvm.JvmSynthetic\n"
- "operator fun <T : kotlin.Any> get(extension: "
+ "public operator fun <T : kotlin.Any> get(extension: "
"com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
" return if (extension.isRepeated) {\n"
" get(extension as com.google.protobuf.ExtensionLite<$message$, "
@@ -895,7 +895,7 @@
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
"@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
- "operator fun <E : kotlin.Any> get(\n"
+ "public operator fun <E : kotlin.Any> 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, "
@@ -905,7 +905,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "operator fun contains(extension: "
+ "public operator fun contains(extension: "
"com.google.protobuf.ExtensionLite<$message$, *>): "
"Boolean {\n"
" return _builder.hasExtension(extension)\n"
@@ -914,7 +914,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "fun clear(extension: "
+ "public fun clear(extension: "
"com.google.protobuf.ExtensionLite<$message$, *>) "
"{\n"
" _builder.clearExtension(extension)\n"
@@ -934,7 +934,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <T : Comparable<T>> set(\n"
+ "public inline operator fun <T : Comparable<T>> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
") {\n"
@@ -945,7 +945,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun set(\n"
+ "public inline operator fun set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, "
"com.google.protobuf.ByteString>,\n"
" value: com.google.protobuf.ByteString\n"
@@ -957,7 +957,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
+ "public inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
" extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
" value: T\n"
") {\n"
@@ -967,7 +967,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "fun<E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
+ "public fun<E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.add(value: E) {\n"
" _builder.addExtension(this.extension, value)\n"
"}\n\n",
@@ -976,7 +976,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <E : kotlin.Any> "
+ "public inline operator fun <E : kotlin.Any> "
"com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign"
"(value: E) {\n"
@@ -986,7 +986,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "fun<E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
+ "public fun<E : kotlin.Any> com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.addAll(values: Iterable<E>) {\n"
" for (value in values) {\n"
" add(value)\n"
@@ -997,7 +997,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun <E : kotlin.Any> "
+ "public inline operator fun <E : kotlin.Any> "
"com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.plusAssign(values: "
"Iterable<E>) {\n"
@@ -1007,7 +1007,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
- "operator fun <E : kotlin.Any> "
+ "public operator fun <E : kotlin.Any> "
"com.google.protobuf.kotlin.ExtensionList<E, "
"$message$>.set(index: Int, value: "
"E) {\n"
@@ -1018,7 +1018,7 @@
printer->Print(
"@kotlin.jvm.JvmSynthetic\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline fun com.google.protobuf.kotlin.ExtensionList<*, "
+ "public inline fun com.google.protobuf.kotlin.ExtensionList<*, "
"$message$>.clear() {\n"
" clear(extension)\n"
"}\n\n",
diff --git a/src/google/protobuf/compiler/java/primitive_field.cc b/src/google/protobuf/compiler/java/primitive_field.cc
index 3706ef1..aae9b32 100644
--- a/src/google/protobuf/compiler/java/primitive_field.cc
+++ b/src/google/protobuf/compiler/java/primitive_field.cc
@@ -324,7 +324,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ "$kt_deprecation$public 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"
@@ -335,7 +335,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -344,7 +344,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
@@ -854,12 +854,12 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -872,7 +872,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -884,7 +884,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
@@ -895,7 +895,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -908,7 +908,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -920,7 +920,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -931,7 +931,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/primitive_field_lite.cc b/src/google/protobuf/compiler/java/primitive_field_lite.cc
index 28066bb..b7ff891 100644
--- a/src/google/protobuf/compiler/java/primitive_field_lite.cc
+++ b/src/google/protobuf/compiler/java/primitive_field_lite.cc
@@ -344,7 +344,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: $kt_type$\n"
+ "$kt_deprecation$public 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"
@@ -355,7 +355,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -364,7 +364,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
@@ -691,12 +691,12 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
WriteFieldDocComment(printer, descriptor_);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$ public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -709,7 +709,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -721,7 +721,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: $kt_type$) {\n"
" add(value)\n"
@@ -732,7 +732,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -745,7 +745,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -757,7 +757,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -768,7 +768,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/string_field.cc b/src/google/protobuf/compiler/java/string_field.cc
index d8b5d4e..a40d473 100644
--- a/src/google/protobuf/compiler/java/string_field.cc
+++ b/src/google/protobuf/compiler/java/string_field.cc
@@ -383,7 +383,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: kotlin.String\n"
+ "$kt_deprecation$public 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"
@@ -394,7 +394,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -403,7 +403,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
@@ -968,14 +968,14 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
// property for List<String>
WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
" @kotlin.jvm.JvmSynthetic\n"
@@ -989,7 +989,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1002,7 +1002,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: kotlin.String) {\n"
" add(value)\n"
@@ -1015,7 +1015,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1029,7 +1029,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1042,7 +1042,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -1053,7 +1053,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/string_field_lite.cc b/src/google/protobuf/compiler/java/string_field_lite.cc
index 2551d39..73e8499 100644
--- a/src/google/protobuf/compiler/java/string_field_lite.cc
+++ b/src/google/protobuf/compiler/java/string_field_lite.cc
@@ -342,7 +342,7 @@
io::Printer* printer) const {
WriteFieldDocComment(printer, descriptor_, /* kdoc */ true);
printer->Print(variables_,
- "$kt_deprecation$var $kt_name$: kotlin.String\n"
+ "$kt_deprecation$public 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"
@@ -353,7 +353,7 @@
WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
/* builder */ false, /* kdoc */ true);
printer->Print(variables_,
- "fun ${$clear$kt_capitalized_name$$}$() {\n"
+ "public fun ${$clear$kt_capitalized_name$$}$() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
"}\n");
@@ -362,7 +362,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+ "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
" return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
"}\n");
}
@@ -788,7 +788,7 @@
" */\n"
"@kotlin.OptIn"
"(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
- "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+ "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
" : com.google.protobuf.kotlin.DslProxy()\n");
// property for List<String>
@@ -796,7 +796,7 @@
/* builder */ false, /* kdoc */ true);
printer->Print(
variables_,
- "$kt_deprecation$ val $kt_name$: "
+ "$kt_deprecation$public val $kt_name$: "
"com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
"@kotlin.OptIn"
@@ -811,7 +811,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -824,7 +824,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public inline operator fun com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
"plusAssign(value: kotlin.String) {\n"
" add(value)\n"
@@ -837,7 +837,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -851,7 +851,7 @@
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
"@Suppress(\"NOTHING_TO_INLINE\")\n"
- "inline operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -864,7 +864,7 @@
variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
- "operator fun com.google.protobuf.kotlin.DslList"
+ "public 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"
@@ -875,7 +875,7 @@
printer->Print(variables_,
"@kotlin.jvm.JvmSynthetic\n"
"@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
- "fun com.google.protobuf.kotlin.DslList"
+ "public fun com.google.protobuf.kotlin.DslList"
"<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
"clear() {\n"
" $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
index c97c9fe..8102df2 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
@@ -36,6 +36,7 @@
#include "google/protobuf/compiler/objectivec/objectivec_helpers.h"
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/io/printer.h"
+#include "google/protobuf/stubs/strutil.h"
namespace google {
namespace protobuf {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
index 84910ff..496786e 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
@@ -38,6 +38,7 @@
#include "absl/strings/str_cat.h"
#include "google/protobuf/compiler/objectivec/objectivec_enum.h"
#include "google/protobuf/compiler/objectivec/objectivec_extension.h"
+#include "google/protobuf/compiler/objectivec/objectivec_file.h"
#include "google/protobuf/compiler/objectivec/objectivec_helpers.h"
#include "google/protobuf/compiler/objectivec/objectivec_message.h"
#include "google/protobuf/io/printer.h"
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
index e5f2fb3..ec4071b 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
@@ -39,6 +39,7 @@
#include "absl/strings/str_split.h"
#include "absl/strings/strip.h"
#include "google/protobuf/compiler/objectivec/objectivec_file.h"
+#include "google/protobuf/compiler/objectivec/objectivec_generator.h"
#include "google/protobuf/compiler/objectivec/objectivec_helpers.h"
#include "google/protobuf/io/printer.h"
#include "google/protobuf/io/zero_copy_stream.h"
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index 17e3f4b..a9404ca 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -516,7 +516,8 @@
}
bool IsSpecialNamePrefix(const std::string& name,
- const std::string* special_names, size_t count) {
+ const std::string* special_names,
+ size_t count) {
for (size_t i = 0; i < count; ++i) {
const size_t length = special_names[i].length();
if (name.compare(0, length, special_names[i]) == 0) {
@@ -591,8 +592,8 @@
// http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
static const std::string retained_names[] = {"new", "alloc", "copy",
"mutableCopy"};
- return IsSpecialNamePrefix(
- name, retained_names, sizeof(retained_names) / sizeof(retained_names[0]));
+ return IsSpecialNamePrefix(name, retained_names,
+ sizeof(retained_names) / sizeof(retained_names[0]));
}
bool IsInitName(const std::string& name) {
diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc
index 4cae1a1..228e011 100644
--- a/src/google/protobuf/compiler/parser.cc
+++ b/src/google/protobuf/compiler/parser.cc
@@ -288,6 +288,16 @@
}
}
+bool Parser::TryConsumeInteger64(uint64_t max_value, uint64_t* output) {
+ if (LookingAtType(io::Tokenizer::TYPE_INTEGER) &&
+ io::Tokenizer::ParseInteger(input_->current().text, max_value,
+ output)) {
+ input_->Next();
+ return true;
+ }
+ return false;
+}
+
bool Parser::ConsumeNumber(double* output, const char* error) {
if (LookingAtType(io::Tokenizer::TYPE_FLOAT)) {
*output = io::Tokenizer::ParseFloat(input_->current().text);
@@ -296,13 +306,19 @@
} else if (LookingAtType(io::Tokenizer::TYPE_INTEGER)) {
// Also accept integers.
uint64_t value = 0;
- if (!io::Tokenizer::ParseInteger(input_->current().text,
+ if (io::Tokenizer::ParseInteger(input_->current().text,
std::numeric_limits<uint64_t>::max(),
&value)) {
+ *output = value;
+ } else if (input_->current().text[0] == '0') {
+ // octal or hexadecimal; don't bother parsing as float
+ AddError("Integer out of range.");
+ // We still return true because we did, in fact, parse a number.
+ } else if (!io::Tokenizer::TryParseFloat(input_->current().text, output)) {
+ // out of int range, and not valid float? 🤷
AddError("Integer out of range.");
// We still return true because we did, in fact, parse a number.
}
- *output = value;
input_->Next();
return true;
} else if (LookingAt("inf")) {
@@ -411,6 +427,11 @@
}
Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
+ SourceCodeInfo* source_code_info) {
+ Init(parent, source_code_info);
+}
+
+Parser::LocationRecorder::LocationRecorder(const LocationRecorder& parent,
int path1,
SourceCodeInfo* source_code_info) {
Init(parent, source_code_info);
@@ -1239,13 +1260,22 @@
field->clear_default_value();
}
+ LocationRecorder location(field_location,
+ FieldDescriptorProto::kDefaultValueFieldNumber);
+
DO(Consume("default"));
DO(Consume("="));
- LocationRecorder location(field_location,
- FieldDescriptorProto::kDefaultValueFieldNumber);
- location.RecordLegacyLocation(field,
- DescriptorPool::ErrorCollector::DEFAULT_VALUE);
+ // We don't need to create separate spans in source code info for name and value,
+ // since there's no way to represent them distinctly in a location path. But we will
+ // want a separate recorder for the value, just to have more precise location info
+ // in error messages. So we let it create a location in no_op, so it doesn't add a
+ // span to the file descriptor.
+ SourceCodeInfo no_op;
+ LocationRecorder value_location(location, &no_op);
+ value_location.RecordLegacyLocation(
+ field, DescriptorPool::ErrorCollector::DEFAULT_VALUE);
+
std::string* default_value = field->mutable_default_value();
if (!field->has_type()) {
@@ -1379,13 +1409,23 @@
LocationRecorder location(field_location,
FieldDescriptorProto::kJsonNameFieldNumber);
- location.RecordLegacyLocation(field,
- DescriptorPool::ErrorCollector::OPTION_NAME);
- DO(Consume("json_name"));
+ // We don't need to create separate spans in source code info for name and value,
+ // since there's no way to represent them distinctly in a location path. But we will
+ // want a separate recorder for them, just to have more precise location info
+ // in error messages. So we let them create a location in no_op, so they don't
+ // add a span to the file descriptor.
+ SourceCodeInfo no_op;
+ {
+ LocationRecorder name_location(location, &no_op);
+ name_location.RecordLegacyLocation(
+ field, DescriptorPool::ErrorCollector::OPTION_NAME);
+
+ DO(Consume("json_name"));
+ }
DO(Consume("="));
- LocationRecorder value_location(location);
+ LocationRecorder value_location(location, &no_op);
value_location.RecordLegacyLocation(
field, DescriptorPool::ErrorCollector::OPTION_VALUE);
@@ -1551,18 +1591,20 @@
is_negative
? static_cast<uint64_t>(std::numeric_limits<int64_t>::max()) + 1
: std::numeric_limits<uint64_t>::max();
- DO(ConsumeInteger64(max_value, &value, "Expected integer."));
- if (is_negative) {
- value_location.AddPath(
- UninterpretedOption::kNegativeIntValueFieldNumber);
- uninterpreted_option->set_negative_int_value(
- static_cast<int64_t>(0 - value));
- } else {
- value_location.AddPath(
- UninterpretedOption::kPositiveIntValueFieldNumber);
- uninterpreted_option->set_positive_int_value(value);
+ if (TryConsumeInteger64(max_value, &value)) {
+ if (is_negative) {
+ value_location.AddPath(
+ UninterpretedOption::kNegativeIntValueFieldNumber);
+ uninterpreted_option->set_negative_int_value(
+ static_cast<int64_t>(0 - value));
+ } else {
+ value_location.AddPath(
+ UninterpretedOption::kPositiveIntValueFieldNumber);
+ uninterpreted_option->set_positive_int_value(value);
+ }
+ break;
}
- break;
+ // value too large for an integer; fall through below to treat as floating point
}
case io::Tokenizer::TYPE_FLOAT: {
diff --git a/src/google/protobuf/compiler/parser.h b/src/google/protobuf/compiler/parser.h
index ccd3e5a..a195514 100644
--- a/src/google/protobuf/compiler/parser.h
+++ b/src/google/protobuf/compiler/parser.h
@@ -180,6 +180,9 @@
// is greater than max_value, an error will be reported.
bool ConsumeInteger64(uint64_t max_value, uint64_t* output,
const char* error);
+ // Try to consume a 64-bit integer and store its value in "output". No
+ // error is reported on failure, allowing caller to consume token another way.
+ bool TryConsumeInteger64(uint64_t max_value, uint64_t* output);
// Consume a number and store its value in "output". This will accept
// tokens of either INTEGER or FLOAT type.
bool ConsumeNumber(double* output, const char* error);
@@ -239,6 +242,10 @@
LocationRecorder(const LocationRecorder& parent, int path1, int path2);
// Creates a recorder that generates locations into given source code info.
+ LocationRecorder(const LocationRecorder& parent,
+ SourceCodeInfo* source_code_info);
+ // Creates a recorder that generates locations into given source code info
+ // and calls AddPath() one time.
LocationRecorder(const LocationRecorder& parent, int path1,
SourceCodeInfo* source_code_info);
diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc
index 3b32451..497bbe0 100644
--- a/src/google/protobuf/compiler/parser_unittest.cc
+++ b/src/google/protobuf/compiler/parser_unittest.cc
@@ -592,6 +592,56 @@
"}");
}
+TEST_F(ParseMessageTest, FieldOptionsSupportLargeDecimalLiteral) {
+ // decimal integer literal > uint64 max
+ ExpectParsesTo(
+ "import \"google/protobuf/descriptor.proto\";\n"
+ "extend google.protobuf.FieldOptions {\n"
+ " optional double f = 10101;\n"
+ "}\n"
+ "message TestMessage {\n"
+ " optional double a = 1 [default = 18446744073709551616];\n"
+ " optional double b = 2 [default = -18446744073709551616];\n"
+ " optional double c = 3 [(f) = 18446744073709551616];\n"
+ " optional double d = 4 [(f) = -18446744073709551616];\n"
+ "}\n",
+
+ "dependency: \"google/protobuf/descriptor.proto\""
+ "extension {"
+ " name: \"f\" label: LABEL_OPTIONAL type: TYPE_DOUBLE number: 10101"
+ " extendee: \"google.protobuf.FieldOptions\""
+ "}"
+ "message_type {"
+ " name: \"TestMessage\""
+ " field {"
+ " name: \"a\" label: LABEL_OPTIONAL type: TYPE_DOUBLE number: 1"
+ " default_value: \"1.8446744073709552e+19\""
+ " }"
+ " field {"
+ " name: \"b\" label: LABEL_OPTIONAL type: TYPE_DOUBLE number: 2"
+ " default_value: \"-1.8446744073709552e+19\""
+ " }"
+ " field {"
+ " name: \"c\" label: LABEL_OPTIONAL type: TYPE_DOUBLE number: 3"
+ " options{"
+ " uninterpreted_option{"
+ " name{ name_part: \"f\" is_extension: true }"
+ " double_value: 1.8446744073709552e+19"
+ " }"
+ " }"
+ " }"
+ " field {"
+ " name: \"d\" label: LABEL_OPTIONAL type: TYPE_DOUBLE number: 4"
+ " options{"
+ " uninterpreted_option{"
+ " name{ name_part: \"f\" is_extension: true }"
+ " double_value: -1.8446744073709552e+19"
+ " }"
+ " }"
+ " }"
+ "}");
+}
+
TEST_F(ParseMessageTest, Oneof) {
ExpectParsesTo(
"message TestMessage {\n"
@@ -1891,6 +1941,22 @@
"2:32: Enum type \"Baz\" has no value named \"NO_SUCH_VALUE\".\n");
}
+TEST_F(ParserValidationErrorTest, FieldDefaultIntegerOutOfRange) {
+ ExpectHasErrors(
+ "message Foo {\n"
+ " optional double bar = 1 [default = 0x10000000000000000];\n"
+ "}\n",
+ "1:37: Integer out of range.\n");
+}
+
+TEST_F(ParserValidationErrorTest, FieldOptionOutOfRange) {
+ ExpectHasErrors(
+ "message Foo {\n"
+ " optional double bar = 1 [foo = 0x10000000000000000];\n"
+ "}\n",
+ "1:33: Integer out of range.\n");
+}
+
TEST_F(ParserValidationErrorTest, FileOptionNameError) {
ExpectHasValidationErrors(
"option foo = 5;",
@@ -3415,18 +3481,19 @@
EXPECT_TRUE(
Parse("message Foo {"
" optional int32 bar = 1 "
- "$a$[default=$b$123$c$,$d$opt1=123$e$,"
- "$f$opt2='hi'$g$]$h$;"
+ "$a$[$b$default=123$c$, $d$opt1=123$e$, "
+ "$f$opt2='hi'$g$, $h$json_name='barBar'$i$]$j$;"
"}\n"));
const FieldDescriptorProto& field = file_.message_type(0).field(0);
const UninterpretedOption& option1 = field.options().uninterpreted_option(0);
const UninterpretedOption& option2 = field.options().uninterpreted_option(1);
- EXPECT_TRUE(HasSpan('a', 'h', field.options()));
+ EXPECT_TRUE(HasSpan('a', 'j', field.options()));
EXPECT_TRUE(HasSpan('b', 'c', field, "default_value"));
EXPECT_TRUE(HasSpan('d', 'e', option1));
EXPECT_TRUE(HasSpan('f', 'g', option2));
+ EXPECT_TRUE(HasSpan('h', 'i', field, "json_name"));
// Ignore these.
EXPECT_TRUE(HasSpan(file_));
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index b4489e5..9b8dd81 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -10,10 +10,15 @@
#include "google/protobuf/port_def.inc"
#if PROTOBUF_VERSION < 3021000
-#error "This file was generated by a newer version of protoc which is"
-#error "incompatible with your Protocol Buffer headers. Please update"
-#error "your headers."
-#endif // PROTOBUF_VERSION
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please update
+#error your headers.
+#endif
+#if 3021006 < PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please
+#error regenerate this file with a newer version of protoc.
+#endif
#if 3021005 < PROTOBUF_MIN_PROTOC_VERSION
#error "This file was generated by an older version of protoc which is"
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index f61eb22..9048cc6 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -58,6 +58,7 @@
#include "absl/strings/ascii.h"
#include "absl/strings/escaping.h"
#include "absl/strings/str_cat.h"
+#include "absl/strings/str_format.h"
#include "google/protobuf/stubs/stringprintf.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_split.h"
@@ -7683,6 +7684,27 @@
return true;
}
+namespace {
+// Helpers for method below
+
+template <typename T> std::string ValueOutOfRange(
+ absl::string_view type_name, absl::string_view option_name) {
+ return absl::StrFormat(
+ "Value out of range, %d to %d, for %s option \"%s\".", \
+ std::numeric_limits<T>::min(), std::numeric_limits<T>::max(),
+ type_name, option_name);
+}
+
+template <typename T> std::string ValueMustBeInt(
+ absl::string_view type_name, absl::string_view option_name) {
+ return absl::StrFormat(
+ "Value must be integer, from %d to %d, for %s option \"%s\".", \
+ std::numeric_limits<T>::min(), std::numeric_limits<T>::max(),
+ type_name, option_name);
+}
+
+} // namespace
+
bool DescriptorBuilder::OptionInterpreter::SetOptionValue(
const FieldDescriptor* option_field, UnknownFieldSet* unknown_fields) {
// We switch on the CppType to validate.
@@ -7691,8 +7713,7 @@
if (uninterpreted_option_->has_positive_int_value()) {
if (uninterpreted_option_->positive_int_value() >
static_cast<uint64_t>(std::numeric_limits<int32_t>::max())) {
- return AddValueError("Value out of range for int32 option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueOutOfRange<int32_t>("int32", option_field->full_name()));
} else {
SetInt32(option_field->number(),
uninterpreted_option_->positive_int_value(),
@@ -7701,16 +7722,14 @@
} else if (uninterpreted_option_->has_negative_int_value()) {
if (uninterpreted_option_->negative_int_value() <
static_cast<int64_t>(std::numeric_limits<int32_t>::min())) {
- return AddValueError("Value out of range for int32 option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueOutOfRange<int32_t>("int32", option_field->full_name()));
} else {
SetInt32(option_field->number(),
uninterpreted_option_->negative_int_value(),
option_field->type(), unknown_fields);
}
} else {
- return AddValueError("Value must be integer for int32 option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueMustBeInt<int32_t>("int32", option_field->full_name()));
}
break;
@@ -7718,8 +7737,7 @@
if (uninterpreted_option_->has_positive_int_value()) {
if (uninterpreted_option_->positive_int_value() >
static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
- return AddValueError("Value out of range for int64 option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueOutOfRange<int64_t>("int64", option_field->full_name()));
} else {
SetInt64(option_field->number(),
uninterpreted_option_->positive_int_value(),
@@ -7730,8 +7748,7 @@
uninterpreted_option_->negative_int_value(),
option_field->type(), unknown_fields);
} else {
- return AddValueError("Value must be integer for int64 option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueMustBeInt<int64_t>("int64", option_field->full_name()));
}
break;
@@ -7739,18 +7756,14 @@
if (uninterpreted_option_->has_positive_int_value()) {
if (uninterpreted_option_->positive_int_value() >
std::numeric_limits<uint32_t>::max()) {
- return AddValueError("Value out of range for uint32 option \"" +
- option_field->name() + "\".");
+ return AddValueError(ValueOutOfRange<uint32_t>("uint32", option_field->full_name()));
} else {
SetUInt32(option_field->number(),
uninterpreted_option_->positive_int_value(),
option_field->type(), unknown_fields);
}
} else {
- return AddValueError(
- "Value must be non-negative integer for uint32 "
- "option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueMustBeInt<uint32_t>("uint32", option_field->full_name()));
}
break;
@@ -7760,10 +7773,7 @@
uninterpreted_option_->positive_int_value(),
option_field->type(), unknown_fields);
} else {
- return AddValueError(
- "Value must be non-negative integer for uint64 "
- "option \"" +
- option_field->full_name() + "\".");
+ return AddValueError(ValueMustBeInt<uint64_t>("uint64", option_field->full_name()));
}
break;
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 9a5db1d..834e9ac 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -10,10 +10,15 @@
#include "google/protobuf/port_def.inc"
#if PROTOBUF_VERSION < 3021000
-#error "This file was generated by a newer version of protoc which is"
-#error "incompatible with your Protocol Buffer headers. Please update"
-#error "your headers."
-#endif // PROTOBUF_VERSION
+#error This file was generated by a newer version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please update
+#error your headers.
+#endif
+#if 3021006 < PROTOBUF_MIN_PROTOC_VERSION
+#error This file was generated by an older version of protoc which is
+#error incompatible with your Protocol Buffer headers. Please
+#error regenerate this file with a newer version of protoc.
+#endif
#if 3021005 < PROTOBUF_MIN_PROTOC_VERSION
#error "This file was generated by an older version of protoc which is"
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index 4659720..ef99f80 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -5624,7 +5624,7 @@
" positive_int_value: 0x80000000 } "
"}",
- "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
+ "foo.proto: foo.proto: OPTION_VALUE: Value out of range, -2147483648 to 2147483647, "
"for int32 option \"foo\".\n");
}
@@ -5641,7 +5641,7 @@
" negative_int_value: -0x80000001 } "
"}",
- "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
+ "foo.proto: foo.proto: OPTION_VALUE: Value out of range, -2147483648 to 2147483647, "
"for int32 option \"foo\".\n");
}
@@ -5657,7 +5657,7 @@
" is_extension: true } "
" string_value: \"5\" } }",
- "foo.proto: foo.proto: OPTION_VALUE: Value must be integer "
+ "foo.proto: foo.proto: OPTION_VALUE: Value must be integer, from -2147483648 to 2147483647, "
"for int32 option \"foo\".\n");
}
@@ -5675,7 +5675,7 @@
"} "
"}",
- "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
+ "foo.proto: foo.proto: OPTION_VALUE: Value out of range, -9223372036854775808 to 9223372036854775807, "
"for int64 option \"foo\".\n");
}
@@ -5691,7 +5691,7 @@
" is_extension: true } "
" identifier_value: \"5\" } }",
- "foo.proto: foo.proto: OPTION_VALUE: Value must be integer "
+ "foo.proto: foo.proto: OPTION_VALUE: Value must be integer, from -9223372036854775808 to 9223372036854775807, "
"for int64 option \"foo\".\n");
}
@@ -5707,7 +5707,7 @@
" is_extension: true } "
" positive_int_value: 0x100000000 } }",
- "foo.proto: foo.proto: OPTION_VALUE: Value out of range "
+ "foo.proto: foo.proto: OPTION_VALUE: Value out of range, 0 to 4294967295, "
"for uint32 option \"foo\".\n");
}
@@ -5723,7 +5723,7 @@
" is_extension: true } "
" double_value: -5.6 } }",
- "foo.proto: foo.proto: OPTION_VALUE: Value must be non-negative integer "
+ "foo.proto: foo.proto: OPTION_VALUE: Value must be integer, from 0 to 4294967295, "
"for uint32 option \"foo\".\n");
}
@@ -5739,7 +5739,7 @@
" is_extension: true } "
" negative_int_value: -5 } }",
- "foo.proto: foo.proto: OPTION_VALUE: Value must be non-negative integer "
+ "foo.proto: foo.proto: OPTION_VALUE: Value must be integer, from 0 to 18446744073709551615, "
"for uint64 option \"foo\".\n");
}
diff --git a/src/google/protobuf/io/tokenizer.cc b/src/google/protobuf/io/tokenizer.cc
index 7bc0820..4fcf81b 100644
--- a/src/google/protobuf/io/tokenizer.cc
+++ b/src/google/protobuf/io/tokenizer.cc
@@ -1002,9 +1002,20 @@
}
double Tokenizer::ParseFloat(const std::string& text) {
+ double result = 0;
+ if (!TryParseFloat(text, &result)) {
+ GOOGLE_LOG(DFATAL)
+ << " Tokenizer::ParseFloat() passed text that could not have been"
+ " tokenized as a float: "
+ << absl::CEscape(text);
+ }
+ return result;
+}
+
+bool Tokenizer::TryParseFloat(const std::string& text, double* result) {
const char* start = text.c_str();
char* end;
- double result = NoLocaleStrtod(start, &end);
+ *result = NoLocaleStrtod(start, &end);
// "1e" is not a valid float, but if the tokenizer reads it, it will
// report an error but still return it as a valid token. We need to
@@ -1020,12 +1031,7 @@
++end;
}
- GOOGLE_LOG_IF(DFATAL,
- static_cast<size_t>(end - start) != text.size() || *start == '-')
- << " Tokenizer::ParseFloat() passed text that could not have been"
- " tokenized as a float: "
- << absl::CEscape(text);
- return result;
+ return static_cast<size_t>(end - start) == text.size() && *start != '-';
}
// Helper to append a Unicode code point to a string as UTF8, without bringing
diff --git a/src/google/protobuf/io/tokenizer.h b/src/google/protobuf/io/tokenizer.h
index cab1faf..73877cc 100644
--- a/src/google/protobuf/io/tokenizer.h
+++ b/src/google/protobuf/io/tokenizer.h
@@ -214,6 +214,10 @@
// result is undefined (possibly an assert failure).
static double ParseFloat(const std::string& text);
+ // Parses given text as if it were a TYPE_FLOAT token. Returns false if the
+ // given text is not actually a valid float literal.
+ static bool TryParseFloat(const std::string& text, double* result);
+
// Parses a TYPE_STRING token. This never fails, so long as the text actually
// comes from a TYPE_STRING token parsed by Tokenizer. If it doesn't, the
// result is undefined (possibly an assert failure).
diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc
index d82354e..d656da5 100644
--- a/src/google/protobuf/io/zero_copy_stream_unittest.cc
+++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc
@@ -720,6 +720,9 @@
// Verifies that outputs up to kint32max can be created.
TEST_F(IoTest, LargeOutput) {
+ // Filter out this test on 32-bit architectures.
+ if(sizeof(void*) < 8) return;
+
std::string str;
StringOutputStream output(&str);
void* unused_data;
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index ac4b2b9..0d6db17 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -212,7 +212,7 @@
#ifdef PROTOBUF_VERSION
#error PROTOBUF_VERSION was previously defined
#endif
-#define PROTOBUF_VERSION 3021005
+#define PROTOBUF_VERSION 3021006
#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
index eb0b909..3baf6f2 100644
--- a/src/google/protobuf/repeated_field_unittest.cc
+++ b/src/google/protobuf/repeated_field_unittest.cc
@@ -429,14 +429,14 @@
TEST(RepeatedField, ReserveLowerClamp) {
int clamped_value = internal::CalculateReserveSize<bool, sizeof(void*)>(0, 1);
- EXPECT_GE(clamped_value, 8 / sizeof(bool));
+ EXPECT_GE(clamped_value, sizeof(void*) / sizeof(bool));
EXPECT_EQ((internal::RepeatedFieldLowerClampLimit<bool, sizeof(void*)>()),
clamped_value);
// EXPECT_EQ(clamped_value, (internal::CalculateReserveSize<bool,
// sizeof(void*)>( clamped_value, 2)));
clamped_value = internal::CalculateReserveSize<int, sizeof(void*)>(0, 1);
- EXPECT_GE(clamped_value, 8 / sizeof(int));
+ EXPECT_GE(clamped_value, sizeof(void*) / sizeof(int));
EXPECT_EQ((internal::RepeatedFieldLowerClampLimit<int, sizeof(void*)>()),
clamped_value);
// EXPECT_EQ(clamped_value, (internal::CalculateReserveSize<int,
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index 9a6190f..bdc03b0 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -81,7 +81,7 @@
// The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 3021005
+#define GOOGLE_PROTOBUF_VERSION 3021006
// A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
diff --git a/src/google/protobuf/util/time_util_test.cc b/src/google/protobuf/util/time_util_test.cc
index 464e57b..dceb6db 100644
--- a/src/google/protobuf/util/time_util_test.cc
+++ b/src/google/protobuf/util/time_util_test.cc
@@ -48,15 +48,18 @@
namespace {
TEST(TimeUtilTest, TimestampStringFormat) {
- Timestamp begin, end;
- EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
- EXPECT_EQ(TimeUtil::kTimestampMinSeconds, begin.seconds());
- EXPECT_EQ(0, begin.nanos());
- EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
- EXPECT_EQ(TimeUtil::kTimestampMaxSeconds, end.seconds());
- EXPECT_EQ(999999999, end.nanos());
- EXPECT_EQ("0001-01-01T00:00:00Z", TimeUtil::ToString(begin));
- EXPECT_EQ("9999-12-31T23:59:59.999999999Z", TimeUtil::ToString(end));
+ // These these are out of bounds for 32-bit architectures.
+ if(sizeof(time_t) >= sizeof(uint64_t)) {
+ Timestamp begin, end;
+ EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
+ EXPECT_EQ(TimeUtil::kTimestampMinSeconds, begin.seconds());
+ EXPECT_EQ(0, begin.nanos());
+ EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
+ EXPECT_EQ(TimeUtil::kTimestampMaxSeconds, end.seconds());
+ EXPECT_EQ(999999999, end.nanos());
+ EXPECT_EQ("0001-01-01T00:00:00Z", TimeUtil::ToString(begin));
+ EXPECT_EQ("9999-12-31T23:59:59.999999999Z", TimeUtil::ToString(end));
+ }
// Test negative timestamps.
Timestamp time = TimeUtil::NanosecondsToTimestamp(-1);
@@ -94,9 +97,12 @@
EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
- EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));
+ // These these are out of bounds for 32-bit architectures.
+ if(sizeof(time_t) >= sizeof(uint64_t)) {
+ EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));
+ EXPECT_EQ("-315537897599.999999999s", TimeUtil::ToString(begin - end));
+ }
EXPECT_EQ(999999999, (end - begin).nanos());
- EXPECT_EQ("-315537897599.999999999s", TimeUtil::ToString(begin - end));
EXPECT_EQ(-999999999, (begin - end).nanos());
// Generated output should contain 3, 6, or 9 fractional digits.