Merge branch 'main' into anton/7392/fix-python-test

pull/15887/head
Anton Grbin 1 year ago
commit fbcc93a232
  1. 24
      .github/BUILD.bazel
  2. 30
      .github/workflows/test_cpp.yml
  3. 17
      .github/workflows/test_objectivec.yml
  4. 4
      .github/workflows/test_upb.yml
  5. 1
      .gitignore
  6. 5
      CMakeLists.txt
  7. 6
      WORKSPACE
  8. 2
      bazel/amalgamate.py
  9. 1
      bazel/py_proto_library.bzl
  10. 1
      bazel/upb_c_proto_library.bzl
  11. 1
      bazel/upb_minitable_proto_library.bzl
  12. 1
      bazel/upb_proto_reflection_library.bzl
  13. 2
      benchmarks/BUILD.googleapis
  14. 12
      benchmarks/benchmark.cc
  15. 10
      build_defs/BUILD.bazel
  16. 1
      build_defs/cpp_opts.bzl
  17. 16
      cmake/conformance.cmake
  18. 43
      cmake/install.cmake
  19. 5
      cmake/libprotobuf-lite.cmake
  20. 5
      cmake/libprotobuf.cmake
  21. 5
      cmake/libupb.cmake
  22. 39
      cmake/tests.cmake
  23. 7
      cmake/upb_generators.cmake
  24. 6
      conformance/BUILD.bazel
  25. 85
      conformance/ConformanceJavaLite.java
  26. 16
      conformance/conformance_ruby.rb
  27. 4
      conformance/failure_list_java_lite.txt
  28. 71
      conformance/failure_list_jruby.txt
  29. 8
      conformance/text_format_failure_list_jruby.txt
  30. 8
      conformance/text_format_failure_list_ruby.txt
  31. 1201
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestFeatures.pb.cs
  32. 6
      csharp/src/Google.Protobuf.Test/Reflection/FeatureInheritanceTest.cs
  33. BIN
      csharp/src/Google.Protobuf.Test/testprotos.pb
  34. 117
      csharp/src/Google.Protobuf/JsonTokenizer.cs
  35. 60
      csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs
  36. 106
      csharp/src/Google.Protobuf/Reflection/DescriptorPool.cs
  37. 6
      csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs
  38. 2
      csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs
  39. 11
      java/core/BUILD.bazel
  40. 3
      java/core/generate-test-sources-build.xml
  41. 5
      java/core/src/main/java/com/google/protobuf/ByteString.java
  42. 1
      java/core/src/main/java/com/google/protobuf/JavaEditionDefaults.java.template
  43. 4
      java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
  44. 2
      java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
  45. 1
      java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java
  46. 2
      java/core/src/test/proto/com/google/protobuf/any_test.proto
  47. 6
      java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto
  48. 3
      java/core/src/test/proto/com/google/protobuf/dynamic_message_test.proto
  49. 6
      java/core/src/test/proto/com/google/protobuf/field_presence_test.proto
  50. 30
      java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto
  51. 36
      java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto
  52. 24
      java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto
  53. 24
      java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto
  54. 6
      java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto
  55. 19
      java/core/src/test/proto/com/google/protobuf/map_lite_test.proto
  56. 19
      java/core/src/test/proto/com/google/protobuf/map_test.proto
  57. 18
      java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto
  58. 17
      java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto
  59. 8
      java/core/src/test/proto/com/google/protobuf/nested_extension.proto
  60. 8
      java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto
  61. 9
      java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto
  62. 8
      java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto
  63. 2
      java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto
  64. 2
      java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto
  65. 8
      java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto
  66. 57
      java/core/src/test/proto/com/google/protobuf/packed_field_test.proto
  67. 384
      java/core/src/test/proto/com/google/protobuf/proto2_message.proto
  68. 376
      java/core/src/test/proto/com/google/protobuf/proto2_message_lite.proto
  69. 7
      java/core/src/test/proto/com/google/protobuf/proto2_text_format_performance_test.proto
  70. 8
      java/core/src/test/proto/com/google/protobuf/proto2_unknown_enum_values.proto
  71. 100
      java/core/src/test/proto/com/google/protobuf/proto3_message.proto
  72. 100
      java/core/src/test/proto/com/google/protobuf/proto3_message_lite.proto
  73. 4
      java/core/src/test/proto/com/google/protobuf/proto3_text_format_performance_test.proto
  74. 122
      java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
  75. 14
      java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto
  76. 14
      java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto
  77. 3
      java/core/src/test/proto/com/google/protobuf/wrappers_test.proto
  78. 8
      java/kotlin-lite/BUILD.bazel
  79. 3
      java/kotlin-lite/generate-sources-build.xml
  80. 2
      java/kotlin/BUILD.bazel
  81. 2
      java/kotlin/generate-sources-build.xml
  82. 2
      java/lite/BUILD.bazel
  83. 3
      java/lite/generate-sources-build.xml
  84. 8
      java/lite/pom.xml
  85. 2
      java/osgi/osgi.bzl
  86. 1
      java/util/pom.xml
  87. 1
      lua/lua_proto_library.bzl
  88. 213
      php/ext/google/protobuf/php-upb.c
  89. 74
      php/ext/google/protobuf/php-upb.h
  90. 1
      pkg/BUILD.bazel
  91. 1
      protobuf.bzl
  92. 1
      protos/bazel/upb_cc_proto_library.bzl
  93. 4
      protos/protos.h
  94. 1
      python/dist/dist.bzl
  95. 6
      python/google/protobuf/internal/descriptor_pool_test.py
  96. 6
      python/google/protobuf/internal/descriptor_test.py
  97. 9
      python/google/protobuf/internal/message_test.py
  98. 11
      python/google/protobuf/internal/text_format_test.py
  99. 2
      python/google/protobuf/internal/well_known_types.py
  100. 2
      python/google/protobuf/runtime_version.py
  101. Some files were not shown because too many files have changed in this diff Show More

@ -4,9 +4,25 @@
# When updating, also ensure the "xcode_destination" entries in
# `.github/workflows/test_objectivec.yml` are supported for the given versions
# of Xcode.
xcode_version(
name = "version15_2_15C500b",
aliases = [
"15C500b",
"15.2",
],
default_ios_sdk_version = "17.2",
default_macos_sdk_version = "14.2",
default_tvos_sdk_version = "17.2",
default_watchos_sdk_version = "10.2",
version = "15.2.0.15C500b",
)
xcode_version(
name = "version14_2_14C18",
aliases = ["14C18"],
aliases = [
"14C18",
"14.2",
],
default_ios_sdk_version = "16.2",
default_macos_sdk_version = "13.1",
default_tvos_sdk_version = "16.1",
@ -16,7 +32,10 @@ xcode_version(
xcode_version(
name = "version14_1_0_14B47b",
aliases = ["14B47b"],
aliases = [
"14B47b",
"14.1",
],
default_ios_sdk_version = "16.1",
default_macos_sdk_version = "13.0",
default_tvos_sdk_version = "16.1",
@ -28,6 +47,7 @@ xcode_config(
name = "host_xcodes",
default = ":version14_2_14C18",
versions = [
":version15_2_15C500b",
":version14_2_14C18",
":version14_1_0_14B47b",
],

@ -19,9 +19,9 @@ jobs:
config:
- { name: Optimized, flags: --config=opt }
- { name: Debug, flags: --config=dbg }
- { name: ASAN, flags: --config=asan, runner: ubuntu-22-large }
- { name: MSAN, flags: --config=docker-msan, runner: ubuntu-22-large }
- { name: TSAN, flags: --config=tsan }
- { name: ASAN, flags: --config=asan, runner: ubuntu-20-large }
- { name: MSAN, flags: --config=docker-msan, runner: ubuntu-20-large }
- { name: TSAN, flags: --config=tsan, runner: ubuntu-20-large }
- { name: UBSAN, flags: --config=ubsan }
- { name: No-RTTI, flags: --cxxopt=-fno-rtti }
include:
@ -108,7 +108,9 @@ jobs:
command: >
-c "set -ex;
sccache -z;
cmake . -DWITH_PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }} -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=14 -Dprotobuf_WITH_ZLIB=OFF ${{ env.SCCACHE_CMAKE_FLAGS }};
cmake . -DWITH_PROTOC=/workspace/${{ steps.cross-compile.outputs.protoc }}
-Dprotobuf_BUILD_LIBUPB=OFF -Dprotobuf_BUILD_CONFORMANCE=ON -DCMAKE_CXX_STANDARD=14
-Dprotobuf_WITH_ZLIB=OFF ${{ env.SCCACHE_CMAKE_FLAGS }};
cmake --build . --parallel 20;
ctest --parallel 20;
sccache -s"
@ -151,7 +153,7 @@ jobs:
command: >-
/test.sh ${{ matrix.flags}} ${{ env.SCCACHE_CMAKE_FLAGS }}
-Dprotobuf_BUILD_TESTS=ON -Dprotobuf_USE_EXTERNAL_GTEST=ON
-Dprotobuf_ABSL_PROVIDER=package -Dprotobuf_BUILD_LIBUPB=ON
-Dprotobuf_ABSL_PROVIDER=package
linux-cmake-install:
name: Linux CMake Install
@ -175,7 +177,9 @@ jobs:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/cmake:3.13.3-63dd26c0c7a808d92673a3e52e848189d4ab0f17
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: >-
/install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.SCCACHE_CMAKE_FLAGS }} -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package -Dprotobuf_BUILD_SHARED_LIBS=ON \&\&
/install.sh -DCMAKE_CXX_STANDARD=14 ${{ env.SCCACHE_CMAKE_FLAGS }}
-Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package
-Dprotobuf_BUILD_SHARED_LIBS=ON \&\&
/test.sh
${{ env.SCCACHE_CMAKE_FLAGS }}
-Dprotobuf_REMOVE_INSTALLED_HEADERS=ON
@ -250,7 +254,7 @@ jobs:
-c 'set -ex;
cd /workspace;
sccache -z;
cmake . -Dprotobuf_BUILD_LIBUPB=ON ${{ matrix.flags }} ${{ env.SCCACHE_CMAKE_FLAGS }};
cmake . ${{ matrix.flags }} ${{ env.SCCACHE_CMAKE_FLAGS }};
cmake --build . --parallel 20;
ctest --verbose --parallel 20;
sccache -s'
@ -278,7 +282,7 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: >-
/test.sh ${{ env.SCCACHE_CMAKE_FLAGS }}
-Dprotobuf_BUILD_CONFORMANCE=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14 -Dprotobuf_BUILD_LIBUPB=ON
-Dprotobuf_BUILD_CONFORMANCE=ON -Dprotobuf_BUILD_EXAMPLES=ON -DCMAKE_CXX_STANDARD=14
linux-cmake-32-bit:
name: Linux CMake 32-bit
@ -306,7 +310,7 @@ jobs:
/bin/bash -cex '
cd /workspace;
sccache -z;
cmake . -DCMAKE_CXX_STANDARD=14 -Dprotobuf_BUILD_LIBUPB=ON ${{ env.SCCACHE_CMAKE_FLAGS }};
cmake . -DCMAKE_CXX_STANDARD=14 ${{ env.SCCACHE_CMAKE_FLAGS }};
cmake --build . --parallel 20;
ctest --verbose --parallel 20;
sccache -s'
@ -370,7 +374,7 @@ jobs:
flags: >-
-G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF
-Dprotobuf_BUILD_SHARED_LIBS=OFF
-Dprotobuf_BUILD_EXAMPLES=ON -Dprotobuf_BUILD_LIBUPB=ON
-Dprotobuf_BUILD_EXAMPLES=ON
vsversion: '2022'
cache-prefix: windows-2022-cmake
- name: Windows CMake 2019
@ -378,7 +382,7 @@ jobs:
flags: >-
-G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF
-Dprotobuf_BUILD_SHARED_LIBS=OFF
-Dprotobuf_BUILD_EXAMPLES=ON -Dprotobuf_BUILD_LIBUPB=ON
-Dprotobuf_BUILD_EXAMPLES=ON
vsversion: '2019'
cache-prefix: windows-2019-cmake
# windows-2019 has python3.7 installed, which is incompatible with the latest gcloud
@ -386,14 +390,14 @@ jobs:
- name: Windows CMake 32-bit
os: windows-2022
flags: >-
-G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF -Dprotobuf_BUILD_LIBUPB=ON
-G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF
vsversion: '2022'
windows-arch: 'win32'
cache-prefix: windows-2022-win32-cmake
- name: Windows CMake Shared
os: windows-2022
flags: >-
-G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF -Dprotobuf_BUILD_LIBUPB=ON
-G Ninja -Dprotobuf_WITH_ZLIB=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF
-Dprotobuf_BUILD_SHARED_LIBS=ON
vsversion: '2022'
cache-prefix: windows-2022-cmake

@ -70,20 +70,25 @@ jobs:
matrix:
PLATFORM: ["ios", "macos", "tvos", "watchos"]
CONFIGURATION: ["Debug", "Release"]
name: CocoaPods ${{ matrix.PLATFORM}} ${{ matrix.CONFIGURATION}}
runs-on: macos-12
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
include:
- OS: macos-12
XCODE: "14.1"
name: CocoaPods ${{ matrix.PLATFORM }} ${{ matrix.CONFIGURATION }}
runs-on: ${{ matrix.OS }}
steps:
- name: Checkout pending changes
uses: protocolbuffers/protobuf-ci/checkout@v2
with:
ref: ${{ inputs.safe-checkout }}
- name: Xcode version
run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.XCODE }}.app
- name: Pod lib lint
uses: protocolbuffers/protobuf-ci/bash@v2
uses: protocolbuffers/protobuf-ci/bazel@v2
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: |
bazel-cache: cocoapods/${{ matrix.XCODE }}
bash: |
./regenerate_stale_files.sh $BAZEL_FLAGS --xcode_version="${{ matrix.XCODE }}"
pod lib lint --verbose \
--configuration=${{ matrix.CONFIGURATION }} \
--platforms=${{ matrix.PLATFORM }} \

@ -20,14 +20,14 @@ jobs:
- { name: "Bazel 7", bazel_version: "7.0.0" }
- { name: "Fastbuild" }
- { name: "Optimized", flags: "-c opt" }
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/..." }
- { name: "ASAN", flags: "--config=asan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/...", runner: ubuntu-20-large }
- { name: "UBSAN", flags: "--config=ubsan -c dbg", exclude-targets: "-//benchmarks:benchmark -//python/... -//lua/..." }
- { name: "32-bit", flags: "--copt=-m32 --linkopt=-m32", exclude-targets: "-//benchmarks:benchmark -//python/..." }
# TODO: Add 32-bit ASAN test
# TODO: Restore the FastTable tests
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }}
steps:
- name: Checkout pending changes

1
.gitignore vendored

@ -173,6 +173,7 @@ ruby/tests/test_import_pb.rb
ruby/tests/test_ruby_package_pb.rb
ruby/tests/generated_code_proto2_pb.rb
ruby/tests/multi_level_nesting_test_pb.rb
ruby/tests/service_test_pb.rb
ruby/tests/test_import_proto2_pb.rb
ruby/tests/test_ruby_package_proto2_pb.rb
ruby/compatibility_tests/v3.0.0/protoc

@ -31,7 +31,7 @@ option(protobuf_BUILD_EXAMPLES "Build examples" OFF)
option(protobuf_BUILD_PROTOBUF_BINARIES "Build protobuf libraries and protoc compiler" ON)
option(protobuf_BUILD_PROTOC_BINARIES "Build libprotoc and protoc compiler" ON)
option(protobuf_BUILD_LIBPROTOC "Build libprotoc" OFF)
option(protobuf_BUILD_LIBUPB "Build libupb" OFF)
option(protobuf_BUILD_LIBUPB "Build libupb" ON)
option(protobuf_DISABLE_RTTI "Remove runtime type information in the binaries" OFF)
option(protobuf_TEST_XML_OUTDIR "Output directory for XML logs from tests." "")
option(protobuf_ALLOW_CCACHE "Adjust build flags to allow for ccache support." OFF)
@ -316,10 +316,10 @@ if (protobuf_BUILD_PROTOBUF_BINARIES)
endif ()
if (protobuf_BUILD_LIBUPB)
include(${protobuf_SOURCE_DIR}/cmake/libupb.cmake)
include(${protobuf_SOURCE_DIR}/cmake/upb_generators.cmake)
if (NOT DEFINED protobuf_LIB_UPB)
set(protobuf_LIB_UPB libupb)
endif ()
include(${protobuf_SOURCE_DIR}/cmake/upb_generators.cmake)
endif ()
if (protobuf_BUILD_PROTOC_BINARIES)
include(${protobuf_SOURCE_DIR}/cmake/protoc.cmake)
@ -334,6 +334,7 @@ else ()
set(protobuf_LIB_PROTOC protobuf::libprotoc)
set(protobuf_LIB_PROTOBUF protobuf::libprotobuf)
set(protobuf_LIB_PROTOBUF_LITE protobuf::libprotobuf-lite)
set(protobuf_LIB_UPB protobuf::libupb)
message(STATUS "CMake installation of Protobuf found.")
endif ()
endif ()

