| // Protocol Buffers - Google's data interchange format | |
| // Copyright 2026 Google LLC | |
| // | |
| // 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 | |
| syntax = "proto2"; | |
| package upb.test.convert; | |
| option java_multiple_files = true; | |
| option java_outer_classname = "ConvertTest"; | |
| message MessageWithExtension { | |
| extensions 1000 to max; | |
| } | |
| extend MessageWithExtension { | |
| optional int32 ext_field_int32 = 1000; | |
| repeated MessageWithInt32 ext_field_repeated_msg = 1001; | |
| repeated int32 ext_repeated_int32 = 1003; | |
| optional string ext_string = 1004; | |
| repeated string ext_repeated_string = 1005; | |
| } | |
| message MessageWithMapMessage { | |
| map<int32, MessageWithInt32> map_msg = 1; | |
| } | |
| message MessageWithMapMessageClone { | |
| map<int32, MessageWithInt32Clone> map_msg = 1; | |
| } | |
| message MessageWithKnown { | |
| optional int32 known_field_int32 = 1000; | |
| } | |
| message MessageWithKnownRepeatedInt32 { | |
| repeated int32 known_repeated_int32 = 1003; | |
| } | |
| message MessageWithKnownString { | |
| optional string known_string = 1004; | |
| } | |
| message MessageWithKnownRepeatedString { | |
| repeated string known_repeated_string = 1005; | |
| } | |
| message MessageWithKnownInt64 { | |
| optional int64 known_field_int64 = 1000; | |
| } | |
| message MessageWithKnownRepeatedMsg { | |
| repeated MessageWithInt32 known_repeated_msg = 1001; | |
| } | |
| message MessageWithInt32 { | |
| optional int32 f1 = 1; | |
| } | |
| message MessageWithInt32Clone { | |
| optional int32 f1 = 1; | |
| } | |
| extend MessageWithExtension { | |
| optional MessageWithInt32 ext_field_msg = 1002; | |
| } | |
| message MessageWithKnownMsg { | |
| optional MessageWithInt32 known_msg = 1002; | |
| } | |
| message MessageWithKnownMsgClone { | |
| optional MessageWithInt32Clone known_msg = 1002; | |
| } | |
| message MessageWithRepeatedMsg { | |
| repeated MessageWithInt32 msgs = 1; | |
| } | |
| message MessageWithRepeatedMsgClone { | |
| repeated MessageWithInt32Clone msgs = 1; | |
| } | |
| message MessageWithMsg { | |
| optional MessageWithInt32 msg = 1; | |
| } | |
| message MessageWithMsgClone { | |
| optional MessageWithInt32Clone msg = 1; | |
| } | |
| message MessageWithKnownRepeatedMsgClone { | |
| repeated MessageWithInt32Clone known_repeated_msg = 1001; | |
| } | |
| message MessageWithInt64 { | |
| optional int64 f1 = 1; | |
| } | |
| message MessageWithString { | |
| optional string f1 = 1; | |
| } | |
| message MessageWithRepeatedInt32 { | |
| repeated int32 r = 1; | |
| } | |
| message MessageWithRepeatedInt64 { | |
| repeated int64 r = 1; | |
| } | |
| message MessageWithRepeatedString { | |
| repeated string r = 1; | |
| } | |
| message MessageWithMapInt32Int32 { | |
| map<int32, int32> m = 1; | |
| } | |
| message MessageWithMapInt32Int32Clone { | |
| map<int32, int32> m = 1; | |
| } | |
| message MessageWithMapInt32Int64 { | |
| map<int32, int64> m = 1; | |
| } | |
| message AnotherMessageWithExtension { | |
| extensions 1000 to max; | |
| } | |
| extend AnotherMessageWithExtension { | |
| optional int32 another_ext_field_int32 = 1000; | |
| optional MessageWithInt32Clone another_ext_field_msg = 1002; | |
| } | |
| message SrcWithOneof { | |
| oneof my_oneof { | |
| int32 oneof_int32 = 1; | |
| string oneof_string = 2; | |
| } | |
| } | |
| message Proto2EnumMessage { | |
| enum NestedEnum { | |
| FOO = 0; | |
| BAR = 1; | |
| BAZ = 2; | |
| NEG = -1; | |
| } | |
| optional NestedEnum optional_nested_enum = 21; | |
| repeated NestedEnum repeated_nested_enum = 51; | |
| map<string, NestedEnum> map_string_nested_enum = 73; | |
| } | |
| extend MessageWithExtension { | |
| optional Proto2EnumMessage.NestedEnum ext_enum = 2000; | |
| repeated Proto2EnumMessage.NestedEnum ext_repeated_enum = 2001; | |
| } | |
| message MessageWithKnownEnum { | |
| optional Proto2EnumMessage.NestedEnum ext_enum = 2000; | |
| repeated Proto2EnumMessage.NestedEnum ext_repeated_enum = 2001; | |
| } | |
| message MessageWithMapAt1000 { | |
| map<int32, int32> m = 1000; | |
| } | |
| message SrcWithoutOneof { | |
| optional int32 oneof_int32 = 1; | |
| optional string oneof_string = 2; | |
| } | |
| // A MessageSet that declares no extensions, so that converting a | |
| // upb_test.TestMessageSet to it (without an extension registry) keeps the | |
| // source's extensions as non-canonical extensions. | |
| message MessageSetClone { | |
| option message_set_wire_format = true; | |
| extensions 4 to max | |
| [verification = UNVERIFIED]; | |
| } |