diff --git a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs b/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs deleted file mode 100644 index 208ce1fcb6..0000000000 --- a/csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs +++ /dev/null @@ -1,17 +0,0 @@ -#region Copyright notice and license -// 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 -#endregion - -namespace Google.Protobuf.Reflection; - -internal sealed partial class FeatureSetDescriptor -{ - // Canonical serialized form of the edition defaults, generated by embed_edition_defaults. - private const string DefaultsBase64 = - "ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH"; -} diff --git a/hpb_generator/tests/child_model.proto b/hpb_generator/tests/child_model.proto index 976a729725..ba410d25f5 100644 --- a/hpb_generator/tests/child_model.proto +++ b/hpb_generator/tests/child_model.proto @@ -5,22 +5,25 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; import public "google/protobuf/compiler/hpb/tests/test_enum.proto"; message ChildModel1 { - optional bool child_b1 = 44; - optional string child_str1 = 56; + bool child_b1 = 44; + string child_str1 = 56; } message ChildModel3 { - string sub_key = 1; - bool bool1 = 2; - int32 i32 = 3; - optional string opt_str = 4; - optional bool opt_bool = 5; - optional int32 opt_i32 = 6; + string sub_key = 1 [features.field_presence = IMPLICIT]; + + bool bool1 = 2 [features.field_presence = IMPLICIT]; + + int32 i32 = 3 [features.field_presence = IMPLICIT]; + + string opt_str = 4; + bool opt_bool = 5; + int32 opt_i32 = 6; } diff --git a/hpb_generator/tests/legacy-name.proto b/hpb_generator/tests/legacy-name.proto index dbe1b8f751..d16d0adb3b 100644 --- a/hpb_generator/tests/legacy-name.proto +++ b/hpb_generator/tests/legacy-name.proto @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; diff --git a/hpb_generator/tests/naming_conflict.proto b/hpb_generator/tests/naming_conflict.proto index 917d4e0d29..2b456937c1 100644 --- a/hpb_generator/tests/naming_conflict.proto +++ b/hpb_generator/tests/naming_conflict.proto @@ -5,11 +5,11 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; message HasChildCount { - optional HasChildCount has_child_count = 1; - optional int32 child_count = 2; + HasChildCount has_child_count = 1; + int32 child_count = 2; } diff --git a/hpb_generator/tests/no_package.proto b/hpb_generator/tests/no_package.proto index ebd9c2fda6..799ff3841d 100644 --- a/hpb_generator/tests/no_package.proto +++ b/hpb_generator/tests/no_package.proto @@ -5,8 +5,9 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; +option features.enum_type = CLOSED; // option java_multiple_files = true; enum EnumWithNoPackage { diff --git a/hpb_generator/tests/no_package_enum_user.proto b/hpb_generator/tests/no_package_enum_user.proto index 703fa2ab44..21cda76bfa 100644 --- a/hpb_generator/tests/no_package_enum_user.proto +++ b/hpb_generator/tests/no_package_enum_user.proto @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest; @@ -14,5 +14,5 @@ import "google/protobuf/compiler/hpb/tests/no_package.proto"; // option java_multiple_files = true; message MyMessage { - optional MessageWithEnumUpbTest my_type = 1; + MessageWithEnumUpbTest my_type = 1; } diff --git a/hpb_generator/tests/set_alias.proto b/hpb_generator/tests/set_alias.proto index b279c0c6b4..a8566e7bc1 100644 --- a/hpb_generator/tests/set_alias.proto +++ b/hpb_generator/tests/set_alias.proto @@ -5,18 +5,18 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest; message Child { - optional int32 peeps = 1; + int32 peeps = 1; } message Parent { - optional int32 x = 2; - optional Child child = 3; - optional int64 out_of_order = 1; // set_alias must work regardless of order + int32 x = 2; + Child child = 3; + int64 out_of_order = 1; // set_alias must work regardless of order } message ParentWithRepeated { diff --git a/hpb_generator/tests/test_enum.proto b/hpb_generator/tests/test_enum.proto index 7f76cce495..03afd87f27 100644 --- a/hpb_generator/tests/test_enum.proto +++ b/hpb_generator/tests/test_enum.proto @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto3"; +edition = "2023"; package hpb_unittest; diff --git a/hpb_generator/tests/test_extension.proto b/hpb_generator/tests/test_extension.proto index e8ff9d5329..c2578efdec 100644 --- a/hpb_generator/tests/test_extension.proto +++ b/hpb_generator/tests/test_extension.proto @@ -5,7 +5,7 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest.someotherpackage; @@ -15,10 +15,11 @@ import "google/protobuf/compiler/hpb/tests/test_model.proto"; // defined in different file. extend TestModel { - optional ThemeExtension styling = 13001; + ThemeExtension styling = 13001; } extend TestModel { - optional int32 int32_ext = 13002 [default = 644]; - optional int64 int64_ext = 13003 [default = 2147483648]; + int32 int32_ext = 13002 [default = 644]; + + int64 int64_ext = 13003 [default = 2147483648]; } diff --git a/hpb_generator/tests/test_model.proto b/hpb_generator/tests/test_model.proto index 8a5401b6b7..5bb50be1a2 100644 --- a/hpb_generator/tests/test_model.proto +++ b/hpb_generator/tests/test_model.proto @@ -5,74 +5,89 @@ // license that can be found in the LICENSE file or at // https://developers.google.com/open-source/licenses/bsd -syntax = "proto2"; +edition = "2023"; package hpb_unittest; import "google/protobuf/compiler/hpb/tests/child_model.proto"; +import "google/protobuf/cpp_features.proto"; + +option features.enum_type = CLOSED; +option features.repeated_field_encoding = EXPANDED; +option features.utf8_validation = NONE; message TestModelContainer { repeated TestModel models = 1; - optional ChildModel3 proto_3_child = 2; + ChildModel3 proto_3_child = 2; + extensions 10000 to max [verification = UNVERIFIED]; } message TestModel { - optional int32 value = 1; + int32 value = 1; repeated int32 value_array = 2; // _UPB_MODE_ARRAY repeated int32 value_packed_array = 3 - [packed = true]; // _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED + [features.repeated_field_encoding = + PACKED]; // _UPB_MODE_ARRAY | _UPB_MODE_IS_PACKED + repeated int32 value_deprec = 4 [deprecated = true]; - optional string str1 = 115; - optional bool b1 = 9; - optional bool b2 = 10; - optional string str2 = 50; - optional string str3 = 11; - optional float optional_float = 14; - optional double optional_double = 15; - optional int64 optional_int64 = 16; - optional uint32 optional_uint32 = 17; - optional uint64 optional_uint64 = 18; - optional sint32 optional_sint32 = 19; - optional sint64 optional_sint64 = 20; - optional fixed32 optional_fixed32 = 21; - optional fixed64 optional_fixed64 = 22; - optional sfixed32 optional_sfixed32 = 23; - optional sfixed64 optional_sfixed64 = 24; + + string str1 = 115; + bool b1 = 9; + bool b2 = 10; + string str2 = 50; + string str3 = 11; + float optional_float = 14; + double optional_double = 15; + int64 optional_int64 = 16; + uint32 optional_uint32 = 17; + uint64 optional_uint64 = 18; + sint32 optional_sint32 = 19; + sint64 optional_sint64 = 20; + fixed32 optional_fixed32 = 21; + fixed64 optional_fixed64 = 22; + sfixed32 optional_sfixed32 = 23; + sfixed64 optional_sfixed64 = 24; repeated int64 repeated_int64 = 25; repeated uint64 repeated_uint64 = 26; repeated fixed64 repeated_fixed64 = 27; repeated sfixed64 repeated_sfixed64 = 28; repeated bool repeated_bool = 29; repeated string repeated_string = 35; - optional bytes optional_bytes = 36; + bytes optional_bytes = 36; + message NestedChild { - optional string nested_child_name = 211; + string nested_child_name = 211; } - optional NestedChild nested_child_1 = 212; - optional ChildModel1 child_model_1 = 222; + + NestedChild nested_child_1 = 212; + ChildModel1 child_model_1 = 222; repeated ChildModel1 child_models = 223; - optional ChildModel1 bar = 224; + ChildModel1 bar = 224; + oneof child_oneof1 { string oneof_member1 = 98; bool oneof_member2 = 99; } - optional int32 int_value_with_default = 31 - [default = 65]; // Not supported yet - optional string string_value_with_default = 32 + + int32 int_value_with_default = 31 [default = 65]; // Not supported yet + + string string_value_with_default = 32 [default = "hello"]; // Not supported yet - optional float float_value_with_default = 33 [default = inf]; - optional float double_value_with_default = 34 [default = -inf]; + + float float_value_with_default = 33 [default = inf]; + + float double_value_with_default = 34 [default = -inf]; map child_map = 225; - optional TestModel recursive_child = 226; + TestModel recursive_child = 226; map child_str_map = 227; map str_to_int_map = 228; map str_to_str_map = 229; extend TestAnnotation { - optional OtherExtension in_message_ext = 15000; + OtherExtension in_message_ext = 15000; } enum Category { @@ -81,7 +96,8 @@ message TestModel { VIDEO = 7; RADIO = 8 [deprecated = true]; } - optional Category category = 37; + + Category category = 37; // keyword collisions (double, template, ...) oneof type { @@ -89,18 +105,18 @@ message TestModel { int64 int64 = 231; double double = 232; } - optional string template = 233; - optional string msg = 234; - optional string arena = 235; - // Tests publicly imported enum. - optional TestEnum imported_enum = 238; + string template = 233; + string msg = 234; + string arena = 235; - optional string phase = 239; - optional bool clear_phase = 240; + // Tests publicly imported enum. + TestEnum imported_enum = 238; - optional string doc_id = 241; - optional bool set_doc_id = 242; + string phase = 239; + bool clear_phase = 240; + string doc_id = 241; + bool set_doc_id = 242; extensions 10000 to max [verification = UNVERIFIED]; @@ -112,13 +128,15 @@ message TestModelContainerV1 { } message TestModelV1 { - optional int32 value = 1; + int32 value = 1; repeated int32 value2 = 2; - repeated int32 value3 = 3 [packed = true]; + repeated int32 value3 = 3 [features.repeated_field_encoding = PACKED]; + repeated int32 value4 = 4 [deprecated = true]; - optional bool b1 = 9; - optional bool b2 = 10; - optional string str2 = 50; + + bool b1 = 9; + bool b2 = 10; + string str2 = 50; } enum PrimaryColors { @@ -130,33 +148,35 @@ enum PrimaryColors { // TestModel extension. message ThemeExtension { extend TestModel { - optional ThemeExtension theme_extension = 12003; + ThemeExtension theme_extension = 12003; } - optional string ext_name = 1; - optional bool ext_bool = 2; + + string ext_name = 1; + bool ext_bool = 2; } extend TestModel { - optional ThemeExtension theme = 12001; + ThemeExtension theme = 12001; } message ContainerExtension { extend TestModelContainer { - optional ContainerExtension container_extension = 12004; + ContainerExtension container_extension = 12004; } - optional string ext_container_name = 1; + + string ext_container_name = 1; } extend TestModelContainer { - optional ContainerExtension container_ext = 12005; + ContainerExtension container_ext = 12005; } message OtherExtension { - optional string ext2_name = 1; + string ext2_name = 1; } extend TestModel { - optional OtherExtension other_ext = 12002; + OtherExtension other_ext = 12002; } message TestAnnotation { @@ -165,7 +185,7 @@ message TestAnnotation { } message TestMessageHasEnum { - optional EnumDeclaredAfterMessage enum_declared_after_message = 1; + EnumDeclaredAfterMessage enum_declared_after_message = 1; } enum EnumDeclaredAfterMessage {