This change migrates proto2 and proto3 to real editions, without impacting users at all. While we already had feature defaults set, we weren't really using them outside of editions. This change introduces InferLegacyProtoFeatures, which infers features from descriptors. Any language that wants to follow this rollout pattern will need to implement similar transformations.
PiperOrigin-RevId: 572593956
This is needed to unblock Java editions codegen tests, due to codegen diff for proto3 optionals migrated to editions.
This is incompatible with runtimes <24.x, but our cross-version support policy explicitly does not guarantee compatibility for new gencode with old runtimes: https://protobuf.dev/support/cross-version-runtime-guarantee/#minor
PiperOrigin-RevId: 572578693
Before this CL, bad offsets result in a NumberFormatException (from parseLong) instead of the documented ParseException/IllegalArgumentException.
PiperOrigin-RevId: 572266056
The goal is to reduce the surface area and size of port_def.inc, as a somewhat
magic textual header.
(Also #defining __reserved_names is a bit of a maintenance risk)
PiperOrigin-RevId: 572188636
Prior to RepeatedPtrField having an SOO, we did this for all sizes. This
poisoning step can aid debugging for use-after-frees.
PiperOrigin-RevId: 572115487
UTF-8 acceptable codepoints are 0x0000-0x10FFFF, previously we treated this as an inclusive-exclusive bound, but UTF-8 does include it's topmost character.
PiperOrigin-RevId: 572111435
Instead, we will hardcode the feature validation using macros and add a reflective test to make sure it stays in sync. Reflection during descriptor builds is problematic, and in order to migrate proto2/proto3 to editions fully, we'll need to do feature resolution in *all* builds.
PiperOrigin-RevId: 572054031
Previously, some but not all of these classes stored `Context* context_`.
These will be used in a followup change to consider strip_nonfunctional_codegen in field comments.
PiperOrigin-RevId: 571419303
Also, add reference overloads of DynamicCastToGenerated which terminate on failure like dynamic_cast would do on an environment without exceptions.
PiperOrigin-RevId: 571241355
This removes a large chunk of the reflection we need to do during descriptor builds, and will make it possible to migrate descriptor.proto to editions. It also removes some special treatment of the C++ runtime, which happens to have easy access to protoc internals today.
PiperOrigin-RevId: 571177924
This is meant to optimize our editions handling before rolling it out more widely to proto2 and proto3 under the hood. As it's implemented today, every file descriptor would need to allocate its own duplicate FeatureSet for either proto2 or proto3 (plus additional ones per proto2 group).
PiperOrigin-RevId: 571166907
Python 3.12 has removed the `distutils` module, so we need to stop relying on
it. Most of the parts we were using had a straightforward replacement in
`setuptools` or elsewhere in the Python standard library. I couldn't find a
good replacement for `distutils.command.clean`, though. We were only using it
to enable `python setup.py clean`, so I just removed that functionality since
directly invoking setup.py is deprecated anyway.
While I was looking at this I realized that our python/release.sh script is
unused, so I also removed that.
PiperOrigin-RevId: 571035275