@ -153,9 +153,9 @@ http_archive(
http_archive(
name = "com_google_googleapis",
urls = ["https://github.com/googleapis/googleapis/archive/30ed2662a85403cbdeb9ea38df1e414a2a276b83.zip"],
strip_prefix = "googleapis-30ed2662a85403cbdeb9ea38df1e414a2a276b83",
sha256 = "4dfc28101127d22abd6f0f6308d915d490c4594c0cfcf7643769c446d6763a46",
urls = ["https://github.com/googleapis/googleapis/archive/d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57.zip"],
strip_prefix = "googleapis-d81d0b9e6993d6ab425dff4d7c3d05fb2e59fa57",
sha256 = "d986023c3d8d2e1b161e9361366669cac9fb97c2a07e656c2548aca389248bb4",
build_file = "//benchmarks:BUILD.googleapis",
patch_cmds = ["find google -type f -name BUILD.bazel -delete"],
)

@ -54,7 +54,7 @@ class Amalgamator:
self.output_c.write('#include "%s"\n' % (self.h_out))
if self.h_out == "ruby-upb.h":
self.output_h.write("// Ruby is still using proto3 enum semantics for proto2\n")
self.output_h.write("#define UPB_DISABLE_PROTO2_ENUM_CHECKING\n")
self.output_h.write("#define UPB_DISABLE_CLOSED_ENUM_CHECKING\n")
self.output_h.write("/* Amalgamated source file */\n")

@ -128,7 +128,6 @@ _py_proto_library_aspect = aspect(
)
py_proto_library = rule(
output_to_genfiles = True,
implementation = _py_proto_library_rule_impl,
attrs = {
"deps": attr.label_list(

@ -57,7 +57,6 @@ def _upb_c_proto_library_rule_impl(ctx):
return upb_proto_rule_impl(ctx, UpbWrappedCcInfo, _UpbWrappedGeneratedSrcsInfo)
upb_c_proto_library = rule(
output_to_genfiles = True,
implementation = _upb_c_proto_library_rule_impl,
attrs = {
"deps": attr.label_list(

@ -65,7 +65,6 @@ def _upb_minitable_proto_library_rule_impl(ctx):
return upb_proto_rule_impl(ctx, UpbMinitableCcInfo, _UpbWrappedGeneratedSrcsInfo)
upb_minitable_proto_library = rule(
output_to_genfiles = True,
implementation = _upb_minitable_proto_library_rule_impl,
attrs = {
"deps": attr.label_list(

@ -55,7 +55,6 @@ def _upb_proto_reflection_library_rule_impl(ctx):
return upb_proto_rule_impl(ctx, _UpbDefsWrappedCcInfo, _WrappedDefsGeneratedSrcsInfo)
upb_proto_reflection_library = rule(
output_to_genfiles = True,
implementation = _upb_proto_reflection_library_rule_impl,
attrs = {
"deps": attr.label_list(

@ -36,7 +36,7 @@ load(
proto_library(
name = "ads_proto",
srcs = glob([
"google/ads/googleads/v13/**/*.proto",
"google/ads/googleads/v16/**/*.proto",
"google/api/**/*.proto",
"google/rpc/**/*.proto",
"google/longrunning/**/*.proto",

@ -14,7 +14,7 @@
#include <string>
#include <vector>
#include "google/ads/googleads/v13/services/google_ads_service.upbdefs.h"
#include "google/ads/googleads/v16/services/google_ads_service.upbdefs.h"
#include "google/protobuf/descriptor.pb.h"
#include "absl/container/flat_hash_set.h"
#include "absl/log/absl_check.h"
@ -181,14 +181,14 @@ static void BM_LoadAdsDescriptor_Upb(benchmark::State& state) {
for (auto _ : state) {
upb::DefPool defpool;
if (Mode == NoLayout) {
google_ads_googleads_v13_services_SearchGoogleAdsRequest_getmsgdef(
google_ads_googleads_v16_services_SearchGoogleAdsRequest_getmsgdef(
defpool.ptr());
bytes_per_iter = _upb_DefPool_BytesLoaded(defpool.ptr());
} else {
bytes_per_iter = 0;
LoadDefInit_BuildLayout(
defpool.ptr(),
&google_ads_googleads_v13_services_google_ads_service_proto_upbdefinit,
&google_ads_googleads_v16_services_google_ads_service_proto_upbdefinit,
&bytes_per_iter);
}
}
@ -200,11 +200,11 @@ BENCHMARK_TEMPLATE(BM_LoadAdsDescriptor_Upb, WithLayout);
template <LoadDescriptorMode Mode>
static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) {
extern _upb_DefPool_Init
google_ads_googleads_v13_services_google_ads_service_proto_upbdefinit;
google_ads_googleads_v16_services_google_ads_service_proto_upbdefinit;
std::vector<upb_StringView> serialized_files;
absl::flat_hash_set<const _upb_DefPool_Init*> seen_files;
CollectFileDescriptors(
&google_ads_googleads_v13_services_google_ads_service_proto_upbdefinit,
&google_ads_googleads_v16_services_google_ads_service_proto_upbdefinit,
serialized_files, seen_files);
size_t bytes_per_iter = 0;
for (auto _ : state) {
@ -227,7 +227,7 @@ static void BM_LoadAdsDescriptor_Proto2(benchmark::State& state) {
if (Mode == WithLayout) {
protobuf::DynamicMessageFactory factory;
const protobuf::Descriptor* d = pool.FindMessageTypeByName(
"google.ads.googleads.v13.services.SearchGoogleAdsResponse");
"google.ads.googleads.v16.services.SearchGoogleAdsResponse");
if (!d) {
printf("Failed to find descriptor.\n");
exit(1);

@ -35,10 +35,18 @@ config_setting(
# For more info on the various crosstool_tops used by NDK Bazel builds, see:
# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl
# When using https://bazel.build/concepts/platforms
config_setting(
name = "config_android",
constraint_values = ["@platforms//os:android"],
)
# When using legacy flags like --android_crosstool_top, --android_cpu, and --fat_apk_cpu
config_setting(
name = "config_android-legacy-default-crosstool",
values = {
"crosstool_top": "@platforms//os:android",
# Default of `--android_crosstool_top`
"crosstool_top": "//external:android/crosstool",
},
)

@ -29,6 +29,7 @@ COPTS = select({
# Android and MSVC builds do not need to link in a separate pthread library.
LINK_OPTS = select({
"//build_defs:config_android": [],
"//build_defs:config_android-legacy-default-crosstool": [],
"//build_defs:config_android-stlport": [],
"//build_defs:config_android-libcpp": [],
"//build_defs:config_android-gnu-libstdcpp": [],

@ -12,11 +12,6 @@ elseif(protobuf_JSONCPP_PROVIDER STREQUAL "package")
find_package(jsoncpp REQUIRED)
endif()
set(protoc_cpp_args)
if (protobuf_BUILD_SHARED_LIBS)
set(protoc_cpp_args "dllexport_decl=PROTOBUF_TEST_EXPORTS:")
endif ()
file(MAKE_DIRECTORY ${protobuf_BINARY_DIR}/conformance)
add_custom_command(
@ -26,7 +21,7 @@ add_custom_command(
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
--cpp_out=${protoc_cpp_args}${protobuf_BINARY_DIR}/conformance
--cpp_out=${protobuf_BINARY_DIR}/conformance
)
file(MAKE_DIRECTORY ${protobuf_BINARY_DIR}/src)
@ -52,10 +47,10 @@ add_custom_command(
${protobuf_SOURCE_DIR}/src/google/protobuf/editions/golden/test_messages_proto3_editions.proto
${protobuf_SOURCE_DIR}/src/google/protobuf/editions/golden/test_messages_proto2_editions.proto
--proto_path=${protobuf_SOURCE_DIR}/src
--cpp_out=${protoc_cpp_args}${protobuf_BINARY_DIR}/src
--cpp_out=${protobuf_BINARY_DIR}/src
)
add_library(libconformance_common ${protobuf_SHARED_OR_STATIC}
add_library(libconformance_common STATIC
${protobuf_BINARY_DIR}/conformance/conformance.pb.h
${protobuf_BINARY_DIR}/conformance/conformance.pb.cc
${protobuf_BINARY_DIR}/src/google/protobuf/test_messages_proto2.pb.h
@ -71,11 +66,6 @@ target_link_libraries(libconformance_common
${protobuf_LIB_PROTOBUF}
${protobuf_ABSL_USED_TARGETS}
)
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libconformance_common
PUBLIC PROTOBUF_USE_DLLS
PRIVATE LIBPROTOBUF_TEST_EXPORTS)
endif()
add_executable(conformance_test_runner
${protobuf_SOURCE_DIR}/conformance/binary_json_conformance_suite.cc

@ -29,12 +29,11 @@ set(_protobuf_libraries libprotobuf-lite libprotobuf)
if (protobuf_BUILD_LIBPROTOC)
list(APPEND _protobuf_libraries libprotoc)
endif (protobuf_BUILD_LIBPROTOC)
if (protobuf_BUILD_LIBUPB)
list(APPEND _protobuf_libraries libupb)
endif ()
foreach(_library ${_protobuf_libraries})
set_property(TARGET ${_library}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if (UNIX AND NOT APPLE)
set_property(TARGET ${_library}
PROPERTY INSTALL_RPATH "$ORIGIN")
@ -49,16 +48,27 @@ foreach(_library ${_protobuf_libraries})
endforeach()
if (protobuf_BUILD_PROTOC_BINARIES)
set(_protobuf_binaries protoc)
install(TARGETS protoc EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
if (UNIX AND NOT APPLE)
set_property(TARGET protoc
PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
elseif (APPLE)
set_property(TARGET protoc
PROPERTY INSTALL_RPATH "@loader_path/../lib")
endif()
if (protobuf_BUILD_LIBUPB)
foreach (generator upb upbdefs upb_minitable)
list(APPEND _protobuf_binaries protoc-gen-${generator})
install(TARGETS protoc-gen-${generator} EXPORT protobuf-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT upb-generators
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT upb-generators)
endforeach ()
endif ()
foreach (binary IN LISTS _protobuf_binaries)
if (UNIX AND NOT APPLE)
set_property(TARGET ${binary}
PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
elseif (APPLE)
set_property(TARGET ${binary}
PROPERTY INSTALL_RPATH "@loader_path/../lib")
endif ()
endforeach ()
endif (protobuf_BUILD_PROTOC_BINARIES)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc ${CMAKE_CURRENT_BINARY_DIR}/protobuf-lite.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@ -73,6 +83,17 @@ set(protobuf_HEADERS
${plugin_proto_proto_srcs}
${java_features_proto_proto_srcs}
)
if (protobuf_BUILD_LIBUPB)
list(APPEND protobuf_HEADERS ${libupb_hdrs})
# Manually install the bootstrap headers
install(
FILES
${protobuf_SOURCE_DIR}/upb/reflection/cmake/google/protobuf/descriptor.upb.h
${protobuf_SOURCE_DIR}/upb/reflection/cmake/google/protobuf/descriptor.upb_minitable.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/google/protobuf
COMPONENT protobuf-headers
)
endif ()
foreach(_header ${protobuf_HEADERS})
string(FIND ${_header} "${protobuf_SOURCE_DIR}/src" _find_src)
string(FIND ${_header} "${protobuf_SOURCE_DIR}" _find_nosrc)

@ -23,7 +23,10 @@ endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf-lite PRIVATE log)
endif()
target_include_directories(libprotobuf-lite PUBLIC ${protobuf_SOURCE_DIR}/src)
target_include_directories(libprotobuf-lite PUBLIC
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(libprotobuf-lite PUBLIC ${protobuf_ABSL_USED_TARGETS})
protobuf_configure_target(libprotobuf-lite)
if(protobuf_BUILD_SHARED_LIBS)

@ -26,7 +26,10 @@ endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
target_link_libraries(libprotobuf PRIVATE log)
endif()
target_include_directories(libprotobuf PUBLIC ${protobuf_SOURCE_DIR}/src)
target_include_directories(libprotobuf PUBLIC
$<BUILD_INTERFACE:${protobuf_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(libprotobuf PUBLIC ${protobuf_ABSL_USED_TARGETS})
protobuf_configure_target(libprotobuf)
if(protobuf_BUILD_SHARED_LIBS)

@ -20,7 +20,10 @@ add_library(libupb STATIC
${protobuf_version_rc_file}
)
target_include_directories(libupb PUBLIC ${bootstrap_cmake_dir})
target_include_directories(libupb PUBLIC
$<BUILD_INTERFACE:${bootstrap_cmake_dir}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
protobuf_configure_target(libupb)

@ -18,11 +18,6 @@ set(tests_protos
${util_test_protos_files}
)
set(protoc_cpp_args)
if (protobuf_BUILD_SHARED_LIBS)
set(protoc_cpp_args "dllexport_decl=PROTOBUF_TEST_EXPORTS")
endif ()
file(MAKE_DIRECTORY ${protobuf_BINARY_DIR}/src)
set(lite_test_proto_files)
@ -32,23 +27,17 @@ foreach(proto_file ${lite_test_protos})
LANGUAGE cpp
OUT_VAR pb_generated_files
IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
PLUGIN_OPTIONS ${protoc_cpp_args}
)
set(lite_test_proto_files ${lite_test_proto_files} ${pb_generated_files})
endforeach(proto_file)
set(tests_proto_files)
foreach(proto_file ${tests_protos})
if (MSVC AND protobuf_BUILD_SHARED_LIBS AND ${proto_file} MATCHES ".*enormous.*")
# Our enormous protos are too big for windows DLLs.
continue()
endif ()
protobuf_generate(
PROTOS ${proto_file}
LANGUAGE cpp
OUT_VAR pb_generated_files
IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
PLUGIN_OPTIONS ${protoc_cpp_args}
)
set(tests_proto_files ${tests_proto_files} ${pb_generated_files})
endforeach(proto_file)
@ -96,7 +85,7 @@ else()
set(protobuf_GTEST_ARGS)
endif()
add_library(libtest_common ${protobuf_SHARED_OR_STATIC}
add_library(libtest_common STATIC
${tests_proto_files}
)
target_link_libraries(libtest_common
@ -109,11 +98,6 @@ target_link_libraries(libtest_common
if (MSVC)
target_compile_options(libtest_common PRIVATE /bigobj)
endif ()
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libtest_common
PUBLIC PROTOBUF_USE_DLLS
PRIVATE LIBPROTOBUF_TEST_EXPORTS)
endif()
add_executable(tests ${tests_files} ${common_test_files})
if (MSVC)
@ -155,7 +139,7 @@ target_link_libraries(test_plugin
GTest::gmock
)
add_library(libtest_common_lite ${protobuf_SHARED_OR_STATIC}
add_library(libtest_common_lite STATIC
${lite_test_proto_files}
)
target_link_libraries(libtest_common_lite
@ -163,11 +147,6 @@ target_link_libraries(libtest_common_lite
${protobuf_ABSL_USED_TARGETS}
GTest::gmock
)
if(protobuf_BUILD_SHARED_LIBS)
target_compile_definitions(libtest_common_lite
PUBLIC PROTOBUF_USE_DLLS
PRIVATE LIBPROTOBUF_TEST_EXPORTS)
endif()
add_executable(lite-test
${protobuf_lite_test_files}
@ -206,8 +185,8 @@ if (protobuf_BUILD_LIBUPB)
OUT_VAR pb_generated_files
IMPORT_DIRS ${protobuf_SOURCE_DIR}/src
IMPORT_DIRS ${protobuf_SOURCE_DIR}
PLUGIN protoc-gen-${generator}=$<TARGET_FILE:protoc-gen-${generator}>
DEPENDENCIES $<TARGET_FILE:protoc-gen-${generator}>
PLUGIN protoc-gen-${generator}=$<TARGET_FILE:protobuf::protoc-gen-${generator}>
DEPENDENCIES $<TARGET_FILE:protobuf::protoc-gen-${generator}>
)
set(upb_test_proto_genfiles ${upb_test_proto_genfiles} ${pb_generated_files})
endforeach()
@ -219,8 +198,8 @@ if (protobuf_BUILD_LIBUPB)
${upb_test_util_files})
target_link_libraries(upb-test
libprotobuf
libupb
${protobuf_LIB_PROTOBUF}
${protobuf_LIB_UPB}
${protobuf_ABSL_USED_TARGETS}
${protobuf_ABSL_USED_TEST_TARGETS}
GTest::gmock_main)
@ -239,7 +218,9 @@ add_custom_target(restore-installed-headers)
file(GLOB_RECURSE _local_hdrs
"${PROJECT_SOURCE_DIR}/src/*.h"
"${PROJECT_SOURCE_DIR}/src/*.inc")
"${PROJECT_SOURCE_DIR}/src/*.inc"
"${PROJECT_SOURCE_DIR}/upb/*.h"
)
# Exclude the bootstrapping that are directly used by tests.
set(_exclude_hdrs
@ -250,7 +231,7 @@ set(_exclude_hdrs
# Exclude test library headers.
list(APPEND _exclude_hdrs ${test_util_hdrs} ${lite_test_util_hdrs} ${common_test_hdrs}
${compiler_test_utils_hdrs})
${compiler_test_utils_hdrs} ${upb_test_util_files})
foreach(_hdr ${_exclude_hdrs})
list(REMOVE_ITEM _local_hdrs ${_hdr})
endforeach()

@ -14,11 +14,12 @@ foreach(generator upb upbdefs upb_minitable)
${bootstrap_sources}
${protobuf_version_rc_file}
)
target_include_directories(protoc-gen-${generator} PUBLIC ${bootstrap_cmake_dir})
target_include_directories(protoc-gen-${generator} PRIVATE ${bootstrap_cmake_dir})
target_link_libraries(protoc-gen-${generator}
libprotobuf
libupb
${protobuf_LIB_PROTOBUF}
${protobuf_LIB_UPB}
${protobuf_ABSL_USED_TARGETS}
)
set_target_properties(protoc-gen-${generator} PROPERTIES VERSION ${protobuf_VERSION})
add_executable(protobuf::protoc-gen-${generator} ALIAS protoc-gen-${generator})
endforeach()

@ -36,9 +36,6 @@ exports_files([
"text_format_failure_list_python.txt",
"text_format_failure_list_python_cpp.txt",
"text_format_failure_list_python_upb.txt",
"text_format_failure_list_ruby.txt",
"text_format_failure_list_jruby.txt",
"text_format_failure_list_jruby_ffi.txt",
])
cc_proto_library(
@ -274,6 +271,8 @@ java_binary(
"//:protobuf_javalite",
"//:test_messages_proto2_java_proto_lite",
"//:test_messages_proto3_java_proto_lite",
"//src/google/protobuf/editions:test_messages_proto2_editions_java_proto_lite",
"//src/google/protobuf/editions:test_messages_proto3_editions_java_proto_lite",
],
)
@ -377,6 +376,7 @@ ruby_binary(
deps = [
":conformance_ruby_proto",
"//ruby:conformance_test_ruby_proto",
"//ruby:protobuf",
],
)

@ -5,6 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
import com.google.protobuf.AbstractMessageLite;
import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.ExtensionRegistryLite;
@ -15,6 +16,8 @@ import com.google.protobuf.conformance.Conformance;
import com.google.protobuf_test_messages.proto2.TestMessagesProto2;
import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2;
import com.google.protobuf_test_messages.proto3.TestMessagesProto3;
import com.google.protobuf_test_messages.editions.proto2.TestMessagesProto2Editions;
import com.google.protobuf_test_messages.editions.proto3.TestMessagesProto3Editions;
import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@ -203,42 +206,62 @@ class ConformanceJavaLite {
return messages.get(0);
}
private Class<? extends AbstractMessageLite> createTestMessage(String messageType) {
switch (messageType) {
case "protobuf_test_messages.proto3.TestAllTypesProto3":
return TestAllTypesProto3.class;
case "protobuf_test_messages.proto2.TestAllTypesProto2":
return TestAllTypesProto2.class;
case "protobuf_test_messages.editions.proto3.TestAllTypesProto3":
return TestMessagesProto3Editions.TestAllTypesProto3.class;
case "protobuf_test_messages.editions.proto2.TestAllTypesProto2":
return TestMessagesProto2Editions.TestAllTypesProto2.class;
default:
throw new IllegalArgumentException(
"Protobuf request has unexpected payload type: " + messageType);
}
}
private Class<?> createTestFile(String messageType) {
switch (messageType) {
case "protobuf_test_messages.proto3.TestAllTypesProto3":
return TestMessagesProto3.class;
case "protobuf_test_messages.proto2.TestAllTypesProto2":
return TestMessagesProto2.class;
case "protobuf_test_messages.editions.proto3.TestAllTypesProto3":
return TestMessagesProto3Editions.class;
case "protobuf_test_messages.editions.proto2.TestAllTypesProto2":
return TestMessagesProto2Editions.class;
default:
throw new IllegalArgumentException(
"Protobuf request has unexpected payload type: " + messageType);
}
}
@SuppressWarnings("unchecked")
private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
com.google.protobuf.MessageLite testMessage;
boolean isProto3 =
request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3");
boolean isProto2 =
request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");
String messageType = request.getMessageType();
switch (request.getPayloadCase()) {
case PROTOBUF_PAYLOAD:
{
if (isProto3) {
try {
ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
TestMessagesProto3.registerAllExtensions(extensions);
testMessage =
parseBinary(
request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions);
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
}
} else if (isProto2) {
try {
ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
TestMessagesProto2.registerAllExtensions(extensions);
testMessage =
parseBinary(
request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions);
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
}
} else {
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
try {
ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
createTestFile(messageType)
.getMethod("registerAllExtensions", ExtensionRegistryLite.class)
.invoke(null, extensions);
testMessage =
parseBinary(
request.getProtobufPayload(),
(Parser<AbstractMessageLite>)
createTestMessage(messageType).getMethod("parser").invoke(null),
extensions);
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
} catch (Exception e) {
throw new RuntimeException(e);
}
break;
}

@ -8,8 +8,11 @@
# https://developers.google.com/open-source/licenses/bsd
require 'conformance/conformance_pb'
require 'google/protobuf'
require 'google/protobuf/test_messages_proto3_pb'
require 'google/protobuf/test_messages_proto2_pb'
require 'google/protobuf/editions/golden/test_messages_proto2_editions_pb'
require 'google/protobuf/editions/golden/test_messages_proto3_editions_pb'
$test_count = 0
$verbose = false
@ -20,7 +23,12 @@ def do_test(request)
descriptor = Google::Protobuf::DescriptorPool.generated_pool.lookup(request.message_type)
unless descriptor
response.skipped = "Unknown message type: " + request.message_type
response.runtime_error = "Unknown message type: " + request.message_type
end
if request.test_category == :TEXT_FORMAT_TEST
response.skipped = "Ruby doesn't support text format"
return response
end
begin
@ -45,12 +53,6 @@ def do_test(request)
return response
end
when :text_payload
begin
response.skipped = "Ruby doesn't support text format"
return response
end
when nil
fail "Request didn't have payload"
end

@ -8,3 +8,7 @@ Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValu
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Editions_Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Editions_Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Editions_Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Editions_Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE

@ -69,3 +69,74 @@ Required.Proto3.JsonInput.Int32FieldPlusSign
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool
Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
Required.Proto3.JsonInput.StringFieldNotAString
Recommended.Editions_Proto3.FieldMaskNumbersDontRoundTrip.JsonOutput
Recommended.Editions_Proto3.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.Editions_Proto3.FieldMaskTooManyUnderscore.JsonOutput
Recommended.Editions_Proto2.JsonInput.BoolFieldAllCapitalFalse
Recommended.Editions_Proto2.JsonInput.BoolFieldAllCapitalTrue
Recommended.Editions_Proto2.JsonInput.BoolFieldCamelCaseFalse
Recommended.Editions_Proto2.JsonInput.BoolFieldCamelCaseTrue
Recommended.Editions_Proto2.JsonInput.BoolFieldDoubleQuotedFalse
Recommended.Editions_Proto2.JsonInput.BoolFieldDoubleQuotedTrue
Recommended.Editions_Proto2.JsonInput.BoolMapFieldKeyNotQuoted
Recommended.Editions_Proto2.JsonInput.DoubleFieldInfinityNotQuoted
Recommended.Editions_Proto2.JsonInput.DoubleFieldNanNotQuoted
Recommended.Editions_Proto2.JsonInput.DoubleFieldNegativeInfinityNotQuoted
Recommended.Editions_Proto2.JsonInput.FieldNameDuplicate
Recommended.Editions_Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Editions_Proto2.JsonInput.FieldNameNotQuoted
Recommended.Editions_Proto2.JsonInput.FloatFieldInfinityNotQuoted
Recommended.Editions_Proto2.JsonInput.FloatFieldNanNotQuoted
Recommended.Editions_Proto2.JsonInput.FloatFieldNegativeInfinityNotQuoted
Recommended.Editions_Proto2.JsonInput.Int32MapFieldKeyNotQuoted
Recommended.Editions_Proto2.JsonInput.Int64MapFieldKeyNotQuoted
Recommended.Editions_Proto2.JsonInput.JsonWithComments
Recommended.Editions_Proto2.JsonInput.StringFieldSingleQuoteBoth
Recommended.Editions_Proto2.JsonInput.StringFieldSingleQuoteKey
Recommended.Editions_Proto2.JsonInput.StringFieldSingleQuoteValue
Recommended.Editions_Proto2.JsonInput.StringFieldSurrogateInWrongOrder
Recommended.Editions_Proto2.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.Editions_Proto2.JsonInput.StringFieldUnpairedLowSurrogate
Recommended.Editions_Proto2.JsonInput.Uint32MapFieldKeyNotQuoted
Recommended.Editions_Proto2.JsonInput.Uint64MapFieldKeyNotQuoted
Recommended.Editions_Proto3.JsonInput.BoolFieldAllCapitalFalse
Recommended.Editions_Proto3.JsonInput.BoolFieldAllCapitalTrue
Recommended.Editions_Proto3.JsonInput.BoolFieldCamelCaseFalse
Recommended.Editions_Proto3.JsonInput.BoolFieldCamelCaseTrue
Recommended.Editions_Proto3.JsonInput.BoolFieldDoubleQuotedFalse
Recommended.Editions_Proto3.JsonInput.BoolFieldDoubleQuotedTrue
Recommended.Editions_Proto3.JsonInput.BoolMapFieldKeyNotQuoted
Recommended.Editions_Proto3.JsonInput.DoubleFieldInfinityNotQuoted
Recommended.Editions_Proto3.JsonInput.DoubleFieldNanNotQuoted
Recommended.Editions_Proto3.JsonInput.DoubleFieldNegativeInfinityNotQuoted
Recommended.Editions_Proto3.JsonInput.FieldMaskInvalidCharacter
Recommended.Editions_Proto3.JsonInput.FieldNameDuplicate
Recommended.Editions_Proto3.JsonInput.FieldNameNotQuoted
Recommended.Editions_Proto3.JsonInput.FloatFieldInfinityNotQuoted
Recommended.Editions_Proto3.JsonInput.FloatFieldNanNotQuoted
Recommended.Editions_Proto3.JsonInput.FloatFieldNegativeInfinityNotQuoted
Recommended.Editions_Proto3.JsonInput.Int32MapFieldKeyNotQuoted
Recommended.Editions_Proto3.JsonInput.Int64MapFieldKeyNotQuoted
Recommended.Editions_Proto3.JsonInput.JsonWithComments
Recommended.Editions_Proto3.JsonInput.StringFieldSingleQuoteBoth
Recommended.Editions_Proto3.JsonInput.StringFieldSingleQuoteKey
Recommended.Editions_Proto3.JsonInput.StringFieldSingleQuoteValue
Recommended.Editions_Proto3.JsonInput.StringFieldSurrogateInWrongOrder
Recommended.Editions_Proto3.JsonInput.StringFieldUnpairedHighSurrogate
Recommended.Editions_Proto3.JsonInput.StringFieldUnpairedLowSurrogate
Recommended.Editions_Proto3.JsonInput.Uint32MapFieldKeyNotQuoted
Recommended.Editions_Proto3.JsonInput.Uint64MapFieldKeyNotQuoted
Required.Editions_Proto2.JsonInput.EnumFieldNotQuoted
Required.Editions_Proto2.JsonInput.Int32FieldLeadingZero
Required.Editions_Proto2.JsonInput.Int32FieldNegativeWithLeadingZero
Required.Editions_Proto2.JsonInput.Int32FieldPlusSign
Required.Editions_Proto2.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool
Required.Editions_Proto2.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
Required.Editions_Proto2.JsonInput.StringFieldNotAString
Required.Editions_Proto3.JsonInput.EnumFieldNotQuoted
Required.Editions_Proto3.JsonInput.Int32FieldLeadingZero
Required.Editions_Proto3.JsonInput.Int32FieldNegativeWithLeadingZero
Required.Editions_Proto3.JsonInput.Int32FieldPlusSign
Required.Editions_Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool
Required.Editions_Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
Required.Editions_Proto3.JsonInput.StringFieldNotAString

@ -1,8 +0,0 @@
Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput
Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput
Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput
Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Print.TextFormatOutput

@ -1,8 +0,0 @@
Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput
Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput
Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput
Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput
Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Print.TextFormatOutput

@ -258,7 +258,8 @@ public class FeatureInheritanceTest
}
private static int GetTestFeature(FeatureSetDescriptor features) =>
(features.Proto.GetExtension(UnittestFeaturesExtensions.Test) ?? new TestFeatures()).IntMultipleFeature;
(int)(features.Proto.GetExtension(UnittestFeaturesExtensions.Test) ?? new TestFeatures())
.MultipleFeature;
private static void SetTestFeature(FileDescriptorProto proto, int value)
{
@ -317,7 +318,8 @@ public class FeatureInheritanceTest
}
private static void SetTestFeature(FeatureSet features, int value) =>
features.SetExtension(UnittestFeaturesExtensions.Test, new TestFeatures { IntMultipleFeature = value });
features.SetExtension(UnittestFeaturesExtensions.Test,
new TestFeatures { MultipleFeature = (Pb.EnumFeature)value });
private static FileDescriptor Build(FileDescriptorProto fileProto) =>
FileDescriptor.BuildFromByteStrings(new[] { fileProto.ToByteString() }, new ExtensionRegistry { UnittestFeaturesExtensions.Test })[0];

@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
@ -204,14 +204,13 @@ namespace Google.Protobuf
while (true)
{
var next = reader.Read();
if (next == null)
{
ValidateState(State.ExpectedEndOfDocument, "Unexpected end of document in state: ");
state = State.ReaderExhausted;
return JsonToken.EndDocument;
}
switch (next.Value)
switch (next)
{
case -1:
ValidateState(State.ExpectedEndOfDocument, "Unexpected end of document in state: ");
state = State.ReaderExhausted;
return JsonToken.EndDocument;
// Skip whitespace between tokens
case ' ':
case '\t':
@ -279,11 +278,11 @@ namespace Google.Protobuf
case '7':
case '8':
case '9':
double number = ReadNumber(next.Value);
double number = ReadNumber((char) next);
ValidateAndModifyStateForValue("Invalid state to read a number token: ");
return JsonToken.Value(number);
default:
throw new InvalidJsonException("Invalid first character of token: " + next.Value);
throw new InvalidJsonException($"Invalid first character of token: {(char) next}");
}
}
}
@ -395,14 +394,15 @@ namespace Google.Protobuf
{
for (int i = 1; i < text.Length; i++)
{
char? next = reader.Read();
if (next == null)
{
throw reader.CreateException("Unexpected end of text while reading literal token " + text);
}
if (next.Value != text[i])
int next = reader.Read();
if (next != text[i])
{
throw reader.CreateException("Unexpected character while reading literal token " + text);
// Only check for "end of text" when we've detected that the character differs from the
// expected one.
var message = next == -1
? $"Unexpected end of text while reading literal token {text}"
: $"Unexpected character while reading literal token {text}";
throw reader.CreateException(message);
}
}
}
@ -422,7 +422,7 @@ namespace Google.Protobuf
// Each method returns the character it read that doesn't belong in that part,
// so we know what to do next, including pushing the character back at the end.
// null is returned for "end of text".
char? next = ReadInt(builder);
int next = ReadInt(builder);
if (next == '.')
{
next = ReadFrac(builder);
@ -433,9 +433,9 @@ namespace Google.Protobuf
}
// If we read a character which wasn't part of the number, push it back so we can read it again
// to parse the next token.
if (next != null)
if (next != -1)
{
reader.PushBack(next.Value);
reader.PushBack((char) next);
}
// TODO: What exception should we throw if the value can't be represented as a double?
@ -461,7 +461,12 @@ namespace Google.Protobuf
}
}
private char? ReadInt(StringBuilder builder)
/// <summary>
/// Copies an integer into a StringBuilder.
/// </summary>
/// <param name="builder">The builder to read the number into</param>
/// <returns>The character following the integer, or -1 for end-of-text.</returns>
private int ReadInt(StringBuilder builder)
{
char first = reader.ReadOrFail("Invalid numeric literal");
if (first < '0' || first > '9')
@ -469,7 +474,7 @@ namespace Google.Protobuf
throw reader.CreateException("Invalid numeric literal");
}
builder.Append(first);
char? next = ConsumeDigits(builder, out int digitCount);
int next = ConsumeDigits(builder, out int digitCount);
if (first == '0' && digitCount != 0)
{
throw reader.CreateException("Invalid numeric literal: leading 0 for non-zero value.");
@ -477,10 +482,15 @@ namespace Google.Protobuf
return next;
}
private char? ReadFrac(StringBuilder builder)
/// <summary>
/// Copies the fractional part of an integer into a StringBuilder, assuming reader is positioned after a period.
/// </summary>
/// <param name="builder">The builder to read the number into</param>
/// <returns>The character following the fractional part, or -1 for end-of-text.</returns>
private int ReadFrac(StringBuilder builder)
{
builder.Append('.'); // Already consumed this
char? next = ConsumeDigits(builder, out int digitCount);
int next = ConsumeDigits(builder, out int digitCount);
if (digitCount == 0)
{
throw reader.CreateException("Invalid numeric literal: fraction with no trailing digits");
@ -488,21 +498,26 @@ namespace Google.Protobuf
return next;
}
private char? ReadExp(StringBuilder builder)
/// <summary>
/// Copies the exponent part of a number into a StringBuilder, with an assumption that the reader is already positioned after the "e".
/// </summary>
/// <param name="builder">The builder to read the number into</param>
/// <returns>The character following the exponent, or -1 for end-of-text.</returns>
private int ReadExp(StringBuilder builder)
{
builder.Append('E'); // Already consumed this (or 'e')
char? next = reader.Read();
if (next == null)
int next = reader.Read();
if (next == -1)
{
throw reader.CreateException("Invalid numeric literal: exponent with no trailing digits");
}
if (next == '-' || next == '+')
{
builder.Append(next.Value);
builder.Append((char) next);
}
else
{
reader.PushBack(next.Value);
reader.PushBack((char) next);
}
next = ConsumeDigits(builder, out int digitCount);
if (digitCount == 0)
@ -512,18 +527,24 @@ namespace Google.Protobuf
return next;
}
private char? ConsumeDigits(StringBuilder builder, out int count)
/// <summary>
/// Copies a sequence of digits into a StringBuilder.
/// </summary>
/// <param name="builder">The builder to read the number into</param>
/// <param name="count">The number of digits appended to the builder</param>
/// <returns>The character following the digits, or -1 for end-of-text.</returns>
private int ConsumeDigits(StringBuilder builder, out int count)
{
count = 0;
while (true)
{
char? next = reader.Read();
if (next == null || next.Value < '0' || next.Value > '9')
int next = reader.Read();
if (next == -1 || next < '0' || next > '9')
{
return next;
}
count++;
builder.Append(next.Value);
builder.Append((char) next);
}
}
@ -683,39 +704,41 @@ namespace Google.Protobuf
}
/// <summary>
/// The buffered next character, if we have one.
/// The buffered next character, if we have one, or -1 if there is no buffered character.
/// </summary>
private char? nextChar;
private int nextChar = -1;
/// <summary>
/// Returns the next character in the stream, or null if we have reached the end.
/// Returns the next character in the stream, or -1 if we have reached the end of the stream.
/// </summary>
/// <returns></returns>
internal char? Read()
internal int Read()
{
if (nextChar != null)
if (nextChar != -1)
{
char? tmp = nextChar;
nextChar = null;
int tmp = nextChar;
nextChar = -1;
return tmp;
}
int next = reader.Read();
return next == -1 ? null : (char?) next;
return reader.Read();
}
/// <summary>
/// Reads the next character from the underlying reader, throwing an <see cref="InvalidJsonException" />
/// with the specified message if there are no more characters available.
/// </summary>
internal char ReadOrFail(string messageOnFailure)
{
char? next = Read();
if (next == null)
int next = Read();
if (next == -1)
{
throw CreateException(messageOnFailure);
}
return next.Value;
return (char) next;
}
internal void PushBack(char c)
{
if (nextChar != null)
if (nextChar != -1)
{
throw new InvalidOperationException("Cannot push back when already buffering a character");
}

@ -182,7 +182,7 @@ namespace Google.Protobuf.Reflection {
"dmVfaW50X3ZhbHVlGAQgASgEEhoKEm5lZ2F0aXZlX2ludF92YWx1ZRgFIAEo",
"AxIUCgxkb3VibGVfdmFsdWUYBiABKAESFAoMc3RyaW5nX3ZhbHVlGAcgASgM",
"EhcKD2FnZ3JlZ2F0ZV92YWx1ZRgIIAEoCRozCghOYW1lUGFydBIRCgluYW1l",
"X3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigIIq0JCgpGZWF0dXJl",
"X3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigIIrUJCgpGZWF0dXJl",
"U2V0EnwKDmZpZWxkX3ByZXNlbmNlGAEgASgOMikuZ29vZ2xlLnByb3RvYnVm",
"LkZlYXR1cmVTZXQuRmllbGRQcmVzZW5jZUI5iAEBmAEEmAEBogENEghFWFBM",
"SUNJVBjmB6IBDRIISU1QTElDSVQY5weiAQ0SCEVYUExJQ0lUGOgHElwKCWVu",
@ -208,35 +208,35 @@ namespace Google.Protobuf.Reflection {
"Z2VFbmNvZGluZxIcChhNRVNTQUdFX0VOQ09ESU5HX1VOS05PV04QABITCg9M",
"RU5HVEhfUFJFRklYRUQQARINCglERUxJTUlURUQQAiJICgpKc29uRm9ybWF0",
"EhcKE0pTT05fRk9STUFUX1VOS05PV04QABIJCgVBTExPVxABEhYKEkxFR0FD",
"WV9CRVNUX0VGRk9SVBACKgYI6AcQ6QcqBgjpBxDqByoGCOoHEOsHKgYIi04Q",
"kE4qBgiQThCRTkoGCOcHEOgHIsACChJGZWF0dXJlU2V0RGVmYXVsdHMSTgoI",
"ZGVmYXVsdHMYASADKAsyPC5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldERl",
"ZmF1bHRzLkZlYXR1cmVTZXRFZGl0aW9uRGVmYXVsdBIxCg9taW5pbXVtX2Vk",
"aXRpb24YBCABKA4yGC5nb29nbGUucHJvdG9idWYuRWRpdGlvbhIxCg9tYXhp",
"bXVtX2VkaXRpb24YBSABKA4yGC5nb29nbGUucHJvdG9idWYuRWRpdGlvbhp0",
"ChhGZWF0dXJlU2V0RWRpdGlvbkRlZmF1bHQSKQoHZWRpdGlvbhgDIAEoDjIY",
"Lmdvb2dsZS5wcm90b2J1Zi5FZGl0aW9uEi0KCGZlYXR1cmVzGAIgASgLMhsu",
"Z29vZ2xlLnByb3RvYnVmLkZlYXR1cmVTZXQi1QEKDlNvdXJjZUNvZGVJbmZv",
"EjoKCGxvY2F0aW9uGAEgAygLMiguZ29vZ2xlLnByb3RvYnVmLlNvdXJjZUNv",
"ZGVJbmZvLkxvY2F0aW9uGoYBCghMb2NhdGlvbhIQCgRwYXRoGAEgAygFQgIQ",
"ARIQCgRzcGFuGAIgAygFQgIQARIYChBsZWFkaW5nX2NvbW1lbnRzGAMgASgJ",
"EhkKEXRyYWlsaW5nX2NvbW1lbnRzGAQgASgJEiEKGWxlYWRpbmdfZGV0YWNo",
"ZWRfY29tbWVudHMYBiADKAkinAIKEUdlbmVyYXRlZENvZGVJbmZvEkEKCmFu",
"bm90YXRpb24YASADKAsyLS5nb29nbGUucHJvdG9idWYuR2VuZXJhdGVkQ29k",
"ZUluZm8uQW5ub3RhdGlvbhrDAQoKQW5ub3RhdGlvbhIQCgRwYXRoGAEgAygF",
"QgIQARITCgtzb3VyY2VfZmlsZRgCIAEoCRINCgViZWdpbhgDIAEoBRILCgNl",
"bmQYBCABKAUSSAoIc2VtYW50aWMYBSABKA4yNi5nb29nbGUucHJvdG9idWYu",
"R2VuZXJhdGVkQ29kZUluZm8uQW5ub3RhdGlvbi5TZW1hbnRpYyIoCghTZW1h",
"bnRpYxIICgROT05FEAASBwoDU0VUEAESCQoFQUxJQVMQAiqSAgoHRWRpdGlv",
"bhITCg9FRElUSU9OX1VOS05PV04QABITCg5FRElUSU9OX1BST1RPMhDmBxIT",
"Cg5FRElUSU9OX1BST1RPMxDnBxIRCgxFRElUSU9OXzIwMjMQ6AcSEQoMRURJ",
"VElPTl8yMDI0EOkHEhcKE0VESVRJT05fMV9URVNUX09OTFkQARIXChNFRElU",
"SU9OXzJfVEVTVF9PTkxZEAISHQoXRURJVElPTl85OTk5N19URVNUX09OTFkQ",
"nY0GEh0KF0VESVRJT05fOTk5OThfVEVTVF9PTkxZEJ6NBhIdChdFRElUSU9O",
"Xzk5OTk5X1RFU1RfT05MWRCfjQYSEwoLRURJVElPTl9NQVgQ/////wdCfgoT",
"Y29tLmdvb2dsZS5wcm90b2J1ZkIQRGVzY3JpcHRvclByb3Rvc0gBWi1nb29n",
"bGUuZ29sYW5nLm9yZy9wcm90b2J1Zi90eXBlcy9kZXNjcmlwdG9ycGL4AQGi",
"AgNHUEKqAhpHb29nbGUuUHJvdG9idWYuUmVmbGVjdGlvbg=="));
"WV9CRVNUX0VGRk9SVBACKgYI6AcQ6QcqBgjpBxDqByoGCOoHEOsHKgYIhk4Q",
"h04qBgiLThCQTioGCJBOEJFOSgYI5wcQ6AciwAIKEkZlYXR1cmVTZXREZWZh",
"dWx0cxJOCghkZWZhdWx0cxgBIAMoCzI8Lmdvb2dsZS5wcm90b2J1Zi5GZWF0",
"dXJlU2V0RGVmYXVsdHMuRmVhdHVyZVNldEVkaXRpb25EZWZhdWx0EjEKD21p",
"bmltdW1fZWRpdGlvbhgEIAEoDjIYLmdvb2dsZS5wcm90b2J1Zi5FZGl0aW9u",
"EjEKD21heGltdW1fZWRpdGlvbhgFIAEoDjIYLmdvb2dsZS5wcm90b2J1Zi5F",
"ZGl0aW9uGnQKGEZlYXR1cmVTZXRFZGl0aW9uRGVmYXVsdBIpCgdlZGl0aW9u",
"GAMgASgOMhguZ29vZ2xlLnByb3RvYnVmLkVkaXRpb24SLQoIZmVhdHVyZXMY",
"AiABKAsyGy5nb29nbGUucHJvdG9idWYuRmVhdHVyZVNldCLVAQoOU291cmNl",
"Q29kZUluZm8SOgoIbG9jYXRpb24YASADKAsyKC5nb29nbGUucHJvdG9idWYu",
"U291cmNlQ29kZUluZm8uTG9jYXRpb24ahgEKCExvY2F0aW9uEhAKBHBhdGgY",
"ASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABEhgKEGxlYWRpbmdfY29tbWVu",
"dHMYAyABKAkSGQoRdHJhaWxpbmdfY29tbWVudHMYBCABKAkSIQoZbGVhZGlu",
"Z19kZXRhY2hlZF9jb21tZW50cxgGIAMoCSKcAgoRR2VuZXJhdGVkQ29kZUlu",
"Zm8SQQoKYW5ub3RhdGlvbhgBIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5HZW5l",
"cmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uGsMBCgpBbm5vdGF0aW9uEhAKBHBh",
"dGgYASADKAVCAhABEhMKC3NvdXJjZV9maWxlGAIgASgJEg0KBWJlZ2luGAMg",
"ASgFEgsKA2VuZBgEIAEoBRJICghzZW1hbnRpYxgFIAEoDjI2Lmdvb2dsZS5w",
"cm90b2J1Zi5HZW5lcmF0ZWRDb2RlSW5mby5Bbm5vdGF0aW9uLlNlbWFudGlj",
"IigKCFNlbWFudGljEggKBE5PTkUQABIHCgNTRVQQARIJCgVBTElBUxACKpIC",
"CgdFZGl0aW9uEhMKD0VESVRJT05fVU5LTk9XThAAEhMKDkVESVRJT05fUFJP",
"VE8yEOYHEhMKDkVESVRJT05fUFJPVE8zEOcHEhEKDEVESVRJT05fMjAyMxDo",
"BxIRCgxFRElUSU9OXzIwMjQQ6QcSFwoTRURJVElPTl8xX1RFU1RfT05MWRAB",
"EhcKE0VESVRJT05fMl9URVNUX09OTFkQAhIdChdFRElUSU9OXzk5OTk3X1RF",
"U1RfT05MWRCdjQYSHQoXRURJVElPTl85OTk5OF9URVNUX09OTFkQno0GEh0K",
"F0VESVRJT05fOTk5OTlfVEVTVF9PTkxZEJ+NBhITCgtFRElUSU9OX01BWBD/",
"////B0J+ChNjb20uZ29vZ2xlLnByb3RvYnVmQhBEZXNjcmlwdG9yUHJvdG9z",
"SAFaLWdvb2dsZS5nb2xhbmcub3JnL3Byb3RvYnVmL3R5cGVzL2Rlc2NyaXB0",
"b3JwYvgBAaICA0dQQqoCGkdvb2dsZS5Qcm90b2J1Zi5SZWZsZWN0aW9u"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Google.Protobuf.Reflection.Edition), }, null, new pbr::GeneratedClrTypeInfo[] {

@ -27,6 +27,9 @@ namespace Google.Protobuf.Reflection
private readonly IDictionary<ObjectIntPair<IDescriptor>, EnumValueDescriptor> enumValuesByNumber =
new Dictionary<ObjectIntPair<IDescriptor>, EnumValueDescriptor>();
private readonly IDictionary<EnumValueByNameDescriptorKey, EnumValueDescriptor> enumValuesByName =
new Dictionary<EnumValueByNameDescriptorKey, EnumValueDescriptor>();
private readonly HashSet<FileDescriptor> dependencies = new HashSet<FileDescriptor>();
internal DescriptorPool(IEnumerable<FileDescriptor> dependencyFiles)
@ -129,29 +132,20 @@ namespace Google.Protobuf.Reflection
if (descriptorsByName.TryGetValue(fullName, out IDescriptor old))
{
int dotPos = fullName.LastIndexOf('.');
string message;
if (descriptor.File == old.File)
{
if (dotPos == -1)
{
message = "\"" + fullName + "\" is already defined.";
}
else
{
message = "\"" + fullName.Substring(dotPos + 1) + "\" is already defined in \"" +
fullName.Substring(0, dotPos) + "\".";
}
}
else
{
message = "\"" + fullName + "\" is already defined in file \"" + old.File.Name + "\".";
}
throw new DescriptorValidationException(descriptor, message);
throw new DescriptorValidationException(descriptor,
GetDescriptorAlreadyAddedExceptionMessage(descriptor, fullName, old));
}
descriptorsByName[fullName] = descriptor;
}
private static string GetDescriptorAlreadyAddedExceptionMessage(IDescriptor descriptor, string fullName, IDescriptor old)
{
int dotPos = fullName.LastIndexOf('.');
return descriptor.File != old.File ? $"\"{fullName}\" is already defined in file \"{old.File.Name}\"."
: dotPos == -1 ? $"{fullName} is already defined."
: $"\"{fullName.Substring(dotPos + 1)}\" is already defined in \"{fullName.Substring(0, dotPos)}\".";
}
/// <summary>
/// Verifies that the descriptor's name is valid (i.e. it contains
/// only letters, digits and underscores, and does not start with a digit).
@ -167,11 +161,14 @@ namespace Google.Protobuf.Reflection
// Symbol name must start with a letter or underscore, and it can contain letters,
// numbers and underscores.
string name = descriptor.Name;
if (!IsAsciiLetter(name[0]) && name[0] != '_') {
if (!IsAsciiLetter(name[0]) && name[0] != '_')
{
ThrowInvalidSymbolNameException(descriptor);
}
for (int i = 1; i < name.Length; i++) {
if (!IsAsciiLetter(name[i]) && !IsAsciiDigit(name[i]) && name[i] != '_') {
for (int i = 1; i < name.Length; i++)
{
if (!IsAsciiLetter(name[i]) && !IsAsciiDigit(name[i]) && name[i] != '_')
{
ThrowInvalidSymbolNameException(descriptor);
}
}
@ -199,6 +196,12 @@ namespace Google.Protobuf.Reflection
return ret;
}
internal EnumValueDescriptor FindEnumValueByName(EnumDescriptor enumDescriptor, string name)
{
enumValuesByName.TryGetValue(new EnumValueByNameDescriptorKey(enumDescriptor, name), out EnumValueDescriptor ret);
return ret;
}
/// <summary>
/// Adds a field to the fieldsByNumber table.
/// </summary>
@ -219,17 +222,28 @@ namespace Google.Protobuf.Reflection
}
/// <summary>
/// Adds an enum value to the enumValuesByNumber table. If an enum value
/// with the same type and number already exists, this method does nothing.
/// (This is allowed; the first value defined with the number takes precedence.)
/// Adds an enum value to the enumValuesByNumber and enumValuesByName tables. If an enum value
/// with the same type and number already exists, this method does nothing to enumValuesByNumber.
/// (This is allowed; the first value defined with the number takes precedence.) If an enum
/// value with the same name already exists, this method throws DescriptorValidationException.
/// (It is expected that this method is called after AddSymbol, which would already have thrown
/// an exception in this failure case.)
/// </summary>
internal void AddEnumValueByNumber(EnumValueDescriptor enumValue)
internal void AddEnumValue(EnumValueDescriptor enumValue)
{
ObjectIntPair<IDescriptor> key = new ObjectIntPair<IDescriptor>(enumValue.EnumDescriptor, enumValue.Number);
if (!enumValuesByNumber.ContainsKey(key))
ObjectIntPair<IDescriptor> numberKey = new ObjectIntPair<IDescriptor>(enumValue.EnumDescriptor, enumValue.Number);
if (!enumValuesByNumber.ContainsKey(numberKey))
{
enumValuesByNumber[key] = enumValue;
enumValuesByNumber[numberKey] = enumValue;
}
EnumValueByNameDescriptorKey nameKey = new EnumValueByNameDescriptorKey(enumValue.EnumDescriptor, enumValue.Name);
if (enumValuesByName.TryGetValue(nameKey, out EnumValueDescriptor old))
{
throw new DescriptorValidationException(enumValue,
GetDescriptorAlreadyAddedExceptionMessage(enumValue, enumValue.FullName, old));
}
enumValuesByName[nameKey] = enumValue;
}
/// <summary>
@ -308,5 +322,37 @@ namespace Google.Protobuf.Reflection
return result;
}
}
}
/// <summary>
/// Struct used to hold the keys for the enumValuesByName table.
/// </summary>
private struct EnumValueByNameDescriptorKey : IEquatable<EnumValueByNameDescriptorKey>
{
private readonly string name;
private readonly IDescriptor descriptor;
internal EnumValueByNameDescriptorKey(EnumDescriptor descriptor, string valueName)
{
this.descriptor = descriptor;
this.name = valueName;
}
public bool Equals(EnumValueByNameDescriptorKey other) =>
descriptor == other.descriptor
&& name == other.name;
public override bool Equals(object obj) =>
obj is EnumValueByNameDescriptorKey pair && Equals(pair);
public override int GetHashCode()
{
unchecked
{
var hashCode = descriptor.GetHashCode();
hashCode = (hashCode * 397) ^ (name != null ? name.GetHashCode() : 0);
return hashCode;
}
}
}
}
}

@ -90,10 +90,8 @@ namespace Google.Protobuf.Reflection
/// </summary>
/// <param name="name">The unqualified name of the value (e.g. "FOO").</param>
/// <returns>The value's descriptor, or null if not found.</returns>
public EnumValueDescriptor FindValueByName(string name)
{
return File.DescriptorPool.FindSymbol<EnumValueDescriptor>(FullName + "." + name);
}
public EnumValueDescriptor FindValueByName(string name) =>
File.DescriptorPool.FindEnumValueByName(this, name);
/// <summary>
/// The (possibly empty) set of custom options for this enum.

@ -24,7 +24,7 @@ namespace Google.Protobuf.Reflection
Proto = proto;
EnumDescriptor = parent;
file.DescriptorPool.AddSymbol(this);
file.DescriptorPool.AddEnumValueByNumber(this);
file.DescriptorPool.AddEnumValue(this);
}
internal EnumValueDescriptorProto Proto { get; }

@ -109,8 +109,10 @@ internal_gen_well_known_protos_java(
name = "gen_well_known_protos_javalite",
javalite = True,
deps = [
":java_features_proto",
"//:any_proto",
"//:api_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
@ -155,7 +157,9 @@ protobuf_java_export(
maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "//java/lite:pom_template.xml",
resources = [
":java_features_proto",
"//:lite_well_known_protos",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [":lite_bundle"],
@ -170,7 +174,12 @@ proto_library(
name = "java_features_proto",
srcs = ["src/main/java/com/google/protobuf/java_features.proto"],
strip_import_prefix = "/java/core/src/main/java/com",
visibility = ["//pkg:__pkg__"],
visibility = [
"//java/kotlin:__pkg__",
"//java/kotlin-lite:__pkg__",
"//java/lite:__pkg__",
"//pkg:__pkg__",
],
deps = ["//:descriptor_proto"],
)

@ -6,6 +6,7 @@
<arg value="--proto_path=${test.proto.dir}"/>
<arg value="${protobuf.source.dir}/google/protobuf/map_lite_unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_custom_options.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_import.proto"/>
@ -18,8 +19,10 @@
<arg value="${protobuf.source.dir}/google/protobuf/unittest_no_generic_services.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_optimize_for.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3_extensions.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3_optional.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_retention.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_legacy_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/any_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/cached_field_size_test.proto"/>

@ -70,6 +70,11 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
static final int MAX_READ_FROM_CHUNK_SIZE = 0x2000; // 8k
/** Empty {@code ByteString}. */
// There is a class initialization cycle via LiteralByteString -> LeafByteString -> ByteString.
// In practice the only implementation of LeafByteString outside this file is NioByteString,
// and the only public API that creates LeafByteStrings is in ByteString, so ByteString will
// always be initialized first.
@SuppressWarnings("ClassInitializationDeadlock")
public static final ByteString EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY);
/**

@ -8,4 +8,3 @@ public final class JavaEditionDefaults {
private JavaEditionDefaults() {}
}

@ -1315,12 +1315,12 @@ public class DescriptorsTest {
features.setExtension(
UnittestFeatures.test,
features.getExtension(UnittestFeatures.test).toBuilder()
.setIntMultipleFeature(value)
.setMultipleFeature(UnittestFeatures.EnumFeature.forNumber(value))
.build());
}
int getTestFeature(DescriptorProtos.FeatureSet features) {
return features.getExtension(UnittestFeatures.test).getIntMultipleFeature();
return features.getExtension(UnittestFeatures.test).getMultipleFeature().getNumber();
}
FileDescriptor buildFrom(FileDescriptorProto fileProto) throws Exception {

@ -1385,6 +1385,7 @@ public class GeneratedMessageTest {
// =================================================================
// oneof generated code test
@Test
@SuppressWarnings("RedundantSetterCall")
public void testOneofEnumCase() throws Exception {
TestOneof2 message =
TestOneof2.newBuilder().setFooInt(123).setFooString("foo").setFooCord("bar").build();
@ -1400,6 +1401,7 @@ public class GeneratedMessageTest {
}
@Test
@SuppressWarnings("RedundantSetterCall")
public void testSetOneofClearsOthers() throws Exception {
TestOneof2.Builder builder = TestOneof2.newBuilder();
TestOneof2 message = builder.setFooInt(123).setFooString("foo").buildPartial();

@ -24,6 +24,7 @@ import org.junit.runners.JUnit4;
public class LazyMessageLiteTest {
@Test
@SuppressWarnings("RedundantSetterCall")
public void testSetValues() {
LazyNestedInnerMessageLite nested = LazyNestedInnerMessageLite.newBuilder().setNum(3).build();
LazyInnerMessageLite inner =

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package any_test;

@ -6,7 +6,7 @@
// https://developers.google.com/open-source/licenses/bsd
// A regression test for b/74087933
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
@ -17,6 +17,6 @@ option optimize_for = CODE_SIZE;
option java_multiple_files = true;
message TestCachedFieldSizeMessage {
optional protobuf_unittest.TestPackedTypes proto2_child = 1;
optional proto3_unittest.TestPackedTypes proto3_child = 2;
protobuf_unittest.TestPackedTypes proto2_child = 1;
proto3_unittest.TestPackedTypes proto3_child = 2;
}

@ -5,10 +5,11 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package dynamic_message_test;
option features.utf8_validation = NONE;
option java_package = "dynamicmessagetest";
option java_outer_classname = "DynamicMessageTestProto";

@ -5,12 +5,13 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package field_presence_test;
import "google/protobuf/unittest.proto";
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf";
option java_outer_classname = "FieldPresenceTestProto";
@ -20,6 +21,7 @@ message TestAllTypes {
BAR = 1;
BAZ = 2;
}
message NestedMessage {
int32 value = 1;
}
@ -48,7 +50,7 @@ message TestAllTypes {
repeated NestedEnum repeated_nested_enum = 24;
repeated NestedMessage repeated_nested_message = 25;
repeated protobuf_unittest.TestRequired repeated_proto2_message = 26;
repeated NestedEnum packed_nested_enum = 27 [packed = true];
repeated NestedEnum packed_nested_enum = 27;
}
message TestOptionalFieldsOnly {

@ -9,15 +9,19 @@
//
// A proto file with lazy fields
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
option features.utf8_validation = NONE;
message LazyMessageLite {
optional int32 num = 1;
optional int32 num_with_default = 2 [default = 421];
optional LazyInnerMessageLite inner = 3 [lazy = true];
repeated LazyInnerMessageLite repeated_inner = 4 ;
int32 num = 1;
int32 num_with_default = 2 [default = 421];
LazyInnerMessageLite inner = 3 [lazy = true];
repeated LazyInnerMessageLite repeated_inner = 4;
oneof oneof_field {
int32 oneof_num = 5;
@ -26,21 +30,23 @@ message LazyMessageLite {
}
message LazyInnerMessageLite {
optional int32 num = 1;
optional int32 num_with_default = 2 [default = 42];
optional LazyNestedInnerMessageLite nested = 3 [lazy = true];
int32 num = 1;
int32 num_with_default = 2 [default = 42];
LazyNestedInnerMessageLite nested = 3 [lazy = true];
extensions 1000 to max;
}
message LazyExtension {
extend LazyInnerMessageLite {
optional LazyExtension extension = 1000;
LazyExtension extension = 1000;
}
optional string name = 1;
string name = 1;
}
message LazyNestedInnerMessageLite {
optional int32 num = 1;
optional int32 num_with_default = 2 [default = 4];
int32 num = 1;
int32 num_with_default = 2 [default = 4];
}

@ -7,10 +7,11 @@
// Author: pbogle@google.com (Phil Bogle)
syntax = "proto2";
edition = "2023";
package protobuf_unittest.lite_equals_and_hash;
option features.utf8_validation = NONE;
message TestOneofEquals {
oneof oneof_field {
@ -20,15 +21,18 @@ message TestOneofEquals {
}
message Foo {
optional int32 value = 1;
int32 value = 1;
repeated Bar bar = 2;
map<string, string> my_map = 3;
oneof Single {
sint64 sint64 = 4;
// LINT: ALLOW_GROUPS
group MyGroup = 5 {
optional int32 value = 1;
}
MyGroup mygroup = 5 [features.message_encoding = DELIMITED];
}
// LINT: ALLOW_GROUPS
message MyGroup {
int32 value = 1;
}
extensions 100 to max;
@ -36,25 +40,27 @@ message Foo {
message Bar {
extend Foo {
optional Bar foo_ext = 100;
Bar foo_ext = 100;
}
optional string name = 1;
string name = 1;
}
message BarPrime {
optional string name = 1;
string name = 1;
}
message Empty {}
extend Foo {
optional int32 varint = 101;
optional fixed32 fixed32 = 102;
optional fixed64 fixed64 = 103;
optional group MyGroup = 104 {
optional string group_value = 1;
}
int32 varint = 101;
fixed32 fixed32 = 102;
fixed64 fixed64 = 103;
MyGroup mygroup = 104 [features.message_encoding = DELIMITED];
}
message MyGroup {
string group_value = 1;
}
message TestRecursiveOneof {

@ -5,18 +5,21 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package map_for_proto2_lite_test;
option features.enum_type = CLOSED;
option features.utf8_validation = NONE;
option java_outer_classname = "MapForProto2TestProto";
option optimize_for = LITE_RUNTIME;
option java_package = "map_lite_test";
message TestMap {
message MessageValue {
optional int32 value = 1;
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -32,8 +35,9 @@ message TestMap {
map<string, int32> string_to_int32_field = 6;
message MessageWithRequiredFields {
required int32 value = 1;
int32 value = 1 [features.field_presence = LEGACY_REQUIRED];
}
map<int32, MessageWithRequiredFields> required_message_map = 11;
}
@ -46,7 +50,7 @@ message TestUnknownEnumValue {
// Test that the maps initialization code works correctly when the map field
// references the containing message.
message TestRecursiveMap {
optional int32 value = 1;
int32 value = 1;
map<int32, TestRecursiveMap> recursive_map_field = 2;
}
@ -54,14 +58,19 @@ message TestRecursiveMap {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -77,11 +86,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -91,17 +103,21 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}

@ -5,17 +5,20 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package map_for_proto2_test;
option features.enum_type = CLOSED;
option features.utf8_validation = NONE;
option java_package = "map_test";
option java_outer_classname = "MapForProto2TestProto";
message TestMap {
message MessageValue {
optional int32 value = 1;
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -31,8 +34,9 @@ message TestMap {
map<string, int32> string_to_int32_field = 6;
message MessageWithRequiredFields {
required int32 value = 1;
int32 value = 1 [features.field_presence = LEGACY_REQUIRED];
}
map<int32, MessageWithRequiredFields> required_message_map = 11;
}
@ -45,7 +49,7 @@ message TestUnknownEnumValue {
// Test that the maps initialization code works correctly when the map field
// references the containing message.
message TestRecursiveMap {
optional int32 value = 1;
int32 value = 1;
map<int32, TestRecursiveMap> recursive_map_field = 2;
}
@ -53,14 +57,19 @@ message TestRecursiveMap {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -76,11 +85,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -90,17 +102,21 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}

@ -14,10 +14,11 @@
// a. getDescriptor() is called on another message in the same file.
// b. use protobuf reflection to access the map field.
// The symptom is a NullPointerException being thrown.
syntax = "proto2";
edition = "2023";
package map_test;
option features.utf8_validation = NONE;
option java_package = "map_test";
option java_outer_classname = "MapInitializationOrderTest";
option java_multiple_files = true;
@ -27,11 +28,12 @@ option java_multiple_files = true;
message Message1 {
map<string, bool> map_field = 1;
extensions 1000 to max;
}
extend Message1 {
optional Message1 recursive_extension = 1001;
Message1 recursive_extension = 1001;
}
message RedactAllTypes {}

@ -5,10 +5,12 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package map_lite_test;
option features.field_presence = IMPLICIT;
option optimize_for = LITE_RUNTIME;
option java_package = "map_lite_test";
option java_outer_classname = "MapTestProto";
@ -17,6 +19,7 @@ message TestMap {
message MessageValue {
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -45,14 +48,19 @@ message TestOnChangeEventPropagation {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -68,11 +76,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -82,22 +93,26 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string,string> my_map = 1;
map<string, string> my_map = 1;
}

@ -5,10 +5,12 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package map_test;
option features.field_presence = IMPLICIT;
option java_package = "map_test";
option java_outer_classname = "MapTestProto";
@ -16,6 +18,7 @@ message TestMap {
message MessageValue {
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -44,14 +47,19 @@ message TestOnChangeEventPropagation {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -67,11 +75,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -81,22 +92,26 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string,string> my_map = 1;
map<string, string> my_map = 1;
}

@ -9,7 +9,7 @@
//
// A proto file which tests the java_multiple_files option.
syntax = "proto2";
edition = "2023";
// Some generic_services option(s) added automatically.
// See: http://go/proto2-generic-services-default
@ -18,29 +18,33 @@ package protobuf_unittest;
import "google/protobuf/descriptor.proto";
import "google/protobuf/unittest.proto";
option features.enum_type = CLOSED;
option java_generic_services = true; // auto-added
option java_multiple_files = true;
option java_outer_classname = "MultipleFilesTestProto";
message MessageWithNoOuter {
message NestedMessage {
optional int32 i = 1;
int32 i = 1;
}
enum NestedEnum {
BAZ = 3;
}
optional NestedMessage nested = 1;
NestedMessage nested = 1;
repeated TestAllTypes foreign = 2;
optional NestedEnum nested_enum = 3;
optional EnumWithNoOuter foreign_enum = 4;
NestedEnum nested_enum = 3;
EnumWithNoOuter foreign_enum = 4;
}
extend google.protobuf.EnumValueOptions {
optional int32 enum_value_option = 7654321;
int32 enum_value_option = 7654321;
}
enum EnumWithNoOuter {
FOO = 1 [(enum_value_option) = 12345];
BAR = 2;
}
@ -49,5 +53,5 @@ service ServiceWithNoOuter {
}
extend TestAllExtensions {
optional int32 extension_with_outer = 1234567;
int32 extension_with_outer = 1234567;
}

@ -6,8 +6,7 @@
// https://developers.google.com/open-source/licenses/bsd
// Author: jonp@google.com (Jon Perlow)
//
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
@ -15,21 +14,21 @@ option java_multiple_files = true;
option java_outer_classname = "NestedBuilders";
message Vehicle {
optional Engine engine = 1;
Engine engine = 1;
repeated Wheel wheel = 2;
}
message Engine {
optional int32 cylinder = 1;
optional int32 liters = 2;
optional TimingBelt timing_belt = 3;
int32 cylinder = 1;
int32 liters = 2;
TimingBelt timing_belt = 3;
}
message TimingBelt {
optional int32 number_of_teeth = 1;
int32 number_of_teeth = 1;
}
message Wheel {
optional int32 radius = 1;
optional int32 width = 2;
int32 radius = 1;
int32 width = 2;
}

@ -10,7 +10,9 @@
// A proto file with nested extensions. Note that this must be defined in
// a separate file to properly test the initialization of the outer class.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
@ -19,7 +21,7 @@ import "com/google/protobuf/non_nested_extension.proto";
message MyNestedExtension {
extend MessageToBeExtended {
optional MessageToBeExtended recursiveExtension = 2;
optional int32 default = 2002;
MessageToBeExtended recursiveExtension = 2;
int32 default = 2002;
}
}

@ -11,7 +11,9 @@
// this must be defined in a separate file to properly test the initialization
// of the outer class.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
@ -21,7 +23,7 @@ option optimize_for = LITE_RUNTIME;
message MyNestedExtensionLite {
extend MessageLiteToBeExtended {
optional MessageLiteToBeExtended recursiveExtensionLite = 3;
optional double private = 2004;
MessageLiteToBeExtended recursiveExtensionLite = 3;
double private = 2004;
}
}

@ -9,10 +9,13 @@
//
// A proto file with extensions.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
option features.utf8_validation = NONE;
message MessageToBeExtended {
extensions 1 to max;
@ -21,6 +24,6 @@ message MessageToBeExtended {
message MyNonNestedExtension {}
extend MessageToBeExtended {
optional MyNonNestedExtension nonNestedExtension = 1;
optional string if = 2000;
MyNonNestedExtension nonNestedExtension = 1;
string if = 2000;
}

@ -9,7 +9,9 @@
//
// A proto file with extensions for a MessageLite messages.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
@ -22,6 +24,6 @@ message MessageLiteToBeExtended {
message MyNonNestedExtensionLite {}
extend MessageLiteToBeExtended {
optional MyNonNestedExtensionLite nonNestedExtensionLite = 1;
optional bool package = 2006;
MyNonNestedExtensionLite nonNestedExtensionLite = 1;
bool package = 2006;
}

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package protobuf_unittest;

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package protobuf_unittest;

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
@ -15,6 +15,10 @@ message TestMessage3 {
// This enum's name is the same with the default outer class name of this
// proto file. It's used to test if the compiler can avoid this conflict
// correctly.
enum OuterClassNameTest3 { DUMMY_VALUE = 1; }
enum OuterClassNameTest3 {
option features.enum_type = CLOSED;
DUMMY_VALUE = 1;
}
}
}

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package packed_field_test;
@ -36,18 +36,45 @@ message TestAllTypes {
}
message TestUnpackedTypes {
repeated int32 repeated_int32 = 1 [packed = false];
repeated int64 repeated_int64 = 2 [packed = false];
repeated uint32 repeated_uint32 = 3 [packed = false];
repeated uint64 repeated_uint64 = 4 [packed = false];
repeated sint32 repeated_sint32 = 5 [packed = false];
repeated sint64 repeated_sint64 = 6 [packed = false];
repeated fixed32 repeated_fixed32 = 7 [packed = false];
repeated fixed64 repeated_fixed64 = 8 [packed = false];
repeated sfixed32 repeated_sfixed32 = 9 [packed = false];
repeated sfixed64 repeated_sfixed64 = 10 [packed = false];
repeated float repeated_float = 11 [packed = false];
repeated double repeated_double = 12 [packed = false];
repeated bool repeated_bool = 13 [packed = false];
repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false];
repeated int32 repeated_int32 = 1
[features.repeated_field_encoding = EXPANDED];
repeated int64 repeated_int64 = 2
[features.repeated_field_encoding = EXPANDED];
repeated uint32 repeated_uint32 = 3
[features.repeated_field_encoding = EXPANDED];
repeated uint64 repeated_uint64 = 4
[features.repeated_field_encoding = EXPANDED];
repeated sint32 repeated_sint32 = 5
[features.repeated_field_encoding = EXPANDED];
repeated sint64 repeated_sint64 = 6
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 repeated_fixed32 = 7
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 repeated_fixed64 = 8
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 repeated_sfixed32 = 9
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 repeated_sfixed64 = 10
[features.repeated_field_encoding = EXPANDED];
repeated float repeated_float = 11
[features.repeated_field_encoding = EXPANDED];
repeated double repeated_double = 12
[features.repeated_field_encoding = EXPANDED];
repeated bool repeated_bool = 13
[features.repeated_field_encoding = EXPANDED];
repeated TestAllTypes.NestedEnum repeated_nested_enum = 14
[features.repeated_field_encoding = EXPANDED];
}

@ -6,82 +6,121 @@
// https://developers.google.com/open-source/licenses/bsd
// LINT: ALLOW_GROUPS
syntax = "proto2";
edition = "2023";
package protobuf.experimental;
option features.utf8_validation = NONE;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto2Testing";
message Proto2SpecialFieldName {
optional double regular_name = 1;
optional int32 cached_size = 2;
optional int64 serialized_size = 3;
optional string class = 4;
double regular_name = 1;
int32 cached_size = 2;
int64 serialized_size = 3;
string class = 4;
}
message Proto2Message {
enum TestEnum {
option features.enum_type = CLOSED;
ZERO = 0;
ONE = 1;
TWO = 2;
}
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2Message field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2Message field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2Message field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2Message field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
message FieldGroup49 {
int32 field_int32_50 = 50;
}
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;
@ -99,35 +138,75 @@ message Proto2Message {
sfixed64 field_sfixed64_66 = 66;
sint32 field_sint32_67 = 67;
sint64 field_sint64_68 = 68;
group FieldGroup69 = 69 {
optional int32 field_int32_70 = 70;
}
FieldGroup69 fieldgroup69 = 69 [features.message_encoding = DELIMITED];
}
message FieldGroup69 {
int32 field_int32_70 = 70;
}
message RequiredNestedMessage {
optional int32 value = 1;
int32 value = 1;
}
required double field_required_double_71 = 71;
required float field_required_float_72 = 72;
required int64 field_required_int64_73 = 73;
required uint64 field_required_uint64_74 = 74;
required int32 field_required_int32_75 = 75;
required fixed64 field_required_fixed64_76 = 76;
required fixed32 field_required_fixed32_77 = 77;
required bool field_required_bool_78 = 78;
required string field_required_string_79 = 79;
required RequiredNestedMessage field_required_message_80 = 80;
required bytes field_required_bytes_81 = 81;
required uint32 field_required_uint32_82 = 82;
required TestEnum field_required_enum_83 = 83;
required sfixed32 field_required_sfixed32_84 = 84;
required sfixed64 field_required_sfixed64_85 = 85;
required sint32 field_required_sint32_86 = 86;
required sint64 field_required_sint64_87 = 87;
required group FieldRequiredGroup88 = 88 {
optional int32 field_int32_89 = 89;
double field_required_double_71 = 71
[features.field_presence = LEGACY_REQUIRED];
float field_required_float_72 = 72
[features.field_presence = LEGACY_REQUIRED];
int64 field_required_int64_73 = 73
[features.field_presence = LEGACY_REQUIRED];
uint64 field_required_uint64_74 = 74
[features.field_presence = LEGACY_REQUIRED];
int32 field_required_int32_75 = 75
[features.field_presence = LEGACY_REQUIRED];
fixed64 field_required_fixed64_76 = 76
[features.field_presence = LEGACY_REQUIRED];
fixed32 field_required_fixed32_77 = 77
[features.field_presence = LEGACY_REQUIRED];
bool field_required_bool_78 = 78 [features.field_presence = LEGACY_REQUIRED];
string field_required_string_79 = 79
[features.field_presence = LEGACY_REQUIRED];
RequiredNestedMessage field_required_message_80 = 80
[features.field_presence = LEGACY_REQUIRED];
bytes field_required_bytes_81 = 81
[features.field_presence = LEGACY_REQUIRED];
uint32 field_required_uint32_82 = 82
[features.field_presence = LEGACY_REQUIRED];
TestEnum field_required_enum_83 = 83
[features.field_presence = LEGACY_REQUIRED];
sfixed32 field_required_sfixed32_84 = 84
[features.field_presence = LEGACY_REQUIRED];
sfixed64 field_required_sfixed64_85 = 85
[features.field_presence = LEGACY_REQUIRED];
sint32 field_required_sint32_86 = 86
[features.field_presence = LEGACY_REQUIRED];
sint64 field_required_sint64_87 = 87
[features.field_presence = LEGACY_REQUIRED];
message FieldRequiredGroup88 {
int32 field_int32_89 = 89;
}
FieldRequiredGroup88 fieldrequiredgroup88 = 88 [
features.field_presence = LEGACY_REQUIRED,
features.message_encoding = DELIMITED
];
}
message Proto2Empty {}
@ -137,65 +216,94 @@ message Proto2MessageWithExtensions {
}
extend Proto2MessageWithExtensions {
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2Message field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional Proto2Message.TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2Message field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated Proto2Message.TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated Proto2Message.TestEnum field_enum_list_packed_44 = 44
[packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
}
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2Message field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
Proto2Message.TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
}
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2Message field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated Proto2Message.TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated Proto2Message.TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
}
message FieldGroup49 {
int32 field_int32_50 = 50;
}
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
message Proto2MessageWithMaps {

@ -6,75 +6,114 @@
// https://developers.google.com/open-source/licenses/bsd
// LINT: ALLOW_GROUPS
syntax = "proto2";
edition = "2023";
package protobuf.experimental.lite;
option features.utf8_validation = NONE;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto2TestingLite";
message Proto2MessageLite {
enum TestEnum {
option features.enum_type = CLOSED;
ZERO = 0;
ONE = 1;
TWO = 2;
}
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2MessageLite field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2MessageLite field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2MessageLite field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2MessageLite field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
message FieldGroup49 {
int32 field_int32_50 = 50;
}
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;
@ -92,35 +131,75 @@ message Proto2MessageLite {
sfixed64 field_sfixed64_66 = 66;
sint32 field_sint32_67 = 67;
sint64 field_sint64_68 = 68;
group FieldGroup69 = 69 {
optional int32 field_int32_70 = 70;
}
FieldGroup69 fieldgroup69 = 69 [features.message_encoding = DELIMITED];
}
message FieldGroup69 {
int32 field_int32_70 = 70;
}
message RequiredNestedMessage {
optional int32 value = 1;
int32 value = 1;
}
required double field_required_double_71 = 71;
required float field_required_float_72 = 72;
required int64 field_required_int64_73 = 73;
required uint64 field_required_uint64_74 = 74;
required int32 field_required_int32_75 = 75;
required fixed64 field_required_fixed64_76 = 76;
required fixed32 field_required_fixed32_77 = 77;
required bool field_required_bool_78 = 78;
required string field_required_string_79 = 79;
required RequiredNestedMessage field_required_message_80 = 80;
required bytes field_required_bytes_81 = 81;
required uint32 field_required_uint32_82 = 82;
required TestEnum field_required_enum_83 = 83;
required sfixed32 field_required_sfixed32_84 = 84;
required sfixed64 field_required_sfixed64_85 = 85;
required sint32 field_required_sint32_86 = 86;
required sint64 field_required_sint64_87 = 87;
required group FieldRequiredGroup88 = 88 {
optional int32 field_int32_89 = 89;
double field_required_double_71 = 71
[features.field_presence = LEGACY_REQUIRED];
float field_required_float_72 = 72
[features.field_presence = LEGACY_REQUIRED];
int64 field_required_int64_73 = 73
[features.field_presence = LEGACY_REQUIRED];
uint64 field_required_uint64_74 = 74
[features.field_presence = LEGACY_REQUIRED];
int32 field_required_int32_75 = 75
[features.field_presence = LEGACY_REQUIRED];
fixed64 field_required_fixed64_76 = 76
[features.field_presence = LEGACY_REQUIRED];
fixed32 field_required_fixed32_77 = 77
[features.field_presence = LEGACY_REQUIRED];
bool field_required_bool_78 = 78 [features.field_presence = LEGACY_REQUIRED];
string field_required_string_79 = 79
[features.field_presence = LEGACY_REQUIRED];
RequiredNestedMessage field_required_message_80 = 80
[features.field_presence = LEGACY_REQUIRED];
bytes field_required_bytes_81 = 81
[features.field_presence = LEGACY_REQUIRED];
uint32 field_required_uint32_82 = 82
[features.field_presence = LEGACY_REQUIRED];
TestEnum field_required_enum_83 = 83
[features.field_presence = LEGACY_REQUIRED];
sfixed32 field_required_sfixed32_84 = 84
[features.field_presence = LEGACY_REQUIRED];
sfixed64 field_required_sfixed64_85 = 85
[features.field_presence = LEGACY_REQUIRED];
sint32 field_required_sint32_86 = 86
[features.field_presence = LEGACY_REQUIRED];
sint64 field_required_sint64_87 = 87
[features.field_presence = LEGACY_REQUIRED];
message FieldRequiredGroup88 {
int32 field_int32_89 = 89;
}
FieldRequiredGroup88 fieldrequiredgroup88 = 88 [
features.field_presence = LEGACY_REQUIRED,
features.message_encoding = DELIMITED
];
}
message Proto2EmptyLite {}
@ -130,65 +209,94 @@ message Proto2MessageLiteWithExtensions {
}
extend Proto2MessageLiteWithExtensions {
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2MessageLite field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional Proto2MessageLite.TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2MessageLite field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated Proto2MessageLite.TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated Proto2MessageLite.TestEnum field_enum_list_packed_44 = 44
[packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
}
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2MessageLite field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
Proto2MessageLite.TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
}
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2MessageLite field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated Proto2MessageLite.TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated Proto2MessageLite.TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
}
message FieldGroup49 {
int32 field_int32_50 = 50;
}
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
message Proto2MessageLiteWithMaps {

@ -5,15 +5,16 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package protobuf.testing.textformat.performance.proto2;
option features.repeated_field_encoding = EXPANDED;
option java_package = "com.google.protobuf.testing.textformat.performance.proto2";
option java_outer_classname = "Proto2TextFormatPerformanceProto";
message ContainsSubMessageWithRepeatedInt32 {
optional RepeatedInt32 sub_msg = 1;
RepeatedInt32 sub_msg = 1;
}
message RepeatedInt32 {
@ -25,5 +26,5 @@ message ContainsExtensionSubMessage {
}
extend ContainsExtensionSubMessage {
optional RepeatedInt32 sub_msg_ext = 1;
RepeatedInt32 sub_msg_ext = 1;
}

@ -5,10 +5,11 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package proto2_unknown_enum_values;
option features.enum_type = CLOSED;
option java_package = "com.google.protobuf";
option java_outer_classname = "Proto2UnknownEnumValuesTestProto";
@ -19,7 +20,7 @@ enum Proto2TestEnum {
}
message Proto2EnumMessage {
repeated Proto2TestEnum repeated_packed_enum = 1 [packed = true];
repeated Proto2TestEnum repeated_packed_enum = 1;
}
// An enum containing a subset of the values of Proto2TestEnum, to test
@ -27,11 +28,12 @@ message Proto2EnumMessage {
enum Proto2TestEnumSubset {
TESTENUM_SUBSET_ZERO = 0;
TESTENUM_SUBSET_ONE = 1;
// No enum value with number 2.
}
// Test messages for packed enum, with identical field number as
// Proto2Message, to test parsing unknown packed enums.
message Proto2EnumMessageWithEnumSubset {
repeated Proto2TestEnumSubset repeated_packed_enum = 1 [packed = true];
repeated Proto2TestEnumSubset repeated_packed_enum = 1;
}

@ -5,10 +5,11 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package protobuf.experimental;
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto3Testing";
@ -43,37 +44,72 @@ message Proto3Message {
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto3Message field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26
[features.repeated_field_encoding = EXPANDED];
repeated Proto3Message field_message_list_27 = 27
[features.repeated_field_encoding = EXPANDED];
repeated bytes field_bytes_list_28 = 28
[features.repeated_field_encoding = EXPANDED];
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;

@ -5,10 +5,11 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package protobuf.experimental;
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto3TestingLite";
@ -36,37 +37,72 @@ message Proto3MessageLite {
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto3MessageLite field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26
[features.repeated_field_encoding = EXPANDED];
repeated Proto3MessageLite field_message_list_27 = 27
[features.repeated_field_encoding = EXPANDED];
repeated bytes field_bytes_list_28 = 28
[features.repeated_field_encoding = EXPANDED];
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;

@ -5,7 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package protobuf.testing.textformat.performance.proto3;
@ -13,7 +13,7 @@ option java_package = "com.google.protobuf.testing.textformat.performance.proto3
option java_outer_classname = "Proto3TextFormatPerformanceProto";
message ContainsSubMessageWithRepeatedInt32 {
optional RepeatedInt32 sub_msg = 1;
RepeatedInt32 sub_msg = 1;
}
message RepeatedInt32 {

@ -11,10 +11,13 @@
// though the same identifiers are used internally by the java code generator.
// LINT: LEGACY_NAMES
syntax = "proto2";
edition = "2023";
package io_protocol_tests;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option features.enum_type = CLOSED;
option java_generic_services = true; // auto-added
option java_package = "com.google.protobuf";
option java_outer_classname = "TestBadIdentifiersProto";
@ -24,19 +27,19 @@ option java_outer_classname = "TestBadIdentifiersProto";
// src/google/protobuf/compiler/java/java_helpers.cc
message ForbiddenWordsUnderscoreMessage {
// java.lang.Object
optional bool class = 1;
bool class = 1;
// com.google.protobuf.MessageLiteOrBuilder
optional bool default_instance_for_type = 2;
bool default_instance_for_type = 2;
// com.google.protobuf.MessageLite
optional bool parser_for_type = 3;
optional bool serialized_size = 4;
bool parser_for_type = 3;
bool serialized_size = 4;
// com.google.protobuf.MessageOrBuilder
optional bool all_fields = 5;
optional bool descriptor_for_type = 6;
optional bool initialization_error_string = 7;
optional bool unknown_fields = 8;
bool all_fields = 5;
bool descriptor_for_type = 6;
bool initialization_error_string = 7;
bool unknown_fields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool cached_size = 9;
bool cached_size = 9;
}
// Message with field names using leading underscores that conflict with
@ -44,20 +47,20 @@ message ForbiddenWordsUnderscoreMessage {
// src/google/protobuf/compiler/java/java_helpers.cc
message ForbiddenWordsLeadingUnderscoreMessage {
// java.lang.Object
optional bool _class = 1;
bool _class = 1;
// com.google.protobuf.MessageLiteOrBuilder
optional bool _default_instance_for_type = 2;
bool _default_instance_for_type = 2;
// com.google.protobuf.MessageLite
optional bool _parser_for_type = 3;
optional bool _serialized_size = 4;
bool _parser_for_type = 3;
bool _serialized_size = 4;
// com.google.protobuf.MessageOrBuilder
optional bool _all_fields = 5;
optional bool _descriptor_for_type = 6;
optional bool _initialization_error_string = 7;
bool _all_fields = 5;
bool _descriptor_for_type = 6;
bool _initialization_error_string = 7;
// TODO: re-enable
// optional bool _unknown_fields = 8;
// bool _unknown_fields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool _cached_size = 9;
bool _cached_size = 9;
}
// Message with field names in camel case that conflict with accessors in the
@ -65,32 +68,32 @@ message ForbiddenWordsLeadingUnderscoreMessage {
// src/google/protobuf/compiler/java/java_helpers.cc
message ForbiddenWordsCamelMessage {
// java.lang.Object
optional bool class = 1;
bool class = 1;
// com.google.protobuf.MessageLiteOrBuilder
optional bool defaultInstanceForType = 2;
bool defaultInstanceForType = 2;
// com.google.protobuf.MessageLite
optional bool serializedSize = 3;
optional bool parserForType = 4;
bool serializedSize = 3;
bool parserForType = 4;
// com.google.protobuf.MessageOrBuilder:
optional bool initializationErrorString = 5;
optional bool descriptorForType = 6;
optional bool allFields = 7;
bool initializationErrorString = 5;
bool descriptorForType = 6;
bool allFields = 7;
// TODO: re-enable
// optional bool unknownFields = 8;
// bool unknownFields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool cachedSize = 9;
bool cachedSize = 9;
}
message Descriptor {
option no_standard_descriptor_accessor = true;
optional string descriptor = 1;
string descriptor = 1;
message NestedDescriptor {
option no_standard_descriptor_accessor = true;
optional string descriptor = 1;
string descriptor = 1;
}
optional NestedDescriptor nested_descriptor = 2;
NestedDescriptor nested_descriptor = 2;
enum NestedEnum {
UNKNOWN = 0;
FOO = 1;
@ -102,7 +105,7 @@ message Parser {
UNKNOWN = 0;
PARSER = 1;
}
optional ParserEnum parser = 1;
ParserEnum parser = 1;
}
message Deprecated {
@ -114,38 +117,38 @@ message Deprecated {
BAR = 2 [deprecated = true];
}
optional int32 field1 = 1 [deprecated = true];
optional TestEnum field2 = 2 [deprecated = true];
optional ForbiddenWordsUnderscoreMessage field3 = 3 [deprecated = true];
int32 field1 = 1 [deprecated = true];
TestEnum field2 = 2 [deprecated = true];
ForbiddenWordsUnderscoreMessage field3 = 3 [deprecated = true];
}
message Override {
optional int32 override = 1;
int32 override = 1;
}
message Object {
optional int32 object = 1;
optional string string_object = 2;
int32 object = 1;
string string_object = 2;
}
message String {
optional string string = 1;
string string = 1;
}
message Integer {
optional int32 integer = 1;
int32 integer = 1;
}
message Long {
optional int32 long = 1;
int32 long = 1;
}
message Float {
optional float float = 1;
float float = 1;
}
message Double {
optional double double = 1;
double double = 1;
}
service TestConflictingMethodNames {
@ -168,11 +171,11 @@ message TestConflictingFieldNames {
repeated bytes bytes_field = 4;
repeated ForbiddenWordsUnderscoreMessage message_field = 5;
optional int32 int32_field_count = 11;
optional TestEnum enum_field_count = 12;
optional string string_field_count = 13;
optional bytes bytes_field_count = 14;
optional ForbiddenWordsUnderscoreMessage message_field_count = 15;
int32 int32_field_count = 11;
TestEnum enum_field_count = 12;
string string_field_count = 13;
bytes bytes_field_count = 14;
ForbiddenWordsUnderscoreMessage message_field_count = 15;
repeated int32 Int32Field = 21; // NO_PROTO3
repeated TestEnum EnumField = 22; // NO_PROTO3
@ -182,13 +185,14 @@ message TestConflictingFieldNames {
// This field conflicts with "int32_field" as they both generate
// the method getInt32FieldList().
required int32 int32_field_list = 31; // NO_PROTO3
int32 int32_field_list = 31
[features.field_presence = LEGACY_REQUIRED]; // NO_PROTO3
// These field pairs have the same Java converted name
optional string field_name = 32; // NO_PROTO3
optional string field__name = 33; // NO_PROTO3
optional int32 _2conflict = 34; // NO_PROTO3
optional int32 __2conflict = 35;
string field_name = 32; // NO_PROTO3
string field__name = 33; // NO_PROTO3
int32 _2conflict = 34; // NO_PROTO3
int32 __2conflict = 35;
extensions 1000 to max; // NO_PROTO3
@ -196,9 +200,9 @@ message TestConflictingFieldNames {
extend TestConflictingFieldNames { // NO_PROTO3
// We don't generate accessors for extensions so the following extension
// fields don't conflict with the repeated field "int64_field".
optional int64 int64_field_count = 1001; // NO_PROTO3
optional int64 int64_field_list = 1002; // NO_PROTO3
} // NO_PROTO3
int64 int64_field_count = 1001; // NO_PROTO3
int64 int64_field_list = 1002; // NO_PROTO3
} // NO_PROTO3
}
message TestMapField {
@ -210,12 +214,12 @@ message TestMapField {
}
message TestLeadingNumberFields {
optional int32 _30day_impressions = 1;
int32 _30day_impressions = 1;
repeated string _60day_impressions = 2;
optional string __2_underscores = 3;
string __2_underscores = 3;
repeated string __2repeated_underscores = 4;
optional int32 _32 = 32;
int32 _32 = 32;
repeated int64 _64 = 64;
}

@ -8,21 +8,23 @@
// Author: Jacob Butcher (jbaum@google.com)
//
// Test file option java_string_check_utf8.
syntax = "proto2";
edition = "2023";
package proto2_test_check_utf8;
option features.utf8_validation = VERIFY;
option java_outer_classname = "TestCheckUtf8";
option java_string_check_utf8 = true;
message StringWrapper {
required string req = 1;
optional string opt = 2;
string req = 1 [features.field_presence = LEGACY_REQUIRED];
string opt = 2;
repeated string rep = 3;
}
message BytesWrapper {
required bytes req = 1;
optional bytes opt = 2;
bytes req = 1 [features.field_presence = LEGACY_REQUIRED];
bytes opt = 2;
repeated bytes rep = 3;
}

@ -8,22 +8,24 @@
// Author: Jacob Butcher (jbaum@google.com)
//
// Test file option java_string_check_utf8.
syntax = "proto2";
edition = "2023";
package proto2_test_check_utf8_size;
option features.utf8_validation = VERIFY;
option java_outer_classname = "TestCheckUtf8Size";
option java_string_check_utf8 = true;
option optimize_for = CODE_SIZE;
message StringWrapperSize {
required string req = 1;
optional string opt = 2;
string req = 1 [features.field_presence = LEGACY_REQUIRED];
string opt = 2;
repeated string rep = 3;
}
message BytesWrapperSize {
required bytes req = 1;
optional bytes opt = 2;
bytes req = 1 [features.field_presence = LEGACY_REQUIRED];
bytes opt = 2;
repeated bytes rep = 3;
}

@ -5,12 +5,13 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package wrappers_test;
import "google/protobuf/wrappers.proto";
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf.wrapperstest";
option java_outer_classname = "WrappersTestProto";

@ -22,6 +22,7 @@ internal_gen_kt_protos(
deps = [
"//:any_proto",
"//:api_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
@ -30,6 +31,7 @@ internal_gen_kt_protos(
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
"//java/core:java_features_proto",
],
)
@ -53,7 +55,11 @@ kt_jvm_export(
],
maven_coordinates = "com.google.protobuf:protobuf-kotlin-lite:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "//java/kotlin-lite:pom_template.xml",
resources = ["//:well_known_type_protos"],
resources = [
"//:well_known_type_protos",
"//java/core:java_features_proto",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [
":lite_extensions",

@ -4,8 +4,11 @@
<exec executable="${protoc}">
<arg value="--kotlin_out=lite:${generated.sources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.java_source.dir}"/>
<arg value="${protobuf.java_source.dir}/main/java/com/google/protobuf/java_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>

@ -60,6 +60,7 @@ kt_jvm_export(
pom_template = "//java/kotlin:pom_template.xml",
resources = [
"//:well_known_type_protos",
"//java/core:java_features_proto",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
@ -319,6 +320,7 @@ internal_gen_kt_protos(
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
"//java/core:java_features_proto",
],
)

@ -4,6 +4,8 @@
<exec executable="${protoc}">
<arg value="--kotlin_out=${generated.sources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.java_source.dir}"/>
<arg value="${protobuf.java_source.dir}/main/java/com/google/protobuf/java_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>

@ -24,6 +24,7 @@ proto_lang_toolchain(
name = "toolchain",
# keep this in sync w/ LITE_WELL_KNOWN_PROTO_MAP in //:BUILD
blacklisted_protos = [
"//java/core:java_features_proto",
"//:any_proto",
"//:api_proto",
"//:duration_proto",
@ -60,6 +61,7 @@ build_test(
conformance_test(
name = "conformance_test",
failure_list = "//conformance:failure_list_java_lite.txt",
maximum_edition = "2023",
testee = "//conformance:conformance_java_lite",
text_format_failure_list = "//conformance:text_format_failure_list_java_lite.txt",
)

@ -4,8 +4,11 @@
<exec executable="${protoc}">
<arg value="--java_out=lite:${generated.sources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.java_source.dir}"/>
<arg value="${protobuf.java_source.dir}/main/java/com/google/protobuf/java_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>

@ -47,6 +47,7 @@
<includes>
<include>google/protobuf/any.proto</include>
<include>google/protobuf/api.proto</include>
<include>google/protobuf/descriptor.proto</include>
<include>google/protobuf/duration.proto</include>
<include>google/protobuf/empty.proto</include>
<include>google/protobuf/field_mask.proto</include>
@ -57,6 +58,12 @@
<include>google/protobuf/wrappers.proto</include>
</includes>
</resource>
<resource>
<directory>${protobuf.java_source.dir}</directory>
<includes>
<include>main/java/com/google/protobuf/java_features.proto</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
@ -214,6 +221,7 @@
<exclude>GeneratedMessageTest.java</exclude>
<exclude>LazyFieldTest.java</exclude>
<exclude>LazyStringEndToEndTest.java</exclude>
<exclude>LazilyParsedMessageSetTest.java</exclude>
<exclude>MapForProto2Test.java</exclude>
<exclude>MapTest.java</exclude>
<exclude>MessageTest.java</exclude>

@ -174,7 +174,7 @@ def _osgi_jar_impl(ctx):
source_jars = source_jars.to_list()
if len(source_jars) > 1:
fail("osgi_jar rule doesn't know how to deal with more than one source jar.")
source_jar = target_java_output.source_jars[0]
source_jar = source_jars[0]
output_jar = ctx.outputs.output_jar

@ -88,6 +88,7 @@
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=src/test/proto"/>
<arg value="src/test/proto/com/google/protobuf/util/json_test.proto"/>
<arg value="src/test/proto/com/google/protobuf/util/json_test_proto2.proto"/>
</exec>
</target>
</configuration>

@ -124,7 +124,6 @@ _lua_proto_library_aspect = aspect(
)
lua_proto_library = rule(
output_to_genfiles = True,
implementation = _lua_proto_rule_impl,
attrs = {
"deps": attr.label_list(

@ -305,10 +305,10 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
/* Disable proto2 arena behavior (TEMPORARY) **********************************/
#ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
#ifdef UPB_DISABLE_CLOSED_ENUM_CHECKING
#define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 1
#else
#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
#define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 0
#endif
#if defined(__cplusplus)
@ -1737,7 +1737,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = {
* regenerated. */
static const char descriptor[11630] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p',
static const char descriptor[11638] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p',
't', 'o', 'r', '.', 'p', 'r', 'o', 't', 'o', '\022', '\017', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u',
'f', '\"', 'M', '\n', '\021', 'F', 'i', 'l', 'e', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'S', 'e', 't', '\022', '8', '\n',
'\004', 'f', 'i', 'l', 'e', '\030', '\001', ' ', '\003', '(', '\013', '2', '$', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't',
@ -2093,7 +2093,7 @@ static const char descriptor[11630] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e',
't', 'e', 'V', 'a', 'l', 'u', 'e', '\032', 'J', '\n', '\010', 'N', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '\033', '\n', '\t', 'n', 'a',
'm', 'e', '_', 'p', 'a', 'r', 't', '\030', '\001', ' ', '\002', '(', '\t', 'R', '\010', 'n', 'a', 'm', 'e', 'P', 'a', 'r', 't', '\022', '!',
'\n', '\014', 'i', 's', '_', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\030', '\002', ' ', '\002', '(', '\010', 'R', '\013', 'i', 's', 'E',
'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\"', '\214', '\n', '\n', '\n', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '\022', '\213',
'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '\"', '\224', '\n', '\n', '\n', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', '\022', '\213',
'\001', '\n', '\016', 'f', 'i', 'e', 'l', 'd', '_', 'p', 'r', 'e', 's', 'e', 'n', 'c', 'e', '\030', '\001', ' ', '\001', '(', '\016', '2', ')',
'.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S',
'e', 't', '.', 'F', 'i', 'e', 'l', 'd', 'P', 'r', 'e', 's', 'e', 'n', 'c', 'e', 'B', '9', '\210', '\001', '\001', '\230', '\001', '\004', '\230',
@ -2144,65 +2144,65 @@ static const char descriptor[11630] = {'\n', ' ', 'g', 'o', 'o', 'g', 'l', 'e',
'S', 'O', 'N', '_', 'F', 'O', 'R', 'M', 'A', 'T', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\t', '\n', '\005', 'A',
'L', 'L', 'O', 'W', '\020', '\001', '\022', '\026', '\n', '\022', 'L', 'E', 'G', 'A', 'C', 'Y', '_', 'B', 'E', 'S', 'T', '_', 'E', 'F', 'F',
'O', 'R', 'T', '\020', '\002', '*', '\006', '\010', '\350', '\007', '\020', '\351', '\007', '*', '\006', '\010', '\351', '\007', '\020', '\352', '\007', '*', '\006', '\010', '\352',
'\007', '\020', '\353', '\007', '*', '\006', '\010', '\213', 'N', '\020', '\220', 'N', '*', '\006', '\010', '\220', 'N', '\020', '\221', 'N', 'J', '\006', '\010', '\347', '\007',
'\020', '\350', '\007', '\"', '\376', '\002', '\n', '\022', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'D', 'e', 'f', 'a', 'u', 'l', 't',
's', '\022', 'X', '\n', '\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\030', '\001', ' ', '\003', '(', '\013', '2', '<', '.', 'g', 'o', 'o',
'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'D', 'e',
'f', 'a', 'u', 'l', 't', 's', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'D',
'e', 'f', 'a', 'u', 'l', 't', 'R', '\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\022', 'A', '\n', '\017', 'm', 'i', 'n', 'i', 'm',
'u', 'm', '_', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\004', ' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e',
'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\016', 'm', 'i', 'n', 'i', 'm', 'u',
'm', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\017', 'm', 'a', 'x', 'i', 'm', 'u', 'm', '_', 'e', 'd', 'i', 't', 'i',
'o', 'n', '\030', '\005', ' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u',
'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\016', 'm', 'a', 'x', 'i', 'm', 'u', 'm', 'E', 'd', 'i', 't', 'i', 'o', 'n',
'\032', '\207', '\001', '\n', '\030', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'D', 'e', 'f',
'a', 'u', 'l', 't', '\022', '2', '\n', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\003', ' ', '\001', '(', '\016', '2', '\030', '.', 'g',
'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\007', 'e',
'd', 'i', 't', 'i', 'o', 'n', '\022', '7', '\n', '\010', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\030', '\002', ' ', '\001', '(', '\013', '2',
'\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e',
'S', 'e', 't', 'R', '\010', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\"', '\247', '\002', '\n', '\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C',
'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013',
'2', '(', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'S', 'o', 'u', 'r', 'c', 'e',
'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', 'R', '\010', 'l', 'o', 'c', 'a', 't', 'i',
'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001',
' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n', '\004', 's', 'p', 'a', 'n', '\030', '\002', ' ',
'\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_',
'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o',
'm', 'm', 'e', 'n', 't', 's', '\022', '+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n',
't', 's', '\030', '\004', ' ', '\001', '(', '\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't',
's', '\022', ':', '\n', '\031', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a', 'c', 'h', 'e', 'd', '_', 'c', 'o', 'm',
'm', 'e', 'n', 't', 's', '\030', '\006', ' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd', 'i', 'n', 'g', 'D', 'e', 't', 'a', 'c',
'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd',
'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\030', '\001', ' ',
'\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n',
'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n',
'R', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i',
'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't',
'h', '\022', '\037', '\n', '\013', 's', 'o', 'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030', '\002', ' ', '\001', '(', '\t', 'R', '\n', 's',
'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i', 'n', '\030', '\003', ' ', '\001', '(', '\005', 'R',
'\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001', '(', '\005', 'R', '\003', 'e', 'n', 'd', '\022',
'R', '\n', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016', '2', '6', '.', 'g', 'o', 'o', 'g', 'l',
'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I',
'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', 'R', '\010',
's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\022', '\010', '\n', '\004', 'N',
'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n', '\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002',
'*', '\222', '\002', '\n', '\007', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', '\023', '\n', '\017', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'U',
'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'P', 'R', 'O', 'T', 'O',
'2', '\020', '\346', '\007', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'P', 'R', 'O', 'T', 'O', '3', '\020', '\347', '\007',
'\022', '\021', '\n', '\014', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', '3', '\020', '\350', '\007', '\022', '\021', '\n', '\014', 'E', 'D',
'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', '4', '\020', '\351', '\007', '\022', '\027', '\n', '\023', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_',
'1', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\001', '\022', '\027', '\n', '\023', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_',
'2', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\002', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_',
'9', '9', '9', '9', '7', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\235', '\215', '\006', '\022', '\035', '\n', '\027', 'E', 'D',
'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '8', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\236', '\215', '\006',
'\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '9', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N',
'L', 'Y', '\020', '\237', '\215', '\006', '\022', '\023', '\n', '\013', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'M', 'A', 'X', '\020', '\377', '\377', '\377',
'\377', '\007', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f',
'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'P', 'r', 'o', 't', 'o', 's', 'H', '\001', 'Z', '-', 'g', 'o', 'o',
'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 't',
'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'p', 'b', '\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P',
'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'R', 'e', 'f', 'l', 'e',
'c', 't', 'i', 'o', 'n',
'\007', '\020', '\353', '\007', '*', '\006', '\010', '\206', 'N', '\020', '\207', 'N', '*', '\006', '\010', '\213', 'N', '\020', '\220', 'N', '*', '\006', '\010', '\220', 'N',
'\020', '\221', 'N', 'J', '\006', '\010', '\347', '\007', '\020', '\350', '\007', '\"', '\376', '\002', '\n', '\022', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e',
't', 'D', 'e', 'f', 'a', 'u', 'l', 't', 's', '\022', 'X', '\n', '\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\030', '\001', ' ', '\003',
'(', '\013', '2', '<', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'F', 'e', 'a', 't',
'u', 'r', 'e', 'S', 'e', 't', 'D', 'e', 'f', 'a', 'u', 'l', 't', 's', '.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't',
'E', 'd', 'i', 't', 'i', 'o', 'n', 'D', 'e', 'f', 'a', 'u', 'l', 't', 'R', '\010', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's', '\022',
'A', '\n', '\017', 'm', 'i', 'n', 'i', 'm', 'u', 'm', '_', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\004', ' ', '\001', '(', '\016', '2',
'\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n',
'R', '\016', 'm', 'i', 'n', 'i', 'm', 'u', 'm', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', 'A', '\n', '\017', 'm', 'a', 'x', 'i', 'm',
'u', 'm', '_', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\005', ' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e',
'.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd', 'i', 't', 'i', 'o', 'n', 'R', '\016', 'm', 'a', 'x', 'i', 'm', 'u',
'm', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\032', '\207', '\001', '\n', '\030', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'E', 'd',
'i', 't', 'i', 'o', 'n', 'D', 'e', 'f', 'a', 'u', 'l', 't', '\022', '2', '\n', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\030', '\003',
' ', '\001', '(', '\016', '2', '\030', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'E', 'd',
'i', 't', 'i', 'o', 'n', 'R', '\007', 'e', 'd', 'i', 't', 'i', 'o', 'n', '\022', '7', '\n', '\010', 'f', 'e', 'a', 't', 'u', 'r', 'e',
's', '\030', '\002', ' ', '\001', '(', '\013', '2', '\033', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f',
'.', 'F', 'e', 'a', 't', 'u', 'r', 'e', 'S', 'e', 't', 'R', '\010', 'f', 'e', 'a', 't', 'u', 'r', 'e', 's', '\"', '\247', '\002', '\n',
'\016', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'D', '\n', '\010', 'l', 'o', 'c', 'a', 't', 'i',
'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '(', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u',
'f', '.', 'S', 'o', 'u', 'r', 'c', 'e', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n',
'R', '\010', 'l', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\032', '\316', '\001', '\n', '\010', 'L', 'o', 'c', 'a', 't', 'i', 'o', 'n', '\022', '\026',
'\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\026', '\n',
'\004', 's', 'p', 'a', 'n', '\030', '\002', ' ', '\003', '(', '\005', 'B', '\002', '\020', '\001', 'R', '\004', 's', 'p', 'a', 'n', '\022', ')', '\n', '\020',
'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\003', ' ', '\001', '(', '\t', 'R', '\017', 'l',
'e', 'a', 'd', 'i', 'n', 'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', '+', '\n', '\021', 't', 'r', 'a', 'i', 'l', 'i', 'n',
'g', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\004', ' ', '\001', '(', '\t', 'R', '\020', 't', 'r', 'a', 'i', 'l', 'i', 'n',
'g', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\022', ':', '\n', '\031', 'l', 'e', 'a', 'd', 'i', 'n', 'g', '_', 'd', 'e', 't', 'a',
'c', 'h', 'e', 'd', '_', 'c', 'o', 'm', 'm', 'e', 'n', 't', 's', '\030', '\006', ' ', '\003', '(', '\t', 'R', '\027', 'l', 'e', 'a', 'd',
'i', 'n', 'g', 'D', 'e', 't', 'a', 'c', 'h', 'e', 'd', 'C', 'o', 'm', 'm', 'e', 'n', 't', 's', '\"', '\320', '\002', '\n', '\021', 'G',
'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '\022', 'M', '\n', '\n', 'a', 'n', 'n', 'o', 't',
'a', 't', 'i', 'o', 'n', '\030', '\001', ' ', '\003', '(', '\013', '2', '-', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't',
'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a', 't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n',
'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 'R', '\n', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\032', '\353', '\001', '\n', '\n',
'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '\022', '\026', '\n', '\004', 'p', 'a', 't', 'h', '\030', '\001', ' ', '\003', '(', '\005', 'B',
'\002', '\020', '\001', 'R', '\004', 'p', 'a', 't', 'h', '\022', '\037', '\n', '\013', 's', 'o', 'u', 'r', 'c', 'e', '_', 'f', 'i', 'l', 'e', '\030',
'\002', ' ', '\001', '(', '\t', 'R', '\n', 's', 'o', 'u', 'r', 'c', 'e', 'F', 'i', 'l', 'e', '\022', '\024', '\n', '\005', 'b', 'e', 'g', 'i',
'n', '\030', '\003', ' ', '\001', '(', '\005', 'R', '\005', 'b', 'e', 'g', 'i', 'n', '\022', '\020', '\n', '\003', 'e', 'n', 'd', '\030', '\004', ' ', '\001',
'(', '\005', 'R', '\003', 'e', 'n', 'd', '\022', 'R', '\n', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\030', '\005', ' ', '\001', '(', '\016',
'2', '6', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'G', 'e', 'n', 'e', 'r', 'a',
't', 'e', 'd', 'C', 'o', 'd', 'e', 'I', 'n', 'f', 'o', '.', 'A', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', '.', 'S', 'e',
'm', 'a', 'n', 't', 'i', 'c', 'R', '\010', 's', 'e', 'm', 'a', 'n', 't', 'i', 'c', '\"', '(', '\n', '\010', 'S', 'e', 'm', 'a', 'n',
't', 'i', 'c', '\022', '\010', '\n', '\004', 'N', 'O', 'N', 'E', '\020', '\000', '\022', '\007', '\n', '\003', 'S', 'E', 'T', '\020', '\001', '\022', '\t', '\n',
'\005', 'A', 'L', 'I', 'A', 'S', '\020', '\002', '*', '\222', '\002', '\n', '\007', 'E', 'd', 'i', 't', 'i', 'o', 'n', '\022', '\023', '\n', '\017', 'E',
'D', 'I', 'T', 'I', 'O', 'N', '_', 'U', 'N', 'K', 'N', 'O', 'W', 'N', '\020', '\000', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I',
'O', 'N', '_', 'P', 'R', 'O', 'T', 'O', '2', '\020', '\346', '\007', '\022', '\023', '\n', '\016', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', 'P',
'R', 'O', 'T', 'O', '3', '\020', '\347', '\007', '\022', '\021', '\n', '\014', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', '3', '\020',
'\350', '\007', '\022', '\021', '\n', '\014', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '0', '2', '4', '\020', '\351', '\007', '\022', '\027', '\n', '\023',
'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '1', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\001', '\022', '\027', '\n', '\023',
'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '2', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\002', '\022', '\035', '\n', '\027',
'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '7', '_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\235',
'\215', '\006', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '8', '_', 'T', 'E', 'S', 'T', '_',
'O', 'N', 'L', 'Y', '\020', '\236', '\215', '\006', '\022', '\035', '\n', '\027', 'E', 'D', 'I', 'T', 'I', 'O', 'N', '_', '9', '9', '9', '9', '9',
'_', 'T', 'E', 'S', 'T', '_', 'O', 'N', 'L', 'Y', '\020', '\237', '\215', '\006', '\022', '\023', '\n', '\013', 'E', 'D', 'I', 'T', 'I', 'O', 'N',
'_', 'M', 'A', 'X', '\020', '\377', '\377', '\377', '\377', '\007', 'B', '~', '\n', '\023', 'c', 'o', 'm', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.',
'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', 'B', '\020', 'D', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'P', 'r', 'o', 't', 'o',
's', 'H', '\001', 'Z', '-', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'g', 'o', 'l', 'a', 'n', 'g', '.', 'o', 'r', 'g', '/', 'p', 'r',
'o', 't', 'o', 'b', 'u', 'f', '/', 't', 'y', 'p', 'e', 's', '/', 'd', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 'p', 'b',
'\370', '\001', '\001', '\242', '\002', '\003', 'G', 'P', 'B', '\252', '\002', '\032', 'G', 'o', 'o', 'g', 'l', 'e', '.', 'P', 'r', 'o', 't', 'o', 'b',
'u', 'f', '.', 'R', 'e', 'f', 'l', 'e', 'c', 't', 'i', 'o', 'n',
};
static _upb_DefPool_Init *deps[1] = {
@ -2213,7 +2213,7 @@ _upb_DefPool_Init google_protobuf_descriptor_proto_upbdefinit = {
deps,
&google_protobuf_descriptor_proto_upb_file_layout,
"google/protobuf/descriptor.proto",
UPB_STRINGVIEW_INIT(descriptor, 11630)
UPB_STRINGVIEW_INIT(descriptor, 11638)
};
@ -4530,6 +4530,10 @@ static void* upb_global_allocfunc(upb_alloc* alloc, void* ptr, size_t oldsize,
upb_alloc upb_alloc_global = {&upb_global_allocfunc};
#ifdef UPB_TRACING_ENABLED
#include <stdatomic.h>
#endif
#include <stddef.h>
#include <stdint.h>
@ -4636,6 +4640,38 @@ static bool _upb_ArenaInternal_HasInitialBlock(upb_ArenaInternal* ai) {
return ai->block_alloc & 0x1;
}
#ifdef UPB_TRACING_ENABLED
static void (*_init_arena_trace_handler)(const upb_Arena*, size_t size) = NULL;
static void (*_fuse_arena_trace_handler)(const upb_Arena*,
const upb_Arena*) = NULL;
static void (*_free_arena_trace_handler)(const upb_Arena*) = NULL;
void upb_Arena_SetTraceHandler(
void (*initArenaTraceHandler)(const upb_Arena*, size_t size),
void (*fuseArenaTraceHandler)(const upb_Arena*, const upb_Arena*),
void (*freeArenaTraceHandler)(const upb_Arena*)) {
_init_arena_trace_handler = initArenaTraceHandler;
_fuse_arena_trace_handler = fuseArenaTraceHandler;
_free_arena_trace_handler = freeArenaTraceHandler;
}
void upb_Arena_LogInit(const upb_Arena* arena, size_t size) {
if (_init_arena_trace_handler) {
_init_arena_trace_handler(arena, size);
}
}
void upb_Arena_LogFuse(const upb_Arena* arena1, const upb_Arena* arena2) {
if (_fuse_arena_trace_handler) {
_fuse_arena_trace_handler(arena1, arena2);
}
}
void upb_Arena_LogFree(const upb_Arena* arena) {
if (_free_arena_trace_handler) {
_free_arena_trace_handler(arena);
}
}
#endif // UPB_TRACING_ENABLED
static upb_ArenaRoot _upb_Arena_FindRoot(upb_Arena* a) {
upb_ArenaInternal* ai = upb_Arena_Internal(a);
uintptr_t poc = upb_Atomic_Load(&ai->parent_or_count, memory_order_acquire);
@ -4799,7 +4835,13 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) {
n = UPB_ALIGN_DOWN(n, UPB_ALIGN_OF(upb_ArenaState));
if (UPB_UNLIKELY(n < sizeof(upb_ArenaState))) {
#ifdef UPB_TRACING_ENABLED
upb_Arena* ret = _upb_Arena_InitSlow(alloc);
upb_Arena_LogInit(ret, n);
return ret;
#else
return _upb_Arena_InitSlow(alloc);
#endif
}
a = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), upb_ArenaState);
@ -4812,13 +4854,14 @@ upb_Arena* upb_Arena_Init(void* mem, size_t n, upb_alloc* alloc) {
a->body.block_alloc = _upb_Arena_MakeBlockAlloc(alloc, 1);
a->head.UPB_PRIVATE(ptr) = mem;
a->head.UPB_PRIVATE(end) = UPB_PTR_AT(mem, n - sizeof(upb_ArenaState), char);
#ifdef UPB_TRACING_ENABLED
upb_Arena_LogInit(&a->head, n);
#endif
return &a->head;
}
static void _upb_Arena_DoFree(upb_ArenaInternal* ai) {
UPB_ASSERT(_upb_Arena_RefCountFromTagged(ai->parent_or_count) == 1);
while (ai != NULL) {
// Load first since arena itself is likely from one of its blocks.
upb_ArenaInternal* next_arena =
@ -4849,6 +4892,9 @@ retry:
// expensive then direct loads. As an optimization, we only do RMW ops
// when we need to update things for other threads to see.
if (poc == _upb_Arena_TaggedFromRefcount(1)) {
#ifdef UPB_TRACING_ENABLED
upb_Arena_LogFree(a);
#endif
_upb_Arena_DoFree(ai);
return;
}
@ -4968,6 +5014,10 @@ static bool _upb_Arena_FixupRefs(upb_ArenaInternal* new_root,
bool upb_Arena_Fuse(upb_Arena* a1, upb_Arena* a2) {
if (a1 == a2) return true; // trivial fuse
#ifdef UPB_TRACING_ENABLED
upb_Arena_LogFuse(a1, a2);
#endif
upb_ArenaInternal* ai1 = upb_Arena_Internal(a1);
upb_ArenaInternal* ai2 = upb_Arena_Internal(a2);
@ -11890,13 +11940,13 @@ bool UPB_PRIVATE(_upb_Message_Realloc)(struct upb_Message* msg, size_t need,
static void (*_new_message_trace_handler)(const upb_MiniTable*,
const upb_Arena*);
void upb_Message_SetNewMessageTraceHandler(
void UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(
void (*new_message_trace_handler)(const upb_MiniTable*, const upb_Arena*)) {
_new_message_trace_handler = new_message_trace_handler;
}
void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
const upb_Arena* arena) {
void UPB_PRIVATE(upb_Message_LogNewMessage)(const upb_MiniTable* mini_table,
const upb_Arena* arena) {
if (_new_message_trace_handler) {
_new_message_trace_handler(mini_table, arena);
}
@ -12932,7 +12982,11 @@ const upb_EnumValueDef* upb_EnumDef_Value(const upb_EnumDef* e, int i) {
}
bool upb_EnumDef_IsClosed(const upb_EnumDef* e) {
if (UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3) return false;
if (UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN) return false;
return upb_EnumDef_IsSpecifiedAsClosed(e);
}
bool upb_EnumDef_IsSpecifiedAsClosed(const upb_EnumDef* e) {
return UPB_DESC(FeatureSet_enum_type)(e->resolved_features) ==
UPB_DESC(FeatureSet_CLOSED);
}
@ -13238,15 +13292,10 @@ static void create_enumvaldef(upb_DefBuilder* ctx, const char* prefix,
static void _upb_EnumValueDef_CheckZeroValue(upb_DefBuilder* ctx,
const upb_EnumDef* e,
const upb_EnumValueDef* v, int n) {
if (upb_EnumDef_IsClosed(e) || n == 0 || v[0].number == 0) return;
// When the special UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 is enabled, we have to
// exempt proto2 enums from this check, even when we are treating them as
// When the special UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN is enabled, we have to
// exempt closed enums from this check, even when we are treating them as
// open.
if (UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 &&
upb_FileDef_Syntax(upb_EnumDef_File(e)) == kUpb_Syntax_Proto2) {
return;
}
if (upb_EnumDef_IsSpecifiedAsClosed(e) || n == 0 || v[0].number == 0) return;
_upb_DefBuilder_Errf(ctx, "for open enums, the first value must be zero (%s)",
upb_EnumDef_FullName(e));
@ -13440,6 +13489,10 @@ upb_FieldType upb_FieldDef_Type(const upb_FieldDef* f) {
uint32_t upb_FieldDef_Index(const upb_FieldDef* f) { return f->index_; }
uint32_t upb_FieldDef_LayoutIndex(const upb_FieldDef* f) {
return f->layout_index;
}
upb_Label upb_FieldDef_Label(const upb_FieldDef* f) {
// TODO: remove once we can deprecate kUpb_Label_Required.
if (UPB_DESC(FeatureSet_field_presence)(f->resolved_features) ==
@ -16603,7 +16656,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
#undef UPB_ASAN
#undef UPB_ASAN_GUARD_SIZE
#undef UPB_CLANG_ASAN
#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
#undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN
#undef UPB_DEPRECATED
#undef UPB_GNUC_MIN
#undef UPB_DESCRIPTOR_UPB_H_FILENAME

@ -304,10 +304,10 @@ void __asan_unpoison_memory_region(void const volatile *addr, size_t size);
/* Disable proto2 arena behavior (TEMPORARY) **********************************/
#ifdef UPB_DISABLE_PROTO2_ENUM_CHECKING
#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 1
#ifdef UPB_DISABLE_CLOSED_ENUM_CHECKING
#define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 1
#else
#define UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3 0
#define UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN 0
#endif
#if defined(__cplusplus)
@ -806,6 +806,14 @@ UPB_API_INLINE void* upb_Arena_Realloc(upb_Arena* a, void* ptr, size_t oldsize,
UPB_API_INLINE void upb_Arena_ShrinkLast(upb_Arena* a, void* ptr,
size_t oldsize, size_t size);
#ifdef UPB_TRACING_ENABLED
void upb_Arena_SetTraceHandler(void (*initArenaTraceHandler)(const upb_Arena*,
size_t size),
void (*fuseArenaTraceHandler)(const upb_Arena*,
const upb_Arena*),
void (*freeArenaTraceHandler)(const upb_Arena*));
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
@ -2442,17 +2450,17 @@ typedef struct upb_Message_Internal {
} upb_Message_Internal;
#ifdef UPB_TRACING_ENABLED
void upb_Message_SetNewMessageTraceHandler(
void UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(
void (*newMessageTraceHandler)(const upb_MiniTable*, const upb_Arena*));
void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
const upb_Arena* arena);
void UPB_PRIVATE(upb_Message_LogNewMessage)(const upb_MiniTable* mini_table,
const upb_Arena* arena);
#endif
// Inline version upb_Message_New(), for internal use.
UPB_INLINE struct upb_Message* _upb_Message_New(const upb_MiniTable* m,
upb_Arena* a) {
#ifdef UPB_TRACING_ENABLED
upb_Message_LogNewMessage(m, a);
UPB_PRIVATE(upb_Message_LogNewMessage)(m, a);
#endif
const int size = m->UPB_PRIVATE(size);
struct upb_Message* msg = (struct upb_Message*)upb_Arena_Malloc(a, size);
@ -2969,12 +2977,6 @@ UPB_API_INLINE bool upb_Map_Set(upb_Map* map, upb_MessageValue key,
UPB_API bool upb_Map_Delete(upb_Map* map, upb_MessageValue key,
upb_MessageValue* val);
// (DEPRECATED and going away soon. Do not use.)
UPB_INLINE bool upb_Map_Delete2(upb_Map* map, upb_MessageValue key,
upb_MessageValue* val) {
return upb_Map_Delete(map, key, val);
}
// Map iteration:
//
// size_t iter = kUpb_Map_Begin;
@ -3075,6 +3077,18 @@ UPB_API void upb_Message_Freeze(upb_Message* msg, const upb_MiniTable* m);
// Returns whether a message has been frozen.
UPB_API_INLINE bool upb_Message_IsFrozen(const upb_Message* msg);
#ifdef UPB_TRACING_ENABLED
UPB_INLINE void upb_Message_SetNewMessageTraceHandler(
void (*newMessageTraceHandler)(const upb_MiniTable* mini_table,
const upb_Arena* arena)) {
UPB_PRIVATE(upb_Message_SetNewMessageTraceHandler)(newMessageTraceHandler);
}
UPB_INLINE void upb_Message_LogNewMessage(const upb_MiniTable* mini_table,
const upb_Arena* arena) {
UPB_PRIVATE(upb_Message_LogNewMessage)(mini_table, arena);
}
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
@ -11064,8 +11078,8 @@ const upb_FieldDef* upb_DefPool_FindExtensionByNumber(const upb_DefPool* s,
const upb_MessageDef* m,
int32_t fieldnum);
const upb_ServiceDef* upb_DefPool_FindServiceByName(const upb_DefPool* s,
const char* name);
UPB_API const upb_ServiceDef* upb_DefPool_FindServiceByName(
const upb_DefPool* s, const char* name);
const upb_ServiceDef* upb_DefPool_FindServiceByNameWithSize(
const upb_DefPool* s, const char* name, size_t size);
@ -11116,6 +11130,7 @@ UPB_API const upb_EnumValueDef* upb_EnumDef_FindValueByNumber(
UPB_API const char* upb_EnumDef_FullName(const upb_EnumDef* e);
bool upb_EnumDef_HasOptions(const upb_EnumDef* e);
bool upb_EnumDef_IsClosed(const upb_EnumDef* e);
bool upb_EnumDef_IsSpecifiedAsClosed(const upb_EnumDef* e);
// Creates a mini descriptor string for an enum, returns true on success.
bool upb_EnumDef_MiniDescriptorEncode(const upb_EnumDef* e, upb_Arena* a,
@ -11244,6 +11259,7 @@ bool upb_FieldDef_IsString(const upb_FieldDef* f);
UPB_API bool upb_FieldDef_IsSubMessage(const upb_FieldDef* f);
UPB_API const char* upb_FieldDef_JsonName(const upb_FieldDef* f);
UPB_API upb_Label upb_FieldDef_Label(const upb_FieldDef* f);
uint32_t upb_FieldDef_LayoutIndex(const upb_FieldDef* f);
UPB_API const upb_MessageDef* upb_FieldDef_MessageSubDef(const upb_FieldDef* f);
bool _upb_FieldDef_ValidateUtf8(const upb_FieldDef* f);
@ -11481,18 +11497,19 @@ UPB_API upb_WellKnown upb_MessageDef_WellKnownType(const upb_MessageDef* m);
extern "C" {
#endif
bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
UPB_API bool upb_MethodDef_ClientStreaming(const upb_MethodDef* m);
const char* upb_MethodDef_FullName(const upb_MethodDef* m);
bool upb_MethodDef_HasOptions(const upb_MethodDef* m);
int upb_MethodDef_Index(const upb_MethodDef* m);
const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
const char* upb_MethodDef_Name(const upb_MethodDef* m);
const UPB_DESC(MethodOptions) * upb_MethodDef_Options(const upb_MethodDef* m);
UPB_API const upb_MessageDef* upb_MethodDef_InputType(const upb_MethodDef* m);
UPB_API const char* upb_MethodDef_Name(const upb_MethodDef* m);
UPB_API const UPB_DESC(MethodOptions) *
upb_MethodDef_Options(const upb_MethodDef* m);
const UPB_DESC(FeatureSet) *
upb_MethodDef_ResolvedFeatures(const upb_MethodDef* m);
const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
UPB_API const upb_MessageDef* upb_MethodDef_OutputType(const upb_MethodDef* m);
UPB_API bool upb_MethodDef_ServerStreaming(const upb_MethodDef* m);
UPB_API const upb_ServiceDef* upb_MethodDef_Service(const upb_MethodDef* m);
#ifdef __cplusplus
} /* extern "C" */
@ -11553,16 +11570,17 @@ const UPB_DESC(FeatureSet*)
extern "C" {
#endif
const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
UPB_API const upb_FileDef* upb_ServiceDef_File(const upb_ServiceDef* s);
const upb_MethodDef* upb_ServiceDef_FindMethodByName(const upb_ServiceDef* s,
const char* name);
const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
UPB_API const char* upb_ServiceDef_FullName(const upb_ServiceDef* s);
bool upb_ServiceDef_HasOptions(const upb_ServiceDef* s);
int upb_ServiceDef_Index(const upb_ServiceDef* s);
const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s, int i);
int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
UPB_API const upb_MethodDef* upb_ServiceDef_Method(const upb_ServiceDef* s,
int i);
UPB_API int upb_ServiceDef_MethodCount(const upb_ServiceDef* s);
const char* upb_ServiceDef_Name(const upb_ServiceDef* s);
const UPB_DESC(ServiceOptions) *
UPB_API const UPB_DESC(ServiceOptions) *
upb_ServiceDef_Options(const upb_ServiceDef* s);
const UPB_DESC(FeatureSet) *
upb_ServiceDef_ResolvedFeatures(const upb_ServiceDef* s);
@ -14254,7 +14272,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
#undef UPB_ASAN
#undef UPB_ASAN_GUARD_SIZE
#undef UPB_CLANG_ASAN
#undef UPB_TREAT_PROTO2_ENUMS_LIKE_PROTO3
#undef UPB_TREAT_CLOSED_ENUMS_LIKE_OPEN
#undef UPB_DEPRECATED
#undef UPB_GNUC_MIN
#undef UPB_DESCRIPTOR_UPB_H_FILENAME

@ -208,6 +208,7 @@ cc_dist_library(
name = "upb",
tags = ["manual"],
deps = [
"//upb:generated_code_support__only_for_generated_code_do_not_use__i_give_permission_to_break_me",
"//upb/json",
"//upb/message:compare",
"//upb/message:copy",

@ -267,7 +267,6 @@ _proto_gen = rule(
default = "all",
),
},
output_to_genfiles = True,
implementation = _proto_gen_impl,
)

@ -289,7 +289,6 @@ _upb_cc_proto_library_aspect = aspect(
)
upb_cc_proto_library = rule(
output_to_genfiles = True,
implementation = _upb_cc_proto_rule_impl,
attrs = {
"deps": attr.label_list(

@ -137,6 +137,10 @@ struct PrivateAccess {
static auto CProxy(const upb_Message* p, upb_Arena* arena) {
return typename T::CProxy(p, arena);
}
template <typename T>
static auto CreateMessage(upb_Arena* arena) {
return typename T::Proxy(upb_Message_New(T::minitable(), arena), arena);
}
};
template <typename T>

@ -113,7 +113,6 @@ def _py_dist_module_impl(ctx):
]
py_dist_module = rule(
output_to_genfiles = True,
implementation = _py_dist_module_impl,
attrs = {
"module_name": attr.string(mandatory = True),

@ -1145,13 +1145,17 @@ class FeatureSetDefaults(unittest.TestCase):
)
defaults.defaults[0].features.Extensions[
unittest_features_pb2.test
].int_file_feature = 9
].file_feature = unittest_features_pb2.VALUE9
pool.SetFeatureSetDefaults(defaults)
file_desc = descriptor_pb2.FileDescriptorProto(name='some/file.proto')
file = pool.AddSerializedFile(file_desc.SerializeToString())
self.assertTrue(
file._GetFeatures().HasExtension(unittest_features_pb2.test)
)
self.assertEqual(
file._GetFeatures().Extensions[unittest_features_pb2.test].file_feature,
unittest_features_pb2.VALUE9,
)
def testInvalidType(self):
pool = descriptor_pool.DescriptorPool()

@ -1372,14 +1372,14 @@ def GetTestFeature(desc):
return (
desc._GetFeatures()
.Extensions[unittest_features_pb2.test]
.int_multiple_feature
.multiple_feature
)
def SetTestFeature(proto, value):
proto.options.features.Extensions[
unittest_features_pb2.test
].int_multiple_feature = value
].multiple_feature = value
@testing_refleaks.TestCase
@ -1462,7 +1462,7 @@ class FeatureInheritanceTest(unittest.TestCase):
)
defaults.defaults[0].features.Extensions[
unittest_features_pb2.test
].int_multiple_feature = 1
].multiple_feature = 1
ret.pool.SetFeatureSetDefaults(defaults)
ret.file = ret.pool.AddSerializedFile(self.file_proto.SerializeToString())

@ -549,6 +549,15 @@ class MessageTest(unittest.TestCase):
self.assertEqual([4, 3, 2, 1],
[m.bb for m in msg.repeated_nested_message[::-1]])
def testSortEmptyRepeated(self, message_module):
message = message_module.NestedTestAllTypes()
self.assertFalse(message.HasField('child'))
self.assertFalse(message.HasField('payload'))
message.child.repeated_child.sort()
message.payload.repeated_int32.sort()
self.assertFalse(message.HasField('child'))
self.assertFalse(message.HasField('payload'))
def testSortingRepeatedScalarFieldsDefaultComparator(self, message_module):
"""Check some different types with the default comparator."""
message = message_module.TestAllTypes()

@ -2299,6 +2299,17 @@ class TokenizerTest(unittest.TestCase):
tokenizer = text_format.Tokenizer(text.splitlines(), skip_comments=False)
tokenizer.ConsumeString()
def testGroupName(self):
grp = unittest_pb2.TestGroupExtension()
grp.Extensions[unittest_pb2.TestNestedExtension.optionalgroup_extension].a = 6
self.assertEqual('[protobuf_unittest.TestNestedExtension.optionalgroup_extension] {\n a: 6\n}\n', str(grp))
msg = unittest_pb2.TestAllTypes(
repeatedgroup=[unittest_pb2.TestAllTypes.RepeatedGroup(a=1)])
if api_implementation.Type() == 'upb':
self.assertEqual('repeatedgroup {\n a: 1\n}\n', str(msg))
else:
self.assertEqual('RepeatedGroup {\n a: 1\n}\n', str(msg))
# Tests for pretty printer functionality.
@_parameterized.parameters((unittest_pb2), (unittest_proto3_arena_pb2))

@ -400,7 +400,7 @@ class Duration(object):
self.seconds = seconds
self.nanos = 0
def ToTimedelta(self):
def ToTimedelta(self) -> datetime.timedelta:
"""Converts Duration to timedelta."""
return datetime.timedelta(
seconds=self.seconds, microseconds=_RoundTowardZero(

@ -89,7 +89,7 @@ def ValidateProtobufRuntimeVersion(
f' cannot be older than the linked gencode version. {error_prompt}'
)
if gen_suffix is not SUFFIX:
if gen_suffix != SUFFIX:
raise VersionError(
'Detected mismatched Protobuf Gencode/Runtime version suffixes when'
f' loading {location}: gencode {gen_version} runtime {version}.'

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save