diff --git a/.bazelignore b/.bazelignore index 5c3a81cce9..b92bad0bf4 100644 --- a/.bazelignore +++ b/.bazelignore @@ -1,4 +1,5 @@ # These are fetched as external repositories. +third_party/abseil-cpp third_party/benchmark third_party/googletest _build/ diff --git a/.gitmodules b/.gitmodules index bcd125a495..a287f070e8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/BUILD b/BUILD index 5de4aa3f2f..e437626514 100644 --- a/BUILD +++ b/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"], ) diff --git a/CHANGES.txt b/CHANGES.txt index 03d441f1bf..0c0f63bee5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/benchmarks/README.md b/benchmarks/README.md index 19a26e1f32..70c359660b 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -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 diff --git a/cmake/README.md b/cmake/README.md index 3fee4a0414..ce3e680234 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -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: diff --git a/conformance/README.md b/conformance/README.md index 06925dbb55..063766060c 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -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 diff --git a/docs/options.md b/docs/options.md index 9b3fb8ec39..b489288415 100644 --- a/docs/options.md +++ b/docs/options.md @@ -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 \ No newline at end of file + * Extension: 1144 + +1. Protoc-gen-authz + * Website: https://github.com/Neakxs/protoc-gen-authz + * Extension: 1145 diff --git a/java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java b/java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java index 6090985e18..b856952c73 100644 --- a/java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java +++ b/java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java @@ -150,7 +150,7 @@ final class DescriptorMessageInfoFactory implements MessageInfoFactory { *

