|
| 1 | ++++ |
| 2 | +title = "News Announcements for Version 30.x" |
| 3 | +linkTitle = "Version 30.x" |
| 4 | +toc_hide = "true" |
| 5 | +description = "Changes announced for Protocol Buffers version 30.x." |
| 6 | +type = "docs" |
| 7 | ++++ |
| 8 | + |
| 9 | +The following announcements are specific to Version 30.x. For information |
| 10 | +presented chronologically, see [News](/news). |
| 11 | + |
| 12 | +The following sections cover planned breaking changes in the v30 release, |
| 13 | +expected in 2025 Q1. These describe changes as we anticipate them being |
| 14 | +implemented, but due to the flexible nature of software some of these changes |
| 15 | +may not land or may vary from how they are described in this topic. |
| 16 | + |
| 17 | +## Changes in C++ {#cpp} |
| 18 | + |
| 19 | +C++ will bump its major version from 5.29.x to 6.30.x. |
| 20 | + |
| 21 | +### Descriptor APIs {#descriptor-apis} |
| 22 | + |
| 23 | +v30 will update return types in descriptor (such as `full_name`) to be |
| 24 | +`absl::string_view`. This opens up memory savings in descriptors. |
| 25 | + |
| 26 | +v28 introduced the `PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE` macro, which you |
| 27 | +can use in the meantime to enable the updated return type ahead of the breaking |
| 28 | +release. The v30 release will flip the default and remove the macro. |
| 29 | + |
| 30 | +### ctype Removed from FieldDescriptor Options {#ctype-removed} |
| 31 | + |
| 32 | +v30 will stop exposing the `ctype` from `FieldDescriptor` options. You can use |
| 33 | +the `FieldDescriptor::cpp_string_type()` API, added in the |
| 34 | +[v28 release](https://github.com/protocolbuffers/protobuf/releases/tag/v28.0), |
| 35 | +in its place. |
| 36 | + |
| 37 | +### Replace CMake Submodules with Fetched Deps {#replace-cmake-submods} |
| 38 | + |
| 39 | +v30 will remove submodules and switches to upb's old CMake pattern of fetching |
| 40 | +dependencies. |
| 41 | + |
| 42 | +If you use installed packages, you won't be affected. It could break some CMake |
| 43 | +workflows. |
| 44 | + |
| 45 | +### Remove Deprecated APIs {#remove-deprecated} |
| 46 | + |
| 47 | +v30 will remove the following public runtime APIs, which have been marked |
| 48 | +deprecated (such as `ABSL_DEPRECATED`) for at least one minor or major release |
| 49 | +and that are obsolete or replaced. |
| 50 | + |
| 51 | +#### Arena::CreateMessage |
| 52 | + |
| 53 | +**API:** |
| 54 | +[`Arena::CreateMessage`](https://github.com/protocolbuffers/protobuf/blob/f4b57b98b08aec8bc52e6a7b762edb7a1b9e8883/src/google/protobuf/arena.h#L179) |
| 55 | + |
| 56 | +**Replacement:** |
| 57 | +[`Arena::Create`](https://github.com/protocolbuffers/protobuf/blob/f4b57b98b08aec8bc52e6a7b762edb7a1b9e8883/src/google/protobuf/arena.h#L191) |
| 58 | + |
| 59 | +#### Arena::GetArena |
| 60 | + |
| 61 | +**API:** |
| 62 | +[`Arena::GetArena`](https://github.com/protocolbuffers/protobuf/blob/237332ef92daf83a53e76decd6ac43c3fcee782b/src/google/protobuf/arena.h#L346) |
| 63 | + |
| 64 | +**Replacement:** `value->GetArena()` |
| 65 | + |
| 66 | +#### RepeatedPtrField::ClearedCount |
| 67 | + |
| 68 | +**API:** |
| 69 | +[`RepeatedPtrField::ClearedCount`](https://github.com/protocolbuffers/protobuf/blame/f4b57b98b08aec8bc52e6a7b762edb7a1b9e8883/src/google/protobuf/repeated_ptr_field.h#L1157) |
| 70 | + |
| 71 | +**Replacement:** Migrate to Arenas |
| 72 | +([migration guide](https://protobuf.dev/support/migration/#cleared-elements)). |
| 73 | + |
| 74 | +#### JsonOptions |
| 75 | + |
| 76 | +**API:** |
| 77 | +[`JsonOptions`](https://github.com/protocolbuffers/protobuf/blob/f4b57b98b08aec8bc52e6a7b762edb7a1b9e8883/src/google/protobuf/util/json_util.h#L22) |
| 78 | + |
| 79 | +**Replacement:** `JsonPrintOptions` |
| 80 | + |
| 81 | +### Dropping C++14 Support {#drop-cpp-14} |
| 82 | + |
| 83 | +This release will drop C++ 14 as the minimum supported version and raise it to |
| 84 | +17, as per the |
| 85 | +[Foundational C++ Support matrix](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md). |
| 86 | + |
| 87 | +Per [our policies](https://protobuf.dev/support/version-support/), we do not |
| 88 | +consider this to be a breaking change. |
| 89 | + |
| 90 | +## Changes in JRuby {#jruby} |
| 91 | + |
| 92 | +v30 will flip the default implementation for JRuby to FFI, which may be breaking |
| 93 | +for some JRuby users. |
| 94 | + |
| 95 | +Note that this change doesn't create a Ruby major version bump because JRuby is |
| 96 | +[not officially supported](/support/version-support/#ruby). |
| 97 | + |
| 98 | +## Changes in Python {#python} |
| 99 | + |
| 100 | +Python will bump its major version from 5.29.x to 6.30.x. |
| 101 | + |
| 102 | +### Dropping Python 3.8 Support |
| 103 | + |
| 104 | +As per our official Python support policy, we will be dropping support for |
| 105 | +Python 3.8 and lower. This means the minimum supported Python version is 3.9. |
| 106 | + |
| 107 | +### Remove bazel/system_python.bzl Alias {#python-remove-alias} |
| 108 | + |
| 109 | +v30 will remove the legacy `bazel/system_python.bzl` alias. |
| 110 | + |
| 111 | +Remove direct references to `system_python.bzl` in favor of using |
| 112 | +`protobuf_deps.bzl` instead. Use `python/dist/system_python.bzl` where it was |
| 113 | +moved |
| 114 | +[in v5.27.0](https://github.com/protocolbuffers/protobuf/commit/d7f032ad1596ceeabd45ca1354516c39b97b2551) |
| 115 | +if you need a direct reference. |
| 116 | + |
| 117 | +### Field Setter Validation Changes {#python-setter-validation} |
| 118 | + |
| 119 | +Python's and upb's field setters will be fixed in v30 to validate closed enums |
| 120 | +under edition 2023. Closed enum fields updated with invalid values will generate |
| 121 | +errors. |
| 122 | + |
| 123 | +### Remove Deprecated APIs {#python-remove-apis} |
| 124 | + |
| 125 | +v30 will remove the following public runtime APIs, which have been marked |
| 126 | +deprecated for at least one minor or major release and are obsolete or replaced. |
| 127 | + |
| 128 | +#### Reflection Methods |
| 129 | + |
| 130 | +**APIs:** |
| 131 | +[`reflection.ParseMessage`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/reflection.py#L40), |
| 132 | +[`reflection.MakeClass`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/reflection.py#L66) |
| 133 | + |
| 134 | +**Replacement:** `message_factory.GetMessageClass()` |
| 135 | + |
| 136 | +#### RPC Service Interfaces |
| 137 | + |
| 138 | +**APIs:** |
| 139 | +[`service.RpcException`](https://github.com/protocolbuffers/protobuf/blob/21c545c8c5cec0b052dc7715b778f0353d37d02c/python/google/protobuf/service.py#L23), |
| 140 | +[`service.Service`](https://github.com/protocolbuffers/protobuf/blob/21c545c8c5cec0b052dc7715b778f0353d37d02c/python/google/protobuf/service.py#L28), |
| 141 | +[`service.RpcController`](https://github.com/protocolbuffers/protobuf/blob/21c545c8c5cec0b052dc7715b778f0353d37d02c/python/google/protobuf/service.py#L97), |
| 142 | +and |
| 143 | +[`service.RpcChannel`](https://github.com/protocolbuffers/protobuf/blob/21c545c8c5cec0b052dc7715b778f0353d37d02c/python/google/protobuf/service.py#L180) |
| 144 | + |
| 145 | +**Replacement:** Starting with version 2.3.0, RPC implementations should not try |
| 146 | +to build on these, but should instead provide code generator plugins which |
| 147 | +generate code specific to the particular RPC implementation. |
| 148 | + |
| 149 | +#### MessageFactory and SymbolDatabase Methods |
| 150 | + |
| 151 | +**APIs:** |
| 152 | +[`MessageFactory.GetPrototype`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/message_factory.py#L145), |
| 153 | +[`MessageFactory.CreatePrototype`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/message_factory.py#L165), |
| 154 | +[`MessageFactory.GetMessages`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/message_factory.py#L185), |
| 155 | +[`SymbolDatabase.GetPrototype`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/symbol_database.py#L54), |
| 156 | +[`SymbolDatabase.CreatePrototype`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/symbol_database.py#L60), |
| 157 | +and |
| 158 | +[`SymbolDatabase.GetMessages`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/symbol_database.py#L66) |
| 159 | + |
| 160 | +**Replacement:** `message_factory.GetMessageClass()` and |
| 161 | +`message_factory.GetMessageClassesForFiles()`. |
| 162 | + |
| 163 | +#### GetDebugString |
| 164 | + |
| 165 | +**APIs:** |
| 166 | +[`GetDebugString`](https://github.com/protocolbuffers/protobuf/blob/7f395af40e86e00b892e812beb67a03564884756/python/google/protobuf/pyext/descriptor.cc#L1510) |
| 167 | + |
| 168 | +**Replacement:** |
| 169 | + |
| 170 | +No replacement. It's only in Python C++ which is no longer released. It is not |
| 171 | +supported in pure Python or UPB. |
| 172 | + |
| 173 | +## Changes in Objective-C {#objc} |
| 174 | + |
| 175 | +**This will be the first breaking release for Objective-C**. |
| 176 | + |
| 177 | +Objective-C will bump its major version from 3.x.x to 4.30.x. |
| 178 | + |
| 179 | +### Overhaul Unknown Field Handling APIs Deprecating Most of the Existing APIs {#objc-field-handling} |
| 180 | + |
| 181 | +v30 will deprecate `GPBUnknownFieldSet` and replace it with `GPBUnknownFields`. |
| 182 | +The new type will preserve the ordering of unknown fields from the original |
| 183 | +input or API calls, to ensure any semantic meaning to the ordering is maintained |
| 184 | +when a message is written back out. |
| 185 | + |
| 186 | +As part of this, the `GPBUnknownField` type also has its APIs changed, with |
| 187 | +almost all of the existing APIs becoming deprecated and new ones added. |
| 188 | + |
| 189 | +Deprecated property APIs: |
| 190 | + |
| 191 | +* `varintList` |
| 192 | +* `fixed32List` |
| 193 | +* `fixed64List` |
| 194 | +* `lengthDelimitedList` |
| 195 | +* `groupList` |
| 196 | + |
| 197 | +Deprecated modification APIs: |
| 198 | + |
| 199 | +* `addVarint:` |
| 200 | +* `addFixed32:` |
| 201 | +* `addFixed64:` |
| 202 | +* `addLengthDelimited:` |
| 203 | +* `addGroup:` |
| 204 | + |
| 205 | +Deprecated initializer `initWithNumber:`. |
| 206 | + |
| 207 | +New property APIs: |
| 208 | + |
| 209 | +* `type` |
| 210 | +* `varint` |
| 211 | +* `fixed32` |
| 212 | +* `fixed64` |
| 213 | +* `lengthDelimited` |
| 214 | +* `group` |
| 215 | + |
| 216 | +This type will model a single field number in its value, rather than *grouping* |
| 217 | +all the values for a given field number. The APIs for creating new fields are |
| 218 | +the `add*` APIs on the `GPBUnknownFields` class. |
| 219 | + |
| 220 | +v30 will also deprecate `-[GPBMessage unknownFields]`. In its place, there will |
| 221 | +be new APIs to extract and update the unknown fields of the message. |
| 222 | + |
| 223 | +### Remove Deprecated APIs {#objc-remove-apis} |
| 224 | + |
| 225 | +v30 will remove the following public runtime APIs, which have been marked |
| 226 | +deprecated for at least one minor or major release and are obsolete or replaced. |
| 227 | + |
| 228 | +#### GPBFileDescriptor |
| 229 | + |
| 230 | +**API:** |
| 231 | +[-[`GPBFileDescriptor` syntax]](https://github.com/protocolbuffers/protobuf/blob/44bd65b2d3c0470d91a23cc14df5ffb1ab0af7cd/objectivec/GPBDescriptor.h#L118-L119) |
| 232 | + |
| 233 | +**Replacement:** Obsolete. |
| 234 | + |
| 235 | +#### GPBMessage mergeFrom:extensionRegistry |
| 236 | + |
| 237 | +**API:** |
| 238 | +[-[`GPBMessage mergeFrom:extensionRegistry:`]](https://github.com/protocolbuffers/protobuf/blob/44bd65b2d3c0470d91a23cc14df5ffb1ab0af7cd/objectivec/GPBMessage.h#L258-L261) |
| 239 | + |
| 240 | +**Replacement:** |
| 241 | +[-[`GPBMessage mergeFrom:extensionRegistry:error:`]](https://github.com/protocolbuffers/protobuf/blob/44bd65b2d3c0470d91a23cc14df5ffb1ab0af7cd/objectivec/GPBMessage.h#L275-L277) |
| 242 | + |
| 243 | +#### GPBDuration timeIntervalSince1970 |
| 244 | + |
| 245 | +**API:** |
| 246 | +[-[`GPBDuration timeIntervalSince1970`]](https://github.com/protocolbuffers/protobuf/blob/29fca8a64b62491fb0a2ce61878e70eda88dde98/objectivec/GPBWellKnownTypes.h#L95-L100) |
| 247 | + |
| 248 | +**Replacement:** |
| 249 | +[-[`GPBDuration timeInterval`]](https://github.com/protocolbuffers/protobuf/blob/29fca8a64b62491fb0a2ce61878e70eda88dde98/objectivec/GPBWellKnownTypes.h#L74-L89) |
| 250 | + |
| 251 | +#### GPBTextFormatForUnknownFieldSet |
| 252 | + |
| 253 | +**API:** |
| 254 | +[`GPBTextFormatForUnknownFieldSet()`](https://github.com/protocolbuffers/protobuf/blob/29fca8a64b62491fb0a2ce61878e70eda88dde98/objectivec/GPBUtilities.h#L32-L43) |
| 255 | + |
| 256 | +**Replacement:** Obsolete - Use |
| 257 | +[`GPBTextFormatForMessage()`](https://github.com/protocolbuffers/protobuf/blob/29fca8a64b62491fb0a2ce61878e70eda88dde98/objectivec/GPBUtilities.h#L20-L30), |
| 258 | +which includes any unknown fields. |
| 259 | + |
| 260 | +#### GPBUnknownFieldSet |
| 261 | + |
| 262 | +**API:** |
| 263 | +[`GPBUnknownFieldSet`](https://github.com/protocolbuffers/protobuf/blob/224573d66a0cc958c76cb43d8b2eb3aa7cdb89f2/objectivec/GPBUnknownFieldSet.h) |
| 264 | + |
| 265 | +**Replacement:** |
| 266 | +[`GPBUnknownFields`](https://github.com/protocolbuffers/protobuf/blob/224573d66a0cc958c76cb43d8b2eb3aa7cdb89f2/objectivec/GPBUnknownFields.h) |
| 267 | + |
| 268 | +#### GPBMessage unknownFields |
| 269 | + |
| 270 | +**API:** |
| 271 | +[`GPBMessage unknownFields` property](https://github.com/protocolbuffers/protobuf/blob/224573d66a0cc958c76cb43d8b2eb3aa7cdb89f2/objectivec/GPBMessage.h#L73-L76) |
| 272 | + |
| 273 | +**Replacement:** |
| 274 | +[-[`GPBUnknownFields initFromMessage:`]](https://github.com/protocolbuffers/protobuf/blob/224573d66a0cc958c76cb43d8b2eb3aa7cdb89f2/objectivec/GPBUnknownFields.h#L30-L38), |
| 275 | +[-[`GPBMessage mergeUnknownFields:extensionRegistry:error:`]](https://github.com/protocolbuffers/protobuf/blob/f26bdff7cc0bb7e8ed88253ba16f81614a26cf16/objectivec/GPBMessage.h#L506-L528), |
| 276 | +and |
| 277 | +[-[`GPBMessage clearUnknownFields`]](https://github.com/protocolbuffers/protobuf/blob/224573d66a0cc958c76cb43d8b2eb3aa7cdb89f2/objectivec/GPBMessage.h#L497-L504C9) |
| 278 | + |
| 279 | +### Remove Deprecated Runtime APIs for Old Gencode {#objc-remove-apis-gencode} |
| 280 | + |
| 281 | +This release will remove deprecated runtime methods that support the Objective-C |
| 282 | +gencode from before the 3.22.x release. The library will also issue a log |
| 283 | +message at runtime when old generated code is starting up. |
| 284 | + |
| 285 | +**API:** [`+[GPBFileDescriptor |
| 286 | +allocDescriptorForClass:file:fields:fieldCount:storageSize:flags:]`](https://github.com/protocolbuffers/protobuf/blob/1b44ce0feef45a78ba99d09bd2e5ff5052a6541b/objectivec/GPBDescriptor_PackagePrivate.h#L213-L220) |
| 287 | + |
| 288 | +**Replacement:** Regenerate with a current version of the library. |
| 289 | + |
| 290 | +**API:** [`+[GPBFileDescriptor |
| 291 | +allocDescriptorForClass:rootClass:file:fields:fieldCount:storageSize:flags:]`](https://github.com/protocolbuffers/protobuf/blob/1b44ce0feef45a78ba99d09bd2e5ff5052a6541b/objectivec/GPBDescriptor_PackagePrivate.h#L221-L229) |
| 292 | + |
| 293 | +**Replacement:** Regenerate with a current version of the library. |
| 294 | + |
| 295 | +**API:** [`+[GPBEnumDescriptor |
| 296 | +allocDescriptorForName:valueNames:values:count:enumVerifier:]`](https://github.com/protocolbuffers/protobuf/blob/1b44ce0feef45a78ba99d09bd2e5ff5052a6541b/objectivec/GPBDescriptor_PackagePrivate.h#L285-L291) |
| 297 | + |
| 298 | +**Replacement:** Regenerate with a current version of the library. |
| 299 | + |
| 300 | +**API:** [`+[GPBEnumDescriptor |
| 301 | +allocDescriptorForName:valueNames:values:count:enumVerifier:extraTextFormatInfo:]`](https://github.com/protocolbuffers/protobuf/blob/1b44ce0feef45a78ba99d09bd2e5ff5052a6541b/objectivec/GPBDescriptor_PackagePrivate.h#L292-L299) |
| 302 | + |
| 303 | +**Replacement:** Regenerate with a current version of the library. |
| 304 | + |
| 305 | +**API:** |
| 306 | +[`-[GPBExtensionDescriptor initWithExtensionDescription:]`](https://github.com/protocolbuffers/protobuf/blob/1b44ce0feef45a78ba99d09bd2e5ff5052a6541b/objectivec/GPBDescriptor_PackagePrivate.h#L317-L320) |
| 307 | + |
| 308 | +**Replacement:** Regenerate with a current version of the library. |
| 309 | + |
| 310 | +## Other Changes {#non-breaking} |
| 311 | + |
| 312 | +In addition to those breaking changes are some other changes worth noting. While |
| 313 | +the following are not considered breaking changes, they may still impact users. |
| 314 | + |
| 315 | +### Poison Pill Warnings {#poison} |
| 316 | + |
| 317 | +v30 will update poison pills to emit warnings for old gencode + new runtime |
| 318 | +combinations that work under the new rolling upgrade policy, but will break in |
| 319 | +the *next* major bump. For example, Java 4.x.x gencode should work against 5.x.x |
| 320 | +runtime but warn of upcoming breakage against 6.x.x runtime. |
| 321 | + |
| 322 | +### Changes to UTF-8 Enforcement in C# and Ruby {#utf-8-enforcement} |
| 323 | + |
| 324 | +v30 will includes a fix to make UTF-8 enforcement consistent across languages. |
| 325 | +Users with bad non-UTF8 data in string fields may see surfaced UTF-8 enforcement |
| 326 | +errors earlier. |
0 commit comments