Skip to content

Commit fcd68c5

Browse files
Make default_symbol_visibility STRICT in edition 2026
PiperOrigin-RevId: 938151844
1 parent c5fa4d6 commit fcd68c5

12 files changed

Lines changed: 90 additions & 85 deletions

conformance/test_protos/test_messages_edition_unstable.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ option features.message_encoding = DELIMITED;
1313
option java_package = "com.google.protobuf_test_messages.edition_unstable";
1414
option objc_class_prefix = "EditionUnstable";
1515

16-
message ComplexMessage {
16+
export message ComplexMessage {
1717
int32 d = 1;
1818
}
1919

20-
message TestAllTypesEditionUnstable {
20+
export message TestAllTypesEditionUnstable {
2121
// Singular
2222
int32 optional_int32 = 1;
2323

@@ -51,11 +51,11 @@ message TestAllTypesEditionUnstable {
5151
extensions 120 to 200;
5252
}
5353

54-
message ForeignMessageEditionUnstable {
54+
export message ForeignMessageEditionUnstable {
5555
int32 c = 1;
5656
}
5757

58-
enum ForeignEnumEditionUnstable {
58+
export enum ForeignEnumEditionUnstable {
5959
FOREIGN_FOO = 0;
6060
FOREIGN_BAR = 1;
6161
FOREIGN_BAZ = 2;

editions/defaults_test.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ TEST(DefaultsTest, Check2026) {
123123
EXPECT_EQ(
124124
defaults->defaults()[4].overridable_features().enforce_proto_limits(),
125125
FeatureSet::ProtoLimitsFeature::PROTO_LIMITS2026);
126+
EXPECT_EQ(defaults->defaults()[4]
127+
.overridable_features()
128+
.default_symbol_visibility(),
129+
FeatureSet::VisibilityFeature::STRICT);
126130
}
127131

128132
TEST(DefaultsTest, CheckFuture) {
@@ -429,7 +433,7 @@ TEST_F(OverridableDefaultsTest, Edition2026) {
429433
message_encoding: LENGTH_PREFIXED
430434
json_format: ALLOW
431435
enforce_naming_style: STYLE2026
432-
default_symbol_visibility: EXPORT_TOP_LEVEL
436+
default_symbol_visibility: STRICT
433437
enforce_proto_limits: PROTO_LIMITS2026
434438
[pb.cpp] {
435439
legacy_closed_enum: false

src/google/protobuf/compiler/code_generator_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ TEST_F(CodeGeneratorTest, BuildFeatureSetDefaults) {
521521
message_encoding: LENGTH_PREFIXED
522522
json_format: ALLOW
523523
enforce_naming_style: STYLE2026
524-
default_symbol_visibility: EXPORT_TOP_LEVEL
524+
default_symbol_visibility: STRICT
525525
enforce_proto_limits: PROTO_LIMITS2026
526526
}
527527
fixed_features {}

src/google/protobuf/compiler/command_line_interface_unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMaximum) {
27062706
message_encoding: LENGTH_PREFIXED
27072707
json_format: ALLOW
27082708
enforce_naming_style: STYLE2026
2709-
default_symbol_visibility: EXPORT_TOP_LEVEL
2709+
default_symbol_visibility: STRICT
27102710
enforce_proto_limits: PROTO_LIMITS2026
27112711
}
27122712
fixed_features {}
@@ -2824,7 +2824,7 @@ TEST_F(CommandLineInterfaceTest, EditionDefaultsWithMinimum) {
28242824
message_encoding: LENGTH_PREFIXED
28252825
json_format: ALLOW
28262826
enforce_naming_style: STYLE2026
2827-
default_symbol_visibility: EXPORT_TOP_LEVEL
2827+
default_symbol_visibility: STRICT
28282828
enforce_proto_limits: PROTO_LIMITS2026
28292829
}
28302830
fixed_features {}

src/google/protobuf/compiler/csharp/c_sharp_features.pb.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/protobuf/compiler/java/java_features.pb.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/protobuf/cpp_edition_defaults.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// the C++ runtime. This is used for feature resolution under Editions.
66
// NOLINTBEGIN
77
// clang-format off
8-
#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n\'\030\204\007\"\003\302>\000*\035\010\001\020\002\030\002 \003(\0010\0028\002@\001H\001\302>\010\010\001\020\003\030\000 \001\n\'\030\347\007\"\003\302>\000*\035\010\002\020\001\030\001 \002(\0010\0018\002@\001H\001\302>\010\010\000\020\003\030\000 \001\n\'\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\r8\002@\001H\001\302>\004\030\000 \001\n\'\030\351\007\"\031\010\001\020\001\030\001 \002(\0010\0018\001@\002\302>\006\010\000\020\001\030\001*\007H\001\302>\002 \001\n\'\030\217N\"\035\010\001\020\001\030\001 \002(\0010\0018\003@\002H\002\302>\010\010\000\020\001\030\001 \001*\003\302>\000 \346\007(\351\007"
8+
#define PROTOBUF_INTERNAL_CPP_EDITION_DEFAULTS "\n\'\030\204\007\"\003\302>\000*\035\010\001\020\002\030\002 \003(\0010\0028\002@\001H\001\302>\010\010\001\020\003\030\000 \001\n\'\030\347\007\"\003\302>\000*\035\010\002\020\001\030\001 \002(\0010\0018\002@\001H\001\302>\010\010\000\020\003\030\000 \001\n\'\030\350\007\"\023\010\001\020\001\030\001 \002(\0010\001\302>\004\010\000\020\003*\r8\002@\001H\001\302>\004\030\000 \001\n\'\030\351\007\"\031\010\001\020\001\030\001 \002(\0010\0018\001@\002\302>\006\010\000\020\001\030\001*\007H\001\302>\002 \001\n\'\030\217N\"\035\010\001\020\001\030\001 \002(\0010\0018\003@\004H\002\302>\010\010\000\020\001\030\001 \001*\003\302>\000 \346\007(\351\007"
99
// clang-format on
1010
// NOLINTEND
1111

src/google/protobuf/cpp_features.pb.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/protobuf/descriptor.pb.cc

Lines changed: 69 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/protobuf/descriptor.proto

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,8 @@ message FeatureSet {
12101210
edition_introduced: EDITION_2024,
12111211
},
12121212
edition_defaults = { edition: EDITION_LEGACY, value: "EXPORT_ALL" },
1213-
edition_defaults = { edition: EDITION_2024, value: "EXPORT_TOP_LEVEL" }
1213+
edition_defaults = { edition: EDITION_2024, value: "EXPORT_TOP_LEVEL" },
1214+
edition_defaults = { edition: EDITION_2026, value: "STRICT" }
12141215
];
12151216

12161217
message ProtoLimitsFeature {

0 commit comments

Comments
 (0)