Breaking Change: Use Editions features in Java full runtimes. This change breaks compatibility with old generated code from previous major versions per the Cross Version Runtime policy: https://protobuf.dev/support/cross-version-runtime-guarantee. This includes old gencode from <4.26.x, which does not resolve features. See https://protobuf.dev/news/2023-12-05/ PiperOrigin-RevId: 600487923
diff --git a/python/build_targets.bzl b/python/build_targets.bzl index 5f4ae75..a1f1767 100644 --- a/python/build_targets.bzl +++ b/python/build_targets.bzl
@@ -221,6 +221,7 @@ testonly = 1, srcs = [ "//:test_proto_srcs", + "//:test_proto_editions_srcs", "//src/google/protobuf/util:test_proto_srcs", ], strip_prefix = "src",
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py index c561a04..56677d3 100755 --- a/python/google/protobuf/internal/descriptor_test.py +++ b/python/google/protobuf/internal/descriptor_test.py
@@ -18,11 +18,11 @@ from google.protobuf import symbol_database from google.protobuf import text_format from google.protobuf.internal import api_implementation -from google.protobuf.internal import legacy_features_pb2 from google.protobuf.internal import test_util from google.protobuf.internal import testing_refleaks from google.protobuf.internal import _parameterized +from google.protobuf import unittest_legacy_features_pb2 from google.protobuf import unittest_custom_options_pb2 from google.protobuf import unittest_features_pb2 from google.protobuf import unittest_import_pb2 @@ -1268,20 +1268,20 @@ ) def testFeaturesStripped(self): - desc = legacy_features_pb2.TestEditionsMessage.DESCRIPTOR.fields_by_name[ + desc = unittest_legacy_features_pb2.TestEditionsMessage.DESCRIPTOR.fields_by_name[ 'required_field' ] self.assertFalse(desc.GetOptions().HasField('features')) def testLegacyRequiredTransform(self): - desc = legacy_features_pb2.TestEditionsMessage.DESCRIPTOR + desc = unittest_legacy_features_pb2.TestEditionsMessage.DESCRIPTOR self.assertEqual( desc.fields_by_name['required_field'].label, descriptor.FieldDescriptor.LABEL_REQUIRED, ) def testLegacyGroupTransform(self): - desc = legacy_features_pb2.TestEditionsMessage.DESCRIPTOR + desc = unittest_legacy_features_pb2.TestEditionsMessage.DESCRIPTOR self.assertEqual( desc.fields_by_name['delimited_field'].type, descriptor.FieldDescriptor.TYPE_GROUP,
diff --git a/python/google/protobuf/internal/legacy_features.proto b/python/google/protobuf/internal/legacy_features.proto deleted file mode 100644 index ef803dd..0000000 --- a/python/google/protobuf/internal/legacy_features.proto +++ /dev/null
@@ -1,18 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file or at -// https://developers.google.com/open-source/licenses/bsd - -// Test that features with legacy descriptor helpers get properly converted. - -edition = "2023"; - -package google.protobuf.internal; - -message TestEditionsMessage { - int32 required_field = 1 [features.field_presence = LEGACY_REQUIRED]; - TestEditionsMessage delimited_field = 2 - [features.message_encoding = DELIMITED]; -}