PROTOBUF_SYNC_PIPER
pull/9831/head
Joshua Haberman 3 years ago
commit 87edf7b558
  1. 1
      .bazelignore
  2. 4
      .gitmodules
  3. 95
      BUILD
  4. 4
      CHANGES.txt
  5. 4
      benchmarks/README.md
  6. 2
      cmake/README.md
  7. 4
      conformance/README.md
  8. 6
      docs/options.md
  9. 2
      java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java
  10. 1
      java/core/src/main/java/com/google/protobuf/TextFormat.java
  11. 8
      java/core/src/main/java/com/google/protobuf/Utf8.java
  12. 2
      java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
  13. 5
      kokoro/release/protoc/windows/build.bat
  14. 2
      kokoro/release/python/linux/build_artifacts.sh
  15. 2
      kokoro/release/python/macos/build_artifacts.sh
  16. 7
      kokoro/release/python/windows/build_artifacts.bat
  17. 2
      kokoro/release/python/windows/build_single_artifact.bat
  18. 12
      php/src/Google/Protobuf/Api.php
  19. 8
      php/src/Google/Protobuf/Enum.php
  20. 4
      php/src/Google/Protobuf/EnumValue.php
  21. 4
      php/src/Google/Protobuf/Field.php
  22. 4
      php/src/Google/Protobuf/FieldMask.php
  23. 32
      php/src/Google/Protobuf/Internal/DescriptorProto.php
  24. 12
      php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
  25. 4
      php/src/Google/Protobuf/Internal/EnumOptions.php
  26. 4
      php/src/Google/Protobuf/Internal/EnumValueOptions.php
  27. 4
      php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php
  28. 4
      php/src/Google/Protobuf/Internal/FieldOptions.php
  29. 28
      php/src/Google/Protobuf/Internal/FileDescriptorProto.php
  30. 4
      php/src/Google/Protobuf/Internal/FileDescriptorSet.php
  31. 4
      php/src/Google/Protobuf/Internal/FileOptions.php
  32. 4
      php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php
  33. 4
      php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php
  34. 4
      php/src/Google/Protobuf/Internal/MessageOptions.php
  35. 4
      php/src/Google/Protobuf/Internal/MethodOptions.php
  36. 4
      php/src/Google/Protobuf/Internal/OneofOptions.php
  37. 6
      php/src/Google/Protobuf/Internal/RepeatedField.php
  38. 4
      php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
  39. 4
      php/src/Google/Protobuf/Internal/ServiceOptions.php
  40. 4
      php/src/Google/Protobuf/Internal/SourceCodeInfo.php
  41. 12
      php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php
  42. 4
      php/src/Google/Protobuf/Internal/UninterpretedOption.php
  43. 4
      php/src/Google/Protobuf/ListValue.php
  44. 4
      php/src/Google/Protobuf/Method.php
  45. 12
      php/src/Google/Protobuf/Type.php
  46. 16
      php/tests/GeneratedPhpdocTest.php
  47. 117
      pkg/BUILD
  48. 35
      python/google/protobuf/internal/api_implementation.py
  49. 11
      python/google/protobuf/internal/text_format_test.py
  50. 2
      python/google/protobuf/internal/unknown_fields_test.py
  51. 5
      python/google/protobuf/text_format.py
  52. 10
      python/google/protobuf/unknown_fields.py
  53. 10
      ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java
  54. 45
      ruby/tests/repeated_field_test.rb
  55. 8
      src/google/protobuf/compiler/cpp/helpers.cc
  56. 6
      src/google/protobuf/compiler/cpp/helpers.h
  57. 2
      src/google/protobuf/compiler/cpp/message.cc
  58. 2
      src/google/protobuf/compiler/java/file.cc
  59. 4
      src/google/protobuf/compiler/php/php_generator.cc
  60. 7
      src/google/protobuf/descriptor.cc
  61. 24
      src/google/protobuf/descriptor_unittest.cc
  62. 6
      src/google/protobuf/generated_message_reflection.cc
  63. 8
      src/google/protobuf/generated_message_reflection_unittest.cc
  64. 2
      src/google/protobuf/metadata_lite.h
  65. 3
      src/google/protobuf/stubs/structurally_valid.cc
  66. 6
      src/google/protobuf/util/internal/protostream_objectwriter.cc
  67. 27
      tests.sh
  68. 1
      third_party/abseil-cpp
  69. 2
      third_party/utf8_range/utf8_range.h

@ -1,4 +1,5 @@
# These are fetched as external repositories.
third_party/abseil-cpp
third_party/benchmark
third_party/googletest
_build/

4
.gitmodules vendored

@ -5,3 +5,7 @@
path = third_party/googletest
url = https://github.com/google/googletest.git
ignore = dirty
[submodule "third_party/abseil-cpp"]
path = third_party/abseil-cpp
url = https://github.com/abseil/abseil-cpp.git
branch = lts_2021_11_02

95
BUILD