This class is thread-safe. */ //

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 resultCache = diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java index b401cdfe64..7317f49ffe 100644 --- a/java/core/src/main/java/com/google/protobuf/TextFormat.java +++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java @@ -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; diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java index a178d2a931..c74497cd81 100644 --- a/java/core/src/main/java/com/google/protobuf/Utf8.java +++ b/java/core/src/main/java/com/google/protobuf/Utf8.java @@ -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) { diff --git a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java index 0188f2f940..55864afa72 100644 --- a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java +++ b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java @@ -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()); } - } diff --git a/kokoro/release/protoc/windows/build.bat b/kokoro/release/protoc/windows/build.bat index ae0fa94a10..75ea546c9d 100644 --- a/kokoro/release/protoc/windows/build.bat +++ b/kokoro/release/protoc/windows/build.bat @@ -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 diff --git a/kokoro/release/python/linux/build_artifacts.sh b/kokoro/release/python/linux/build_artifacts.sh index 9a3fc5841f..3ddec7444f 100755 --- a/kokoro/release/python/linux/build_artifacts.sh +++ b/kokoro/release/python/linux/build_artifacts.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/linux/config.sh config.sh diff --git a/kokoro/release/python/macos/build_artifacts.sh b/kokoro/release/python/macos/build_artifacts.sh index aeb4242a6b..bd60d75fa3 100755 --- a/kokoro/release/python/macos/build_artifacts.sh +++ b/kokoro/release/python/macos/build_artifacts.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 diff --git a/kokoro/release/python/windows/build_artifacts.bat b/kokoro/release/python/windows/build_artifacts.bat index 121283a438..32fbec4e1c 100644 --- a/kokoro/release/python/windows/build_artifacts.bat +++ b/kokoro/release/python/windows/build_artifacts.bat @@ -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% diff --git a/kokoro/release/python/windows/build_single_artifact.bat b/kokoro/release/python/windows/build_single_artifact.bat index af2d265263..d2c96c3463 100644 --- a/kokoro/release/python/windows/build_single_artifact.bat +++ b/kokoro/release/python/windows/build_single_artifact.bat @@ -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 diff --git a/php/src/Google/Protobuf/Api.php b/php/src/Google/Protobuf/Api.php index e7d76c01d6..3784263cbf 100644 --- a/php/src/Google/Protobuf/Api.php +++ b/php/src/Google/Protobuf/Api.php @@ -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 repeated .google.protobuf.Method methods = 2; - * @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 repeated .google.protobuf.Option options = 3; - * @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 repeated .google.protobuf.Mixin mixins = 6; - * @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) diff --git a/php/src/Google/Protobuf/Enum.php b/php/src/Google/Protobuf/Enum.php index e803e930d8..185e54e03c 100644 --- a/php/src/Google/Protobuf/Enum.php +++ b/php/src/Google/Protobuf/Enum.php @@ -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 repeated .google.protobuf.EnumValue enumvalue = 2; - * @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 repeated .google.protobuf.Option options = 3; - * @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) diff --git a/php/src/Google/Protobuf/EnumValue.php b/php/src/Google/Protobuf/EnumValue.php index 905f4ad14b..93c20f967c 100644 --- a/php/src/Google/Protobuf/EnumValue.php +++ b/php/src/Google/Protobuf/EnumValue.php @@ -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 repeated .google.protobuf.Option options = 3; - * @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) diff --git a/php/src/Google/Protobuf/Field.php b/php/src/Google/Protobuf/Field.php index 76a505ea56..ddae570c2b 100644 --- a/php/src/Google/Protobuf/Field.php +++ b/php/src/Google/Protobuf/Field.php @@ -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 repeated .google.protobuf.Option options = 9; - * @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) diff --git a/php/src/Google/Protobuf/FieldMask.php b/php/src/Google/Protobuf/FieldMask.php index 0b9659d38f..a8e5243f83 100644 --- a/php/src/Google/Protobuf/FieldMask.php +++ b/php/src/Google/Protobuf/FieldMask.php @@ -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|\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 repeated string paths = 1; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPaths($var) diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php index c58c5739e5..2937c5a7c5 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php @@ -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|\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 repeated .google.protobuf.FieldDescriptorProto field = 2; - * @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 repeated .google.protobuf.FieldDescriptorProto extension = 6; - * @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 repeated .google.protobuf.DescriptorProto nested_type = 3; - * @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 repeated .google.protobuf.EnumDescriptorProto enum_type = 4; - * @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 repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5; - * @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 repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8; - * @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 repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9; - * @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 repeated string reserved_name = 10; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setReservedName($var) diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php index bd50834f81..cb2a42ae37 100644 --- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php @@ -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|\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 repeated .google.protobuf.EnumValueDescriptorProto value = 2; - * @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 repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4; - * @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 repeated string reserved_name = 5; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setReservedName($var) diff --git a/php/src/Google/Protobuf/Internal/EnumOptions.php b/php/src/Google/Protobuf/Internal/EnumOptions.php index 7a69676059..838bc849f3 100644 --- a/php/src/Google/Protobuf/Internal/EnumOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/EnumValueOptions.php b/php/src/Google/Protobuf/Internal/EnumValueOptions.php index 84ba7bc85b..2db7fceea6 100644 --- a/php/src/Google/Protobuf/Internal/EnumValueOptions.php +++ b/php/src/Google/Protobuf/Internal/EnumValueOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php b/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php index b5e27c3e27..245173c3d0 100644 --- a/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php +++ b/php/src/Google/Protobuf/Internal/ExtensionRangeOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index 5fe7a19d1f..665cb065a8 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php index 435bd5fb6f..5ba7db6fbd 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php @@ -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|\Google\Protobuf\Internal\RepeatedField $dependency * Names of files imported by this file. - * @type int[]|\Google\Protobuf\Internal\RepeatedField $public_dependency + * @type array|\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|\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 repeated string dependency = 3; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\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 repeated int32 public_dependency = 10; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\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 repeated int32 weak_dependency = 11; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\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 repeated .google.protobuf.DescriptorProto message_type = 4; - * @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 repeated .google.protobuf.EnumDescriptorProto enum_type = 5; - * @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 repeated .google.protobuf.ServiceDescriptorProto service = 6; - * @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 repeated .google.protobuf.FieldDescriptorProto extension = 7; - * @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) diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php index 794e6347a3..1dae6fb3e3 100644 --- a/php/src/Google/Protobuf/Internal/FileDescriptorSet.php +++ b/php/src/Google/Protobuf/Internal/FileDescriptorSet.php @@ -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 repeated .google.protobuf.FileDescriptorProto file = 1; - * @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) diff --git a/php/src/Google/Protobuf/Internal/FileOptions.php b/php/src/Google/Protobuf/Internal/FileOptions.php index 3f2c3a4d4c..43931be809 100644 --- a/php/src/Google/Protobuf/Internal/FileOptions.php +++ b/php/src/Google/Protobuf/Internal/FileOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php index c261ed6ec9..a1db269bf9 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo.php @@ -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 repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; - * @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) diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php index 0b043d0665..617fdac4e5 100644 --- a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php +++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo/Annotation.php @@ -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|\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 repeated int32 path = 1 [packed = true]; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setPath($var) diff --git a/php/src/Google/Protobuf/Internal/MessageOptions.php b/php/src/Google/Protobuf/Internal/MessageOptions.php index 2f4e3cb7f4..5c6158019c 100644 --- a/php/src/Google/Protobuf/Internal/MessageOptions.php +++ b/php/src/Google/Protobuf/Internal/MessageOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/MethodOptions.php b/php/src/Google/Protobuf/Internal/MethodOptions.php index a4595b7448..87af45167a 100644 --- a/php/src/Google/Protobuf/Internal/MethodOptions.php +++ b/php/src/Google/Protobuf/Internal/MethodOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/OneofOptions.php b/php/src/Google/Protobuf/Internal/OneofOptions.php index 8dde8f3b17..b44d194573 100644 --- a/php/src/Google/Protobuf/Internal/OneofOptions.php +++ b/php/src/Google/Protobuf/Internal/OneofOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/RepeatedField.php b/php/src/Google/Protobuf/Internal/RepeatedField.php index cfe5140d77..ea7971f134 100644 --- a/php/src/Google/Protobuf/Internal/RepeatedField.php +++ b/php/src/Google/Protobuf/Internal/RepeatedField.php @@ -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. diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php index c511247692..e322e2abf1 100644 --- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php +++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php @@ -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 repeated .google.protobuf.MethodDescriptorProto method = 2; - * @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) diff --git a/php/src/Google/Protobuf/Internal/ServiceOptions.php b/php/src/Google/Protobuf/Internal/ServiceOptions.php index d15a36ae0a..8ac27ee804 100644 --- a/php/src/Google/Protobuf/Internal/ServiceOptions.php +++ b/php/src/Google/Protobuf/Internal/ServiceOptions.php @@ -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 repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; - * @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) diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php index 1c572e75eb..0005bc6696 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo.php @@ -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 repeated .google.protobuf.SourceCodeInfo.Location location = 1; - * @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) diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php index 479c8b2e07..032be39214 100644 --- a/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php +++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo/Location.php @@ -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|\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|\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|\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 repeated int32 path = 1 [packed = true]; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\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 repeated int32 span = 2 [packed = true]; - * @param int[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\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 repeated string leading_detached_comments = 6; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\Google\Protobuf\Internal\RepeatedField $var * @return $this */ public function setLeadingDetachedComments($var) diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption.php b/php/src/Google/Protobuf/Internal/UninterpretedOption.php index a2aae3e0a7..a1cdca5734 100644 --- a/php/src/Google/Protobuf/Internal/UninterpretedOption.php +++ b/php/src/Google/Protobuf/Internal/UninterpretedOption.php @@ -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 repeated .google.protobuf.UninterpretedOption.NamePart name = 2; - * @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) diff --git a/php/src/Google/Protobuf/ListValue.php b/php/src/Google/Protobuf/ListValue.php index 70f542326f..891283c2b2 100644 --- a/php/src/Google/Protobuf/ListValue.php +++ b/php/src/Google/Protobuf/ListValue.php @@ -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 repeated .google.protobuf.Value values = 1; - * @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) diff --git a/php/src/Google/Protobuf/Method.php b/php/src/Google/Protobuf/Method.php index 2755baa0e8..eda00bf611 100644 --- a/php/src/Google/Protobuf/Method.php +++ b/php/src/Google/Protobuf/Method.php @@ -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 repeated .google.protobuf.Option options = 6; - * @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) diff --git a/php/src/Google/Protobuf/Type.php b/php/src/Google/Protobuf/Type.php index 41b9e3602f..d4af7dfecb 100644 --- a/php/src/Google/Protobuf/Type.php +++ b/php/src/Google/Protobuf/Type.php @@ -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|\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 repeated .google.protobuf.Field fields = 2; - * @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 repeated string oneofs = 3; - * @param string[]|\Google\Protobuf\Internal\RepeatedField $var + * @param array|\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 repeated .google.protobuf.Option options = 4; - * @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) diff --git a/php/tests/GeneratedPhpdocTest.php b/php/tests/GeneratedPhpdocTest.php index a0b912b5e1..78ac623d9f 100644 --- a/php/tests/GeneratedPhpdocTest.php +++ b/php/tests/GeneratedPhpdocTest.php @@ -163,7 +163,7 @@ class GeneratedPhpdocTest extends TestBase 'setRepeatedEnum', 'setRepeatedNoNamespaceEnum', ], - '@param int[]|\Google\Protobuf\Internal\RepeatedField $var' + '@param array|\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|array|\Google\Protobuf\Internal\RepeatedField $var' ], [ [ 'setRepeatedFloat', 'setRepeatedDouble', ], - '@param float[]|\Google\Protobuf\Internal\RepeatedField $var' + '@param array|\Google\Protobuf\Internal\RepeatedField $var' ], [ [ 'setRepeatedBool', ], - '@param bool[]|\Google\Protobuf\Internal\RepeatedField $var' + '@param array|\Google\Protobuf\Internal\RepeatedField $var' ], [ [ 'setRepeatedString', 'setRepeatedBytes', ], - '@param string[]|\Google\Protobuf\Internal\RepeatedField $var' + '@param array|\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' ], [ [ diff --git a/pkg/BUILD b/pkg/BUILD new file mode 100644 index 0000000000..3e5f5d1d75 --- /dev/null +++ b/pkg/BUILD @@ -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", + ], +) diff --git a/python/google/protobuf/internal/api_implementation.py b/python/google/protobuf/internal/api_implementation.py index a409a80eee..96dd09634c 100644 --- a/python/google/protobuf/internal/api_implementation.py +++ b/python/google/protobuf/internal/api_implementation.py @@ -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 ' diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py index d1e2748220..18b784e5bf 100644 --- a/python/google/protobuf/internal/text_format_test.py +++ b/python/google/protobuf/internal/text_format_test.py @@ -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), '') diff --git a/python/google/protobuf/internal/unknown_fields_test.py b/python/google/protobuf/internal/unknown_fields_test.py index a6acc4d329..0459dba16f 100644 --- a/python/google/protobuf/internal/unknown_fields_test.py +++ b/python/google/protobuf/internal/unknown_fields_test.py @@ -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) diff --git a/python/google/protobuf/text_format.py b/python/google/protobuf/text_format.py index 3bf41abafd..a6d8bcf648 100644 --- a/python/google/protobuf/text_format.py +++ b/python/google/protobuf/text_format.py @@ -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): diff --git a/python/google/protobuf/unknown_fields.py b/python/google/protobuf/unknown_fields.py index d780d3e3a9..3bd828619f 100644 --- a/python/google/protobuf/unknown_fields.py +++ b/python/google/protobuf/unknown_fields.py @@ -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.""" diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java index 883d480c67..77842d1290 100644 --- a/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java +++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java @@ -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 */ diff --git a/ruby/tests/repeated_field_test.rb b/ruby/tests/repeated_field_test.rb index 0483efcf8c..881810cdc5 100755 --- a/ruby/tests/repeated_field_test.rb +++ b/ruby/tests/repeated_field_test.rb @@ -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 diff --git a/src/google/protobuf/compiler/cpp/helpers.cc b/src/google/protobuf/compiler/cpp/helpers.cc index 685613f6ad..0c37858aea 100644 --- a/src/google/protobuf/compiler/cpp/helpers.cc +++ b/src/google/protobuf/compiler/cpp/helpers.cc @@ -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; } diff --git a/src/google/protobuf/compiler/cpp/helpers.h b/src/google/protobuf/compiler/cpp/helpers.h index fece19366b..bab25018d2 100644 --- a/src/google/protobuf/compiler/cpp/helpers.h +++ b/src/google/protobuf/compiler/cpp/helpers.h @@ -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); diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 1990c38e84..a2acc26eb6 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -2250,7 +2250,7 @@ std::pair 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"); diff --git a/src/google/protobuf/compiler/java/file.cc b/src/google/protobuf/compiler/java/file.cc index 4bac87a32b..cf2770344c 100644 --- a/src/google/protobuf/compiler/java/file.cc +++ b/src/google/protobuf/compiler/java/file.cc @@ -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; diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc index c9bf6fe7d9..14261124b2 100644 --- a/src/google/protobuf/compiler/php/php_generator.cc +++ b/src/google/protobuf/compiler/php/php_generator.cc @@ -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; } diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 97160fdeb7..123b22aba9 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -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. diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index d8474fce02..70cfd4173d 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -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 diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index dab8b57a6d..5cb5872324 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -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( diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc index 97a9350d2f..069b5c8412 100644 --- a/src/google/protobuf/generated_message_reflection_unittest.cc +++ b/src/google/protobuf/generated_message_reflection_unittest.cc @@ -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 { diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h index 19df6c6254..11faba69fc 100644 --- a/src/google/protobuf/metadata_lite.h +++ b/src/google/protobuf/metadata_lite.h @@ -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) { diff --git a/src/google/protobuf/stubs/structurally_valid.cc b/src/google/protobuf/stubs/structurally_valid.cc index 9a476c3b4c..3db7a80908 100644 --- a/src/google/protobuf/stubs/structurally_valid.cc +++ b/src/google/protobuf/stubs/structurally_valid.cc @@ -381,6 +381,8 @@ static inline bool InStateZero(const UTF8ScanObj* st, const uint8* Tbl) { return (static_cast(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; diff --git a/src/google/protobuf/util/internal/protostream_objectwriter.cc b/src/google/protobuf/util/internal/protostream_objectwriter.cc index 3e54b1cc9a..ecb219e06e 100644 --- a/src/google/protobuf/util/internal/protostream_objectwriter.cc +++ b/src/google/protobuf/util/internal/protostream_objectwriter.cc @@ -503,7 +503,7 @@ ProtoStreamObjectWriter* ProtoStreamObjectWriter::StartObject( // stream, we write those values. if (master_type_.name() == kStructType) { // Struct has a map 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 // "": { diff --git a/tests.sh b/tests.sh index 2b08a1eb7c..8e896e8668 100755 --- a/tests.sh +++ b/tests.sh @@ -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 | diff --git a/third_party/abseil-cpp b/third_party/abseil-cpp new file mode 160000 index 0000000000..8c6e53ef3a --- /dev/null +++ b/third_party/abseil-cpp @@ -0,0 +1 @@ +Subproject commit 8c6e53ef3adb1227fffa442c50349dab134a54bc diff --git a/third_party/utf8_range/utf8_range.h b/third_party/utf8_range/utf8_range.h index 3695587d5e..23b32a1c77 100644 --- a/third_party/utf8_range/utf8_range.h +++ b/third_party/utf8_range/utf8_range.h @@ -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);