@ -2,13 +2,12 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library", native_cc_proto_library = "cc_proto_library")
load("@rules_pkg//:pkg.bzl", "pkg_zip")
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files")
load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
load("@rules_python//python:defs.bzl", "py_library")
load("@rules_java//java:defs.bzl", "java_binary", "java_lite_proto_library", "java_proto_library")
load(":cc_proto_blacklist_test.bzl", "cc_proto_blacklist_test")
load(":protobuf_release.bzl", "package_naming")
licenses(["notice"])
exports_files(["LICENSE"])
@ -353,6 +352,11 @@ filegroup(
visibility = ["//visibility:public"],
)
exports_files(
srcs = WELL_KNOWN_PROTOS,
visibility = ["//pkg:__pkg__"],
)
filegroup(
name = "lite_well_known_protos",
srcs = LITE_WELL_KNOWN_PROTOS,
@ -519,70 +523,6 @@ cc_binary(
deps = [":protoc_lib"],
)
################################################################################
# Generates protoc release artifacts.
################################################################################
genrule(
name = "protoc_readme",
visibility = ["//visibility:private"],
cmd = """
echo "Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/
This package contains a precompiled binary version of the protocol buffer
compiler (protoc). This binary is intended for users who want to use Protocol
Buffers in languages other than C++ but do not want to compile protoc
themselves. To install, simply place this binary somewhere in your PATH.
If you intend to use the included well known types then don't forget to
copy the contents of the 'include' directory somewhere as well, for example
into '/usr/local/include/'.
Please refer to our official github site for more installation instructions:
https://github.com/protocolbuffers/protobuf" > $@
""",
outs = ["readme.txt"],
)
# plugin.proto is excluded from this list because it belongs in a nested folder (protobuf/compiler/plugin.proto)
pkg_files(
name = "wkt_protos_files",
srcs = [value[0] for value in WELL_KNOWN_PROTO_MAP.values() if not value[0].endswith("plugin.proto")],
visibility = ["//visibility:private"],
prefix = "include/google/protobuf",
)
pkg_files(
name = "compiler_plugin_protos_files",
srcs = ["src/google/protobuf/compiler/plugin.proto"],
visibility = ["//visibility:private"],
prefix = "include/google/protobuf/compiler",
)
pkg_files(
name = "protoc_files",
srcs = [":protoc"],
attributes = pkg_attributes(mode = "0555"),
visibility = ["//visibility:private"],
prefix = "bin/",
)
package_naming(
name = "protoc_pkg_naming",
)
pkg_zip(
name = "protoc_release",
package_file_name = "protoc-{version}-{platform}.zip",
package_variables = ":protoc_pkg_naming",
srcs = [
":protoc_files",
":wkt_protos_files",
":compiler_plugin_protos_files",
"readme.txt",
],
)
################################################################################
# Tests
################################################################################
@ -905,10 +845,10 @@ internal_gen_kt_protos(
internal_gen_kt_protos(
name = "gen_well_known_protos_kotlinlite",
lite = True,
visibility = [
"//java:__subpackages__",
],
lite = True,
deps = [proto + "_proto" for proto in LITE_WELL_KNOWN_PROTO_MAP.keys()],
)
@ -1340,17 +1280,16 @@ cc_binary(
# ],
# )
java_proto_library(
name = "java_test_protos",
deps = [":generic_test_protos"],
visibility = ["//java:__subpackages__"],
deps = [":generic_test_protos"],
)
java_lite_proto_library(
name = "java_lite_test_protos",
deps = [":generic_test_protos"],
visibility = ["//java:__subpackages__"],
deps = [":generic_test_protos"],
)
java_proto_library(
@ -1452,57 +1391,57 @@ filegroup(
proto_library(
name = "kt_unittest_lite",
srcs = [
"src/google/protobuf/unittest_lite.proto",
"src/google/protobuf/map_lite_unittest.proto",
"src/google/protobuf/unittest_import_lite.proto",
"src/google/protobuf/unittest_import_public_lite.proto",
"src/google/protobuf/map_lite_unittest.proto",
"src/google/protobuf/unittest_lite.proto",
],
strip_import_prefix = "src",
)
internal_gen_kt_protos(
name = "gen_kotlin_unittest_lite",
deps = [":kt_unittest_lite"],
lite = True,
visibility = ["//java:__subpackages__"],
deps = [":kt_unittest_lite"],
)
proto_library(
name = "kt_unittest",
srcs = [
"src/google/protobuf/map_proto2_unittest.proto",
"src/google/protobuf/unittest.proto",
"src/google/protobuf/unittest_import.proto",
"src/google/protobuf/unittest_import_public.proto",
"src/google/protobuf/map_proto2_unittest.proto",
],
strip_import_prefix = "src",
)
internal_gen_kt_protos(
name = "gen_kotlin_unittest",
deps = [":kt_unittest"],
visibility = ["//java:__subpackages__"],
deps = [":kt_unittest"],
)
proto_library(
name = "kt_proto3_unittest",
srcs = [
"src/google/protobuf/unittest_proto3.proto",
"src/google/protobuf/unittest_import.proto",
"src/google/protobuf/unittest_import_public.proto",
"src/google/protobuf/unittest_proto3.proto",
],
strip_import_prefix = "src",
)
internal_gen_kt_protos(
name = "gen_kotlin_proto3_unittest_lite",
deps = [":kt_proto3_unittest"],
lite = True,
visibility = ["//java:__subpackages__"],
deps = [":kt_proto3_unittest"],
)
internal_gen_kt_protos(
name = "gen_kotlin_proto3_unittest",
deps = [":kt_proto3_unittest"],
visibility = ["//java:__subpackages__"],
deps = [":kt_proto3_unittest"],
)

@ -13,6 +13,10 @@ C++
* Optimize tokenizer ParseInteger by removing division
* Reserve exactly the right amount of capacity in ExtensionSet::MergeFrom
Compiler
* Protoc outputs the list of suggested field numbers when invalid field
numbers are specified in the .proto file.
Java
* 6x speedup in ArrayEncoder.writeUInt32NotTag

@ -5,7 +5,7 @@ This directory contains benchmarking schemas and data sets that you
can use to test a variety of performance scenarios against your
protobuf language runtime. If you are looking for performance
numbers of officially supported languages, see [Protobuf Performance](
https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md).
https://github.com/protocolbuffers/protobuf/blob/main/docs/performance.md).
## Prerequisite
@ -61,7 +61,7 @@ PHP benchmark's requirement is the same as PHP protobuf's requirements. The benc
include PHP protobuf's src and build the c extension if required.
### Node.js
Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/master/js), which needn't to manually install either
Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/main/js), which needn't to manually install either
### C#
The C# benchmark code is built as part of the main Google.Protobuf

@ -59,7 +59,7 @@ Or you can use git to clone from protobuf git repository.
C:\Path\to> mkdir src & cd src
C:\Path\to\src> git clone -b [release_tag] https://github.com/protocolbuffers/protobuf.git
Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *master*
Where *[release_tag]* is a git tag like *v3.0.0-beta-1* or a branch name like *main*
if you want to get the latest code.
Go to the project folder:

@ -57,10 +57,10 @@ Testing other Protocol Buffer implementations
To run these tests against a new Protocol Buffers implementation, write a
program in your language that uses the protobuf implementation you want
to test. This program should implement the testing protocol defined in
[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance.proto).
[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance.proto).
This is designed to be as easy as possible: the C++ version is only
150 lines and is a good example for what this program should look like
(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance_cpp.cc)).
(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance_cpp.cc)).
The program only needs to be able to read from stdin and write to stdout.
Portability

@ -315,4 +315,8 @@ with info about your project (name and website) so we can add an entry for you.
1. Protoc-gen-go-micro
* Website: https://github.com/unistack-org/protoc-gen-go-micro
* Extension: 1144
* Extension: 1144
1. Protoc-gen-authz
* Website: https://github.com/Neakxs/protoc-gen-authz
* Extension: 1145

@ -150,7 +150,7 @@ final class DescriptorMessageInfoFactory implements MessageInfoFactory {
* <p>This class is thread-safe.
*/
// <p>The code is adapted from the C++ implementation:
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/compiler/java/java_helpers.h
// https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/java/java_helpers.h
static class IsInitializedCheckAnalyzer {
private final Map<Descriptor, Boolean> resultCache =

@ -43,7 +43,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@ -1611,14 +1611,14 @@ final class Utf8 {
// ANDing the index with 7 to determine the number of bytes that need to be read before
// we're 8-byte aligned.
final int unaligned = 8 - ((int) offset & 7);
for (int j = unaligned; j > 0; j--) {
int i;
for (i = 0; i < unaligned; i++) {
if (UnsafeUtil.getByte(bytes, offset++) < 0) {
return unaligned - j;
return i;
}
}
int i;
for (i = 0; i + 8 <= maxChars; i += 8) {
for (; i + 8 <= maxChars; i += 8) {
if ((UnsafeUtil.getLong(bytes, UnsafeUtil.BYTE_ARRAY_BASE_OFFSET + offset)
& ASCII_MASK_LONG)
!= 0L) {

@ -59,7 +59,6 @@ import protobuf_unittest.UnittestProto.TestAllExtensions;
import protobuf_unittest.UnittestProto.TestAllTypes;
import protobuf_unittest.UnittestProto.TestAllTypes.NestedMessage;
import protobuf_unittest.UnittestProto.TestAllTypesOrBuilder;
import protobuf_unittest.UnittestProto.TestChildExtension;
import protobuf_unittest.UnittestProto.TestExtremeDefaultValues;
import protobuf_unittest.UnittestProto.TestOneof2;
import protobuf_unittest.UnittestProto.TestPackedTypes;
@ -2024,5 +2023,4 @@ public class GeneratedMessageTest {
assertThat(builder.getRepeatedField(REPEATED_NESTED_MESSAGE_EXTENSION, 0))
.isEqualTo(NestedMessage.newBuilder().setBb(100).build());
}
}

@ -8,6 +8,11 @@ set configuration=Release
echo Building protoc
cd github\protobuf
echo Update Submodules
echo This is needed because this build uses CMake <3.13.
git submodule update --init --recursive
set ABSL_ROOT_DIR=%cd%\third_party\abseil-cpp
mkdir build32
cd build32
cmake -G "%generator32%" -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_UNICODE=ON ../cmake

@ -30,7 +30,7 @@ git clone https://github.com/matthew-brett/multibuild.git
# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180).
# IMPORTANT: always pin multibuild at the same commit for:
# - linux/build_artifacts.sh
# - linux/build_artifacts.sh
# - macos/build_artifacts.sh
# - windows/build_artifacts.bat
(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313)
cp kokoro/release/python/linux/config.sh config.sh

@ -30,7 +30,7 @@ git clone https://github.com/matthew-brett/multibuild.git
# silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180).
# IMPORTANT: always pin multibuild at the same commit for:
# - linux/build_artifacts.sh
# - linux/build_artifacts.sh
# - macos/build_artifacts.sh
# - windows/build_artifacts.bat
(cd multibuild; git checkout b89bb903e94308be79abefa4f436bf123ebb1313)
cp kokoro/release/python/macos/config.sh config.sh

@ -18,7 +18,7 @@ REM Pin multibuild scripts at a known commit to avoid potentially unwanted futur
REM silently creeping in (see https://github.com/protocolbuffers/protobuf/issues/9180).
REM IMPORTANT: always pin multibuild at the same commit for:
REM - linux/build_artifacts.sh
REM - linux/build_artifacts.sh
REM - macos/build_artifacts.sh
REM - windows/build_artifacts.bat
cd multibuild
git checkout b89bb903e94308be79abefa4f436bf123ebb1313
@ -34,6 +34,11 @@ SET ZLIB_ROOT=%cd%\zlib
del /Q zlib.zip
del /Q zlib-src.zip
REM Update Submodules
REM This is needed because this build uses CMake <3.13.
git submodule update --init --recursive
SET ABSL_ROOT_DIR=%cd%\third_party\abseil-cpp
REM Create directory for artifacts
SET ARTIFACT_DIR=%cd%\artifacts
mkdir %ARTIFACT_DIR%

@ -49,7 +49,7 @@ mkdir src\.libs
mkdir vcprojects
pushd vcprojects
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF ../cmake || goto :error
cmake -G "%generator%" -Dprotobuf_BUILD_SHARED_LIBS=%BUILD_DLL% -Dprotobuf_UNICODE=%UNICODE% -Dprotobuf_BUILD_TESTS=OFF -DABSL_ROOT_DIR=%ABSL_ROOT_DIR% ../cmake || goto :error
msbuild protobuf.sln /p:Platform=%vcplatform% /p:Configuration=Release || goto :error
dir /s /b
popd

@ -92,9 +92,9 @@ class Api extends \Google\Protobuf\Internal\Message
* @type string $name
* The fully qualified name of this interface, including package name
* followed by the interface's simple name.
* @type \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $methods
* @type array<\Google\Protobuf\Method>|\Google\Protobuf\Internal\RepeatedField $methods
* The methods of this interface, in unspecified order.
* @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
* @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
* Any metadata attached to the interface.
* @type string $version
* A version string for this interface. If specified, must have the form
@ -117,7 +117,7 @@ class Api extends \Google\Protobuf\Internal\Message
* @type \Google\Protobuf\SourceContext $source_context
* Source context for the protocol buffer service represented by this
* message.
* @type \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $mixins
* @type array<\Google\Protobuf\Mixin>|\Google\Protobuf\Internal\RepeatedField $mixins
* Included interfaces. See [Mixin][].
* @type int $syntax
* The source syntax of the service.
@ -171,7 +171,7 @@ class Api extends \Google\Protobuf\Internal\Message
* The methods of this interface, in unspecified order.
*
* Generated from protobuf field <code>repeated .google.protobuf.Method methods = 2;</code>
* @param \Google\Protobuf\Method[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Method>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMethods($var)
@ -197,7 +197,7 @@ class Api extends \Google\Protobuf\Internal\Message
* Any metadata attached to the interface.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)
@ -319,7 +319,7 @@ class Api extends \Google\Protobuf\Internal\Message
* Included interfaces. See [Mixin][].
*
* Generated from protobuf field <code>repeated .google.protobuf.Mixin mixins = 6;</code>
* @param \Google\Protobuf\Mixin[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Mixin>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMixins($var)

@ -54,9 +54,9 @@ class Enum extends \Google\Protobuf\Internal\Message
*
* @type string $name
* Enum type name.
* @type \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $enumvalue
* @type array<\Google\Protobuf\EnumValue>|\Google\Protobuf\Internal\RepeatedField $enumvalue
* Enum value definitions.
* @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
* @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
* Protocol buffer options.
* @type \Google\Protobuf\SourceContext $source_context
* The source context.
@ -110,7 +110,7 @@ class Enum extends \Google\Protobuf\Internal\Message
* Enum value definitions.
*
* Generated from protobuf field <code>repeated .google.protobuf.EnumValue enumvalue = 2;</code>
* @param \Google\Protobuf\EnumValue[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\EnumValue>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setEnumvalue($var)
@ -136,7 +136,7 @@ class Enum extends \Google\Protobuf\Internal\Message
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)

@ -44,7 +44,7 @@ class EnumValue extends \Google\Protobuf\Internal\Message
* Enum value name.
* @type int $number
* Enum value number.
* @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
* @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
* Protocol buffer options.
* }
*/
@ -120,7 +120,7 @@ class EnumValue extends \Google\Protobuf\Internal\Message
* Protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 3;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)

@ -100,7 +100,7 @@ class Field extends \Google\Protobuf\Internal\Message
* types. The first type has index 1; zero means the type is not in the list.
* @type bool $packed
* Whether to use alternative packed wire representation.
* @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
* @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
* The protocol buffer options.
* @type string $json_name
* The field JSON name.
@ -314,7 +314,7 @@ class Field extends \Google\Protobuf\Internal\Message
* The protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 9;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)

@ -178,7 +178,7 @@ class FieldMask extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type string[]|\Google\Protobuf\Internal\RepeatedField $paths
* @type array<string>|\Google\Protobuf\Internal\RepeatedField $paths
* The set of field mask paths.
* }
*/
@ -202,7 +202,7 @@ class FieldMask extends \Google\Protobuf\Internal\Message
* The set of field mask paths.
*
* Generated from protobuf field <code>repeated string paths = 1;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPaths($var)

@ -68,15 +68,15 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $name
* @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $field
* @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension
* @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $nested_type
* @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type
* @type \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $extension_range
* @type \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $oneof_decl
* @type array<\Google\Protobuf\Internal\FieldDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $field
* @type array<\Google\Protobuf\Internal\FieldDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $extension
* @type array<\Google\Protobuf\Internal\DescriptorProto>|\Google\Protobuf\Internal\RepeatedField $nested_type
* @type array<\Google\Protobuf\Internal\EnumDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $enum_type
* @type array<\Google\Protobuf\Internal\DescriptorProto\ExtensionRange>|\Google\Protobuf\Internal\RepeatedField $extension_range
* @type array<\Google\Protobuf\Internal\OneofDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $oneof_decl
* @type \Google\Protobuf\Internal\MessageOptions $options
* @type \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
* @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name
* @type array<\Google\Protobuf\Internal\DescriptorProto\ReservedRange>|\Google\Protobuf\Internal\RepeatedField $reserved_range
* @type array<string>|\Google\Protobuf\Internal\RepeatedField $reserved_name
* Reserved field names, which may not be used by fields in the same message.
* A given name may only be reserved once.
* }
@ -129,7 +129,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto field = 2;</code>
* @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\FieldDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setField($var)
@ -151,7 +151,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 6;</code>
* @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\FieldDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExtension($var)
@ -173,7 +173,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto nested_type = 3;</code>
* @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\DescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setNestedType($var)
@ -195,7 +195,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 4;</code>
* @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\EnumDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setEnumType($var)
@ -217,7 +217,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;</code>
* @param \Google\Protobuf\Internal\DescriptorProto\ExtensionRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\DescriptorProto\ExtensionRange>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExtensionRange($var)
@ -239,7 +239,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;</code>
* @param \Google\Protobuf\Internal\OneofDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\OneofDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOneofDecl($var)
@ -293,7 +293,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;</code>
* @param \Google\Protobuf\Internal\DescriptorProto\ReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\DescriptorProto\ReservedRange>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedRange($var)
@ -321,7 +321,7 @@ class DescriptorProto extends \Google\Protobuf\Internal\Message
* A given name may only be reserved once.
*
* Generated from protobuf field <code>repeated string reserved_name = 10;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedName($var)

@ -52,13 +52,13 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $name
* @type \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $value
* @type array<\Google\Protobuf\Internal\EnumValueDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $value
* @type \Google\Protobuf\Internal\EnumOptions $options
* @type \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $reserved_range
* @type array<\Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange>|\Google\Protobuf\Internal\RepeatedField $reserved_range
* Range of reserved numeric values. Reserved numeric values may not be used
* by enum values in the same enum declaration. Reserved ranges may not
* overlap.
* @type string[]|\Google\Protobuf\Internal\RepeatedField $reserved_name
* @type array<string>|\Google\Protobuf\Internal\RepeatedField $reserved_name
* Reserved enum value names, which may not be reused. A given name may only
* be reserved once.
* }
@ -111,7 +111,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.EnumValueDescriptorProto value = 2;</code>
* @param \Google\Protobuf\Internal\EnumValueDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\EnumValueDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setValue($var)
@ -173,7 +173,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
* overlap.
*
* Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;</code>
* @param \Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedRange($var)
@ -201,7 +201,7 @@ class EnumDescriptorProto extends \Google\Protobuf\Internal\Message
* be reserved once.
*
* Generated from protobuf field <code>repeated string reserved_name = 5;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setReservedName($var)

@ -52,7 +52,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
* Depending on the target platform, this can emit Deprecated annotations
* for the enum, or it will be completely ignored; in the very least, this
* is a formalization for deprecating enums.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -156,7 +156,7 @@ class EnumOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -42,7 +42,7 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
* Depending on the target platform, this can emit Deprecated annotations
* for the enum value, or it will be completely ignored; in the very least,
* this is a formalization for deprecating enum values.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -108,7 +108,7 @@ class EnumValueOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -28,7 +28,7 @@ class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -52,7 +52,7 @@ class ExtensionRangeOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -180,7 +180,7 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
* is a formalization for deprecating fields.
* @type bool $weak
* For Google-internal migration only. Do not use.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -552,7 +552,7 @@ class FieldOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -97,18 +97,18 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
* file name, relative to root of source tree
* @type string $package
* e.g. "foo", "foo.bar", etc.
* @type string[]|\Google\Protobuf\Internal\RepeatedField $dependency
* @type array<string>|\Google\Protobuf\Internal\RepeatedField $dependency
* Names of files imported by this file.
* @type int[]|\Google\Protobuf\Internal\RepeatedField $public_dependency
* @type array<int>|\Google\Protobuf\Internal\RepeatedField $public_dependency
* Indexes of the public imported files in the dependency list above.
* @type int[]|\Google\Protobuf\Internal\RepeatedField $weak_dependency
* @type array<int>|\Google\Protobuf\Internal\RepeatedField $weak_dependency
* Indexes of the weak imported files in the dependency list.
* For Google-internal migration only. Do not use.
* @type \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $message_type
* @type array<\Google\Protobuf\Internal\DescriptorProto>|\Google\Protobuf\Internal\RepeatedField $message_type
* All top-level definitions in this file.
* @type \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $enum_type
* @type \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $service
* @type \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $extension
* @type array<\Google\Protobuf\Internal\EnumDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $enum_type
* @type array<\Google\Protobuf\Internal\ServiceDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $service
* @type array<\Google\Protobuf\Internal\FieldDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $extension
* @type \Google\Protobuf\Internal\FileOptions $options
* @type \Google\Protobuf\Internal\SourceCodeInfo $source_code_info
* This field contains optional information about the original source code.
@ -212,7 +212,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
* Names of files imported by this file.
*
* Generated from protobuf field <code>repeated string dependency = 3;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setDependency($var)
@ -238,7 +238,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
* Indexes of the public imported files in the dependency list above.
*
* Generated from protobuf field <code>repeated int32 public_dependency = 10;</code>
* @param int[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPublicDependency($var)
@ -266,7 +266,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
* For Google-internal migration only. Do not use.
*
* Generated from protobuf field <code>repeated int32 weak_dependency = 11;</code>
* @param int[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setWeakDependency($var)
@ -292,7 +292,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
* All top-level definitions in this file.
*
* Generated from protobuf field <code>repeated .google.protobuf.DescriptorProto message_type = 4;</code>
* @param \Google\Protobuf\Internal\DescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\DescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMessageType($var)
@ -314,7 +314,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.EnumDescriptorProto enum_type = 5;</code>
* @param \Google\Protobuf\Internal\EnumDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\EnumDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setEnumType($var)
@ -336,7 +336,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.ServiceDescriptorProto service = 6;</code>
* @param \Google\Protobuf\Internal\ServiceDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\ServiceDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setService($var)
@ -358,7 +358,7 @@ class FileDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.FieldDescriptorProto extension = 7;</code>
* @param \Google\Protobuf\Internal\FieldDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\FieldDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setExtension($var)

@ -29,7 +29,7 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $file
* @type array<\Google\Protobuf\Internal\FileDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $file
* }
*/
public function __construct($data = NULL) {
@ -48,7 +48,7 @@ class FileDescriptorSet extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.FileDescriptorProto file = 1;</code>
* @param \Google\Protobuf\Internal\FileDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\FileDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setFile($var)

@ -266,7 +266,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
* Use this option to change the package of ruby generated classes. Default
* is empty. When this option is not set, the package name will be used for
* determining the ruby package.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here.
* See the documentation for the "Options" section above.
* }
@ -1091,7 +1091,7 @@ class FileOptions extends \Google\Protobuf\Internal\Message
* See the documentation for the "Options" section above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -33,7 +33,7 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $annotation
* @type array<\Google\Protobuf\Internal\GeneratedCodeInfo\Annotation>|\Google\Protobuf\Internal\RepeatedField $annotation
* An Annotation connects some span of text in generated code to an element
* of its generating .proto file.
* }
@ -60,7 +60,7 @@ class GeneratedCodeInfo extends \Google\Protobuf\Internal\Message
* of its generating .proto file.
*
* Generated from protobuf field <code>repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;</code>
* @param \Google\Protobuf\Internal\GeneratedCodeInfo\Annotation[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\GeneratedCodeInfo\Annotation>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setAnnotation($var)

@ -50,7 +50,7 @@ class Annotation extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int[]|\Google\Protobuf\Internal\RepeatedField $path
* @type array<int>|\Google\Protobuf\Internal\RepeatedField $path
* Identifies the element in the original source .proto file. This field
* is formatted the same as SourceCodeInfo.Location.path.
* @type string $source_file
@ -86,7 +86,7 @@ class Annotation extends \Google\Protobuf\Internal\Message
* is formatted the same as SourceCodeInfo.Location.path.
*
* Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
* @param int[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPath($var)

@ -132,7 +132,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* NOTE: Do not set the option in .proto files. Always use the maps syntax
* instead. The option should only be implicitly set by the proto compiler
* parser.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -372,7 +372,7 @@ class MessageOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -47,7 +47,7 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
* for the method, or it will be completely ignored; in the very least,
* this is a formalization for deprecating methods.
* @type int $idempotency_level
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -145,7 +145,7 @@ class MethodOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -28,7 +28,7 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -52,7 +52,7 @@ class OneofOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -118,7 +118,7 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
* This will also be called for: $ele = $arr[0]
*
* @param integer $offset The index of the element to be fetched.
* @return object The stored element at given index.
* @return mixed The stored element at given index.
* @throws \ErrorException Invalid type for index.
* @throws \ErrorException Non-existing index.
* @todo need to add return type mixed (require update php version to 8.0)
@ -134,8 +134,8 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
*
* This will also be called for: $arr []= $ele and $arr[0] = ele
*
* @param integer $offset The index of the element to be assigned.
* @param object $value The element to be assigned.
* @param int|null $offset The index of the element to be assigned.
* @param mixed $value The element to be assigned.
* @return void
* @throws \ErrorException Invalid type for index.
* @throws \ErrorException Non-existing index.

@ -37,7 +37,7 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $name
* @type \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $method
* @type array<\Google\Protobuf\Internal\MethodDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $method
* @type \Google\Protobuf\Internal\ServiceOptions $options
* }
*/
@ -89,7 +89,7 @@ class ServiceDescriptorProto extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.MethodDescriptorProto method = 2;</code>
* @param \Google\Protobuf\Internal\MethodDescriptorProto[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\MethodDescriptorProto>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setMethod($var)

@ -42,7 +42,7 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
* Depending on the target platform, this can emit Deprecated annotations
* for the service, or it will be completely ignored; in the very least,
* this is a formalization for deprecating services.
* @type \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* @type array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $uninterpreted_option
* The parser stores options it doesn't recognize here. See above.
* }
*/
@ -108,7 +108,7 @@ class ServiceOptions extends \Google\Protobuf\Internal\Message
* The parser stores options it doesn't recognize here. See above.
*
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setUninterpretedOption($var)

@ -71,7 +71,7 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $location
* @type array<\Google\Protobuf\Internal\SourceCodeInfo\Location>|\Google\Protobuf\Internal\RepeatedField $location
* A Location identifies a piece of source code in a .proto file which
* corresponds to a particular definition. This information is intended
* to be useful to IDEs, code indexers, documentation generators, and similar
@ -215,7 +215,7 @@ class SourceCodeInfo extends \Google\Protobuf\Internal\Message
* be recorded in the future.
*
* Generated from protobuf field <code>repeated .google.protobuf.SourceCodeInfo.Location location = 1;</code>
* @param \Google\Protobuf\Internal\SourceCodeInfo\Location[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\SourceCodeInfo\Location>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLocation($var)

@ -107,7 +107,7 @@ class Location extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type int[]|\Google\Protobuf\Internal\RepeatedField $path
* @type array<int>|\Google\Protobuf\Internal\RepeatedField $path
* Identifies which part of the FileDescriptorProto was defined at this
* location.
* Each element is a field number or an index. They form a path from
@ -129,7 +129,7 @@ class Location extends \Google\Protobuf\Internal\Message
* [ 4, 3, 2, 7 ]
* this path refers to the whole field declaration (from the beginning
* of the label to the terminating semicolon).
* @type int[]|\Google\Protobuf\Internal\RepeatedField $span
* @type array<int>|\Google\Protobuf\Internal\RepeatedField $span
* Always has exactly three or four elements: start line, start column,
* end line (optional, otherwise assumed same as start line), end column.
* These are packed into a single field for efficiency. Note that line
@ -173,7 +173,7 @@ class Location extends \Google\Protobuf\Internal\Message
* optional int32 grault = 6;
* // ignored detached comments.
* @type string $trailing_comments
* @type string[]|\Google\Protobuf\Internal\RepeatedField $leading_detached_comments
* @type array<string>|\Google\Protobuf\Internal\RepeatedField $leading_detached_comments
* }
*/
public function __construct($data = NULL) {
@ -236,7 +236,7 @@ class Location extends \Google\Protobuf\Internal\Message
* of the label to the terminating semicolon).
*
* Generated from protobuf field <code>repeated int32 path = 1 [packed = true];</code>
* @param int[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setPath($var)
@ -270,7 +270,7 @@ class Location extends \Google\Protobuf\Internal\Message
* 1 to each before displaying to a user.
*
* Generated from protobuf field <code>repeated int32 span = 2 [packed = true];</code>
* @param int[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setSpan($var)
@ -430,7 +430,7 @@ class Location extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated string leading_detached_comments = 6;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setLeadingDetachedComments($var)

@ -60,7 +60,7 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $name
* @type array<\Google\Protobuf\Internal\UninterpretedOption\NamePart>|\Google\Protobuf\Internal\RepeatedField $name
* @type string $identifier_value
* The value of the uninterpreted option, in whatever type the tokenizer
* identified it as during parsing. Exactly one of these should be set.
@ -87,7 +87,7 @@ class UninterpretedOption extends \Google\Protobuf\Internal\Message
/**
* Generated from protobuf field <code>repeated .google.protobuf.UninterpretedOption.NamePart name = 2;</code>
* @param \Google\Protobuf\Internal\UninterpretedOption\NamePart[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Internal\UninterpretedOption\NamePart>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setName($var)

@ -29,7 +29,7 @@ class ListValue extends \Google\Protobuf\Internal\Message
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $values
* @type array<\Google\Protobuf\Value>|\Google\Protobuf\Internal\RepeatedField $values
* Repeated field of dynamically typed values.
* }
*/
@ -53,7 +53,7 @@ class ListValue extends \Google\Protobuf\Internal\Message
* Repeated field of dynamically typed values.
*
* Generated from protobuf field <code>repeated .google.protobuf.Value values = 1;</code>
* @param \Google\Protobuf\Value[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Value>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setValues($var)

@ -74,7 +74,7 @@ class Method extends \Google\Protobuf\Internal\Message
* The URL of the output message type.
* @type bool $response_streaming
* If true, the response is streamed.
* @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
* @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
* Any metadata attached to the method.
* @type int $syntax
* The source syntax of this method.
@ -230,7 +230,7 @@ class Method extends \Google\Protobuf\Internal\Message
* Any metadata attached to the method.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 6;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)

@ -60,11 +60,11 @@ class Type extends \Google\Protobuf\Internal\Message
*
* @type string $name
* The fully qualified message name.
* @type \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $fields
* @type array<\Google\Protobuf\Field>|\Google\Protobuf\Internal\RepeatedField $fields
* The list of fields.
* @type string[]|\Google\Protobuf\Internal\RepeatedField $oneofs
* @type array<string>|\Google\Protobuf\Internal\RepeatedField $oneofs
* The list of types appearing in `oneof` definitions in this type.
* @type \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $options
* @type array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $options
* The protocol buffer options.
* @type \Google\Protobuf\SourceContext $source_context
* The source context.
@ -118,7 +118,7 @@ class Type extends \Google\Protobuf\Internal\Message
* The list of fields.
*
* Generated from protobuf field <code>repeated .google.protobuf.Field fields = 2;</code>
* @param \Google\Protobuf\Field[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Field>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setFields($var)
@ -144,7 +144,7 @@ class Type extends \Google\Protobuf\Internal\Message
* The list of types appearing in `oneof` definitions in this type.
*
* Generated from protobuf field <code>repeated string oneofs = 3;</code>
* @param string[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOneofs($var)
@ -170,7 +170,7 @@ class Type extends \Google\Protobuf\Internal\Message
* The protocol buffer options.
*
* Generated from protobuf field <code>repeated .google.protobuf.Option options = 4;</code>
* @param \Google\Protobuf\Option[]|\Google\Protobuf\Internal\RepeatedField $var
* @param array<\Google\Protobuf\Option>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setOptions($var)

@ -163,7 +163,7 @@ class GeneratedPhpdocTest extends TestBase
'setRepeatedEnum',
'setRepeatedNoNamespaceEnum',
],
'@param int[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<int>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
@ -173,45 +173,45 @@ class GeneratedPhpdocTest extends TestBase
'setRepeatedFixed64',
'setRepeatedSfixed64',
],
'@param int[]|string[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<int>|array<string>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
'setRepeatedFloat',
'setRepeatedDouble',
],
'@param float[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<float>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
'setRepeatedBool',
],
'@param bool[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<bool>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
'setRepeatedString',
'setRepeatedBytes',
],
'@param string[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<string>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
'setRepeatedMessage',
],
'@param \Foo\TestMessage\Sub[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<\Foo\TestMessage\Sub>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
'setRepeatedRecursive',
],
'@param \Foo\TestMessage[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<\Foo\TestMessage>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[
'setRepeatedNoNamespaceMessage',
],
'@param \NoNamespaceMessage[]|\Google\Protobuf\Internal\RepeatedField $var'
'@param array<\NoNamespaceMessage>|\Google\Protobuf\Internal\RepeatedField $var'
],
[
[

@ -0,0 +1,117 @@
load("@rules_pkg//:pkg.bzl", "pkg_zip")
load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files")
load("//:protobuf_release.bzl", "package_naming")
load(":cc_dist_library.bzl", "cc_dist_library")
pkg_files(
name = "wkt_protos_files",
srcs = [
"//:any_proto",
"//:api_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
"//:source_context_proto",
"//:struct_proto",
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
],
prefix = "include/google/protobuf",
visibility = ["//visibility:private"],
)
pkg_files(
name = "descriptor_protos_files",
srcs = [
"//:descriptor_proto",
],
prefix = "include/google/protobuf",
visibility = ["//visibility:private"],
)
pkg_files(
name = "compiler_plugin_protos_files",
srcs = ["//:compiler_plugin_proto"],
prefix = "include/google/protobuf/compiler",
visibility = ["//visibility:private"],
)
################################################################################
# Generates protoc release artifacts.
################################################################################
genrule(
name = "protoc_readme",
outs = ["readme.txt"],
cmd = """
echo "Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/
This package contains a precompiled binary version of the protocol buffer
compiler (protoc). This binary is intended for users who want to use Protocol
Buffers in languages other than C++ but do not want to compile protoc
themselves. To install, simply place this binary somewhere in your PATH.
If you intend to use the included well known types then don't forget to
copy the contents of the 'include' directory somewhere as well, for example
into '/usr/local/include/'.
Please refer to our official github site for more installation instructions:
https://github.com/protocolbuffers/protobuf" > $@
""",
visibility = ["//visibility:private"],
)
pkg_files(
name = "protoc_files",
srcs = ["//:protoc"],
attributes = pkg_attributes(mode = "0555"),
prefix = "bin/",
visibility = ["//visibility:private"],
)
package_naming(
name = "protoc_pkg_naming",
)
pkg_zip(
name = "protoc_release",
srcs = [
":compiler_plugin_protos_files",
":descriptor_protos_files",
":protoc_files",
":protoc_readme",
":wkt_protos_files",
],
package_file_name = "protoc-{version}-{platform}.zip",
package_variables = ":protoc_pkg_naming",
)
################################################################################
# Protobuf runtime libraries.
################################################################################
cc_dist_library(
name = "protobuf_lite",
linkopts = select({
"//:msvc": [],
"//conditions:default": ["-lpthread"],
}),
deps = [
"//:protobuf_lite",
],
)
cc_dist_library(
name = "protobuf",
linkopts = select({
"//:msvc": [],
"//conditions:default": [
"-lz",
"-lpthread",
],
}),
deps = [
"//:protobuf",
"//:protobuf_lite",
],
)

@ -36,39 +36,40 @@ import os
import sys
import warnings
def _ApiVersionToImplementationType(api_version):
if api_version == 2:
return 'cpp'
if api_version == 1:
raise ValueError('api_version=1 is no longer supported.')
if api_version == 0:
return 'python'
return None
_implementation_type = None
try:
# pylint: disable=g-import-not-at-top
from google.protobuf.internal import _api_implementation
# The compile-time constants in the _api_implementation module can be used to
# switch to a certain implementation of the Python API at build time.
_api_version = _api_implementation.api_version
_implementation_type = _ApiVersionToImplementationType(
_api_implementation.api_version)
except ImportError:
_api_version = -1 # Unspecified by compiler flags.
if _api_version == 1:
raise ValueError('api_version=1 is no longer supported.')
pass # Unspecified by compiler flags.
def _ApiVersionToImplementationType(api_version):
if api_version == 3:
return 'upb'
if api_version == 2:
return 'cpp'
return 'python'
# TODO(jieluo): Remove _api_version and only keep implementation_type
# http://b/228103078
_default_implementation_type = _ApiVersionToImplementationType(_api_version)
if _implementation_type is None:
_implementation_type = 'python'
# This environment variable can be used to switch to a certain implementation
# of the Python API, overriding the compile-time constants in the
# _api_implementation module. Right now only 'python', 'cpp' and 'upb' are
# valid values. Any other value will raise error.
_implementation_type = os.getenv('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION',
_default_implementation_type)
_implementation_type)
if _implementation_type not in ('python', 'cpp', 'upb'):
raise ValueError('PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION {0} is not '

@ -40,6 +40,7 @@ import textwrap
import unittest
from google.protobuf import any_pb2
from google.protobuf import struct_pb2
from google.protobuf import any_test_pb2
from google.protobuf import map_unittest_pb2
from google.protobuf import unittest_custom_options_pb2
@ -1939,6 +1940,16 @@ class Proto3Tests(unittest.TestCase):
text_format.Merge(text, message)
self.assertEqual(str(e.exception), '3:11 : Expected "}".')
def testParseExpandedAnyListValue(self):
any_msg = any_pb2.Any()
any_msg.Pack(struct_pb2.ListValue())
msg = any_test_pb2.TestAny(any_value=any_msg)
text = ('any_value {\n'
' [type.googleapis.com/google.protobuf.ListValue] {}\n'
'}\n')
parsed_msg = text_format.Parse(text, any_test_pb2.TestAny())
self.assertEqual(msg, parsed_msg)
def testProto3Optional(self):
msg = test_proto3_optional_pb2.TestProto3Optional()
self.assertEqual(text_format.MessageToString(msg), '')

@ -365,7 +365,7 @@ class UnknownFieldsAccessorsTest(unittest.TestCase):
def testUnknownExtensions(self):
message = unittest_pb2.TestEmptyMessageWithExtensions()
message.ParseFromString(self.all_fields_data)
self.assertEqual(len(message.UnknownFields()), 98)
self.assertEqual(len(unknown_fields.UnknownFieldSet(message)), 98)
self.assertEqual(message.SerializeToString(), self.all_fields_data)

@ -886,7 +886,10 @@ class _Parser(object):
expanded_any_end_token = '}'
expanded_any_sub_message = _BuildMessageFromTypeName(packed_type_name,
self.descriptor_pool)
if not expanded_any_sub_message:
# Direct comparison with None is used instead of implicit bool conversion
# to avoid false positives with falsy initial values, e.g. for
# google.protobuf.ListValue.
if expanded_any_sub_message is None:
raise ParseError('Type %s not found in descriptor pool' %
packed_type_name)
while not tokenizer.TryConsume(expanded_any_end_token):

@ -40,17 +40,13 @@ Simple usage example:
from google.protobuf.internal import api_implementation
if api_implementation.Type() != 'python':
from google.protobuf.pyext import _message # pylint: disable=g-import-not-at-top
if api_implementation._c_module is not None: # pylint: disable=protected-access
UnknownFieldSet = api_implementation._c_module.UnknownFieldSet # pylint: disable=protected-access
else:
from google.protobuf.internal import decoder # pylint: disable=g-import-not-at-top
from google.protobuf.internal import wire_format # pylint: disable=g-import-not-at-top
if api_implementation.Type() == 'cpp':
UnknownFieldSet = _message.UnknownFieldSet
else:
class UnknownField:
"""A parsed unknown field."""

@ -141,12 +141,14 @@ public class RubyRepeatedField extends RubyObject {
} else if (arg instanceof RubyRange) {
RubyRange range = ((RubyRange) arg);
int beg = RubyNumeric.num2int(range.first(context));
int len = RubyNumeric.num2int(range.size(context));
int first = normalizeArrayIndex(range.first(context));
int last = normalizeArrayIndex(range.last(context));
if (len == 0) return context.runtime.newEmptyArray();
if (last - first < 0) {
return context.runtime.newEmptyArray();
}
return this.storage.subseq(beg, len);
return this.storage.subseq(first, last - first + (range.isExcludeEnd() ? 0 : 1));
}
}
/* assume 2 arguments */

@ -175,6 +175,51 @@ class RepeatedFieldTest < Test::Unit::TestCase
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[0..2]
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[0..5]
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[0..-1]
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[0..-3]
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[0...-1] # Exclusive range
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[0...-3] # Exclusive range
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[-2..-1]
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[-5..-1]
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
# Infinite range; introduce in Ruby 2.7.
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
eval "arr[0..]"
end
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
# Beginless range; introduced in Ruby 2.7.
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
eval "arr[..-1]"
end
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
# Infinite range; introduce in Ruby 2.7.
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
eval "arr[0...]" # Exclusive range
end
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
# Beginless range; introduced in Ruby 2.7.
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
eval "arr[...-1]" # Exclusive range
end
end
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr[-1, 1]
end

@ -193,9 +193,11 @@ bool IsLazy(const FieldDescriptor* field, const Options& options,
IsEagerlyVerifiedLazy(field, options, scc_analyzer);
}
bool IsEagerlyVerifiedLazyByProfile(const FieldDescriptor* field,
const Options& options,
MessageSCCAnalyzer* scc_analyzer) {
// Returns true if "field" is a message field that is backed by LazyField per
// profile (go/pdlazy).
inline bool IsEagerlyVerifiedLazyByProfile(const FieldDescriptor* field,
const Options& options,
MessageSCCAnalyzer* scc_analyzer) {
return false;
}

@ -364,12 +364,6 @@ inline bool IsExplicitLazy(const FieldDescriptor* field) {
return field->options().lazy() || field->options().unverified_lazy();
}
// Returns true if "field" is a message field that is backed by LazyField per
// profile (go/pdlazy).
bool IsEagerlyVerifiedLazyByProfile(const FieldDescriptor* field,
const Options& options,
MessageSCCAnalyzer* scc_analyzer);
bool IsEagerlyVerifiedLazy(const FieldDescriptor* field, const Options& options,
MessageSCCAnalyzer* scc_analyzer);

@ -2250,7 +2250,7 @@ std::pair<size_t, size_t> MessageGenerator::GenerateOffsets(
//
// Embed whether the field is eagerly verified lazy or inlined string to the
// LSB of the offset.
if (IsEagerlyVerifiedLazyByProfile(field, options_, scc_analyzer_)) {
if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) {
format(" | 0x1u // eagerly verified lazy\n");
} else if (IsStringInlined(field, options_)) {
format(" | 0x1u // inlined\n");

@ -250,7 +250,7 @@ bool FileGenerator::Validate(std::string* error) {
<< "generate full runtime code for Java. To use Java Lite runtime, "
<< "users should use the Java Lite plugin instead. See:\n"
<< " "
"https://github.com/protocolbuffers/protobuf/blob/master/java/"
"https://github.com/protocolbuffers/protobuf/blob/main/java/"
"lite.md";
}
return true;

@ -500,9 +500,9 @@ std::string PhpSetterTypeName(const FieldDescriptor* field,
// accommodate for edge case with multiple types.
size_t start_pos = type.find("|");
if (start_pos != std::string::npos) {
type.replace(start_pos, 1, "[]|");
type.replace(start_pos, 1, ">|array<");
}
type += "[]|\\Google\\Protobuf\\Internal\\RepeatedField";
type = "array<" + type + ">|\\Google\\Protobuf\\Internal\\RepeatedField";
}
return type;
}

@ -5031,6 +5031,13 @@ const FileDescriptor* DescriptorBuilder::BuildFile(
}
}
static const int kMaximumPackageLength = 511;
if (proto.package().size() > kMaximumPackageLength) {
AddError(proto.package(), proto, DescriptorPool::ErrorCollector::NAME,
"Package name is too long");
return nullptr;
}
// If we have a fallback_database_, and we aren't doing lazy import building,
// attempt to load all dependencies now, before checkpointing tables_. This
// avoids confusion with recursive checkpoints.

@ -6865,6 +6865,30 @@ TEST_F(ValidationErrorTest, UnusedImportWithOtherError) {
}
TEST_F(ValidationErrorTest, PackageTooLong) {
BuildFileWithErrors(
"name: \"foo.proto\" "
"syntax: \"proto3\" "
"package: "
"\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaa\"",
"foo.proto: "
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"aaaaaaaa: NAME: Package name is too long\n");
}
// ===================================================================
// DescriptorDatabase

@ -257,7 +257,11 @@ bool Reflection::IsLazyExtension(const Message& message,
}
bool Reflection::IsLazilyVerifiedLazyField(const FieldDescriptor* field) const {
return field->options().lazy() || field->options().unverified_lazy();
if (field->options().unverified_lazy()) return true;
// Message fields with [lazy=true] will be eagerly verified
// (go/verified-lazy).
return field->options().lazy() && !IsEagerlyVerifiedLazyField(field);
}
bool Reflection::IsEagerlyVerifiedLazyField(

@ -78,6 +78,14 @@ class GeneratedMessageReflectionTestHelper {
static bool IsLazyField(const Message& msg, const FieldDescriptor* field) {
return msg.GetReflection()->IsLazyField(field);
}
static bool IsEagerlyVerifiedLazyField(const Message& msg,
const FieldDescriptor* field) {
return msg.GetReflection()->IsEagerlyVerifiedLazyField(field);
}
static bool IsLazilyVerifiedLazyField(const Message& msg,
const FieldDescriptor* field) {
return msg.GetReflection()->IsLazilyVerifiedLazyField(field);
}
};
namespace {

@ -60,7 +60,7 @@ namespace internal {
// It uses bit 0 == 0 to indicate an arena pointer and bit 0 == 1 to indicate a
// UFS+Arena-container pointer. Besides it uses bit 1 == 0 to indicate arena
// allocation and bit 1 == 1 to indicate heap allocation.
class InternalMetadata {
class PROTOBUF_EXPORT InternalMetadata {
public:
constexpr InternalMetadata() : ptr_(0) {}
explicit InternalMetadata(Arena* arena, bool is_message_owned = false) {

@ -381,6 +381,8 @@ static inline bool InStateZero(const UTF8ScanObj* st, const uint8* Tbl) {
return (static_cast<uint32>(Tbl - Tbl0) < st->state0_size);
}
namespace {
// Scan a UTF-8 string based on state table.
// Always scan complete UTF-8 characters
// Set number of bytes scanned. Return reason for exiting
@ -539,7 +541,6 @@ int UTF8GenericScanFastAscii(const UTF8ScanObj* st,
// UTF-8 strings. Since UTF-8 validation is only used for debugging
// anyway, we simply always return success if initialization hasn't
// occurred yet.
namespace {
bool module_initialized_ = false;

@ -503,7 +503,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartObject(
// stream, we write those values.
if (master_type_.name() == kStructType) {
// Struct has a map<string, Value> field called "fields".
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto
// https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto
// "fields": [
Push("fields", Item::MAP, true, true);
return this;
@ -514,7 +514,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartObject(
// object within that type is a struct type. So start a struct.
//
// The struct field in Value type is named "struct_value"
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto
// https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto
// Also start the map field "fields" within the struct.
// "struct_value": {
// "fields": [
@ -703,7 +703,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartList(
// we have to start the "list_value" within google.protobuf.Value.
//
// See
// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto
// https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/struct.proto
//
// Render
// "<name>": {

@ -4,10 +4,6 @@
# tests on kokoro (Ubuntu and MacOS). It can run locally as well but you
# will need to make sure the required compilers/tools are available.
# For when some other test needs the C++ main build, including protoc and
# libprotobuf.
LAST_RELEASED=3.9.0
internal_build_cpp() {
if [ -f src/protoc ]; then
# Already built.
@ -162,9 +158,6 @@ build_csharp() {
# Run csharp compatibility test between 3.0.0 and the current version.
csharp/compatibility_tests/v3.0.0/test.sh 3.0.0
# Run csharp compatibility test between last released and the current version.
csharp/compatibility_tests/v3.0.0/test.sh $LAST_RELEASED
# Regression test for https://github.com/protocolbuffers/protobuf/issues/9526
# - all line endings in .proto and .cs (and .csproj) files should be LF.
@ -197,6 +190,10 @@ build_golang() {
use_java() {
version=$1
case "$version" in
jdk17)
export PATH=/usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
;;
jdk11)
export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
@ -272,10 +269,22 @@ build_java_jdk7() {
use_java jdk7
build_java_with_conformance_tests
}
build_java_oracle7() {
use_java oracle7
build_java oracle7
}
build_java_jdk8() {
use_java jdk8
build_java_with_conformance_tests
}
build_java_jdk17() {
use_java jdk17
build_java_with_conformance_tests
}
build_java_linkage_monitor() {
# Linkage Monitor checks compatibility with other Google libraries
# https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor
@ -405,7 +414,6 @@ build_python310_cpp() {
build_python_cpp_version py310-cpp
}
build_ruby23() {
internal_build_cpp # For conformance tests.
cd ruby && bash travis-test.sh ruby-2.3.8 && cd ..
@ -540,7 +548,6 @@ build_php7.3_mac() {
build_php_compatibility() {
internal_build_cpp
php/tests/compatibility_test.sh $LAST_RELEASED
}
build_php_multirequest() {
@ -587,6 +594,8 @@ Usage: $0 { cpp |
csharp |
java_jdk7 |
java_oracle7 |
java_jdk8 |
java_jdk17 |
java_linkage_monitor |
objectivec_ios |
objectivec_ios_debug |

@ -0,0 +1 @@
Subproject commit 8c6e53ef3adb1227fffa442c50349dab134a54bc

@ -1,5 +1,5 @@
#if (defined(__ARM_NEON) && defined(__aarch64__)) || defined(__SSE4_1__)
#if ((defined(__ARM_NEON) && defined(__aarch64__)) || defined(__SSE4_1__)) && !defined(TRUFFLERUBY)
int utf8_range2(const unsigned char* data, int len);
#else
int utf8_naive(const unsigned char* data, int len);

Loading…
Cancel
Save