| OLD | NEW |
| (Empty) |
| 1 // Protocol Buffers - Google's data interchange format | |
| 2 // Copyright 2008 Google Inc. All rights reserved. | |
| 3 // http://code.google.com/p/protobuf/ | |
| 4 // | |
| 5 // Redistribution and use in source and binary forms, with or without | |
| 6 // modification, are permitted provided that the following conditions are | |
| 7 // met: | |
| 8 // | |
| 9 // * Redistributions of source code must retain the above copyright | |
| 10 // notice, this list of conditions and the following disclaimer. | |
| 11 // * Redistributions in binary form must reproduce the above | |
| 12 // copyright notice, this list of conditions and the following disclaimer | |
| 13 // in the documentation and/or other materials provided with the | |
| 14 // distribution. | |
| 15 // * Neither the name of Google Inc. nor the names of its | |
| 16 // contributors may be used to endorse or promote products derived from | |
| 17 // this software without specific prior written permission. | |
| 18 // | |
| 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | |
| 31 // Author: kenton@google.com (Kenton Varda) | |
| 32 // | |
| 33 // This is like unittest.proto but with optimize_for = LITE_RUNTIME. | |
| 34 | |
| 35 package protobuf_unittest; | |
| 36 | |
| 37 import "google/protobuf/unittest_import_lite.proto"; | |
| 38 | |
| 39 option optimize_for = LITE_RUNTIME; | |
| 40 | |
| 41 option java_package = "com.google.protobuf"; | |
| 42 | |
| 43 // Same as TestAllTypes but with the lite runtime. | |
| 44 message TestAllTypesLite { | |
| 45 message NestedMessage { | |
| 46 optional int32 bb = 1; | |
| 47 } | |
| 48 | |
| 49 enum NestedEnum { | |
| 50 FOO = 1; | |
| 51 BAR = 2; | |
| 52 BAZ = 3; | |
| 53 } | |
| 54 | |
| 55 // Singular | |
| 56 optional int32 optional_int32 = 1; | |
| 57 optional int64 optional_int64 = 2; | |
| 58 optional uint32 optional_uint32 = 3; | |
| 59 optional uint64 optional_uint64 = 4; | |
| 60 optional sint32 optional_sint32 = 5; | |
| 61 optional sint64 optional_sint64 = 6; | |
| 62 optional fixed32 optional_fixed32 = 7; | |
| 63 optional fixed64 optional_fixed64 = 8; | |
| 64 optional sfixed32 optional_sfixed32 = 9; | |
| 65 optional sfixed64 optional_sfixed64 = 10; | |
| 66 optional float optional_float = 11; | |
| 67 optional double optional_double = 12; | |
| 68 optional bool optional_bool = 13; | |
| 69 optional string optional_string = 14; | |
| 70 optional bytes optional_bytes = 15; | |
| 71 | |
| 72 optional group OptionalGroup = 16 { | |
| 73 optional int32 a = 17; | |
| 74 } | |
| 75 | |
| 76 optional NestedMessage optional_nested_message = 18; | |
| 77 optional ForeignMessageLite optional_foreign_message = 19; | |
| 78 optional protobuf_unittest_import.ImportMessageLite | |
| 79 optional_import_message = 20; | |
| 80 | |
| 81 optional NestedEnum optional_nested_enum = 21; | |
| 82 optional ForeignEnumLite optional_foreign_enum = 22; | |
| 83 optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; | |
| 84 | |
| 85 optional string optional_string_piece = 24 [ctype=STRING_PIECE]; | |
| 86 optional string optional_cord = 25 [ctype=CORD]; | |
| 87 | |
| 88 // Defined in unittest_import_public.proto | |
| 89 optional protobuf_unittest_import.PublicImportMessageLite | |
| 90 optional_public_import_message = 26; | |
| 91 | |
| 92 optional NestedMessage optional_lazy_message = 27 [lazy=true]; | |
| 93 | |
| 94 // Repeated | |
| 95 repeated int32 repeated_int32 = 31; | |
| 96 repeated int64 repeated_int64 = 32; | |
| 97 repeated uint32 repeated_uint32 = 33; | |
| 98 repeated uint64 repeated_uint64 = 34; | |
| 99 repeated sint32 repeated_sint32 = 35; | |
| 100 repeated sint64 repeated_sint64 = 36; | |
| 101 repeated fixed32 repeated_fixed32 = 37; | |
| 102 repeated fixed64 repeated_fixed64 = 38; | |
| 103 repeated sfixed32 repeated_sfixed32 = 39; | |
| 104 repeated sfixed64 repeated_sfixed64 = 40; | |
| 105 repeated float repeated_float = 41; | |
| 106 repeated double repeated_double = 42; | |
| 107 repeated bool repeated_bool = 43; | |
| 108 repeated string repeated_string = 44; | |
| 109 repeated bytes repeated_bytes = 45; | |
| 110 | |
| 111 repeated group RepeatedGroup = 46 { | |
| 112 optional int32 a = 47; | |
| 113 } | |
| 114 | |
| 115 repeated NestedMessage repeated_nested_message = 48; | |
| 116 repeated ForeignMessageLite repeated_foreign_message = 49; | |
| 117 repeated protobuf_unittest_import.ImportMessageLite | |
| 118 repeated_import_message = 50; | |
| 119 | |
| 120 repeated NestedEnum repeated_nested_enum = 51; | |
| 121 repeated ForeignEnumLite repeated_foreign_enum = 52; | |
| 122 repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53; | |
| 123 | |
| 124 repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; | |
| 125 repeated string repeated_cord = 55 [ctype=CORD]; | |
| 126 | |
| 127 repeated NestedMessage repeated_lazy_message = 57 [lazy=true]; | |
| 128 | |
| 129 // Singular with defaults | |
| 130 optional int32 default_int32 = 61 [default = 41 ]; | |
| 131 optional int64 default_int64 = 62 [default = 42 ]; | |
| 132 optional uint32 default_uint32 = 63 [default = 43 ]; | |
| 133 optional uint64 default_uint64 = 64 [default = 44 ]; | |
| 134 optional sint32 default_sint32 = 65 [default = -45 ]; | |
| 135 optional sint64 default_sint64 = 66 [default = 46 ]; | |
| 136 optional fixed32 default_fixed32 = 67 [default = 47 ]; | |
| 137 optional fixed64 default_fixed64 = 68 [default = 48 ]; | |
| 138 optional sfixed32 default_sfixed32 = 69 [default = 49 ]; | |
| 139 optional sfixed64 default_sfixed64 = 70 [default = -50 ]; | |
| 140 optional float default_float = 71 [default = 51.5 ]; | |
| 141 optional double default_double = 72 [default = 52e3 ]; | |
| 142 optional bool default_bool = 73 [default = true ]; | |
| 143 optional string default_string = 74 [default = "hello"]; | |
| 144 optional bytes default_bytes = 75 [default = "world"]; | |
| 145 | |
| 146 optional NestedEnum default_nested_enum = 81 [default = BAR]; | |
| 147 optional ForeignEnumLite default_foreign_enum = 82 | |
| 148 [default = FOREIGN_LITE_BAR]; | |
| 149 optional protobuf_unittest_import.ImportEnumLite | |
| 150 default_import_enum = 83 [default = IMPORT_LITE_BAR]; | |
| 151 | |
| 152 optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; | |
| 153 optional string default_cord = 85 [ctype=CORD,default="123"]; | |
| 154 } | |
| 155 | |
| 156 message ForeignMessageLite { | |
| 157 optional int32 c = 1; | |
| 158 } | |
| 159 | |
| 160 enum ForeignEnumLite { | |
| 161 FOREIGN_LITE_FOO = 4; | |
| 162 FOREIGN_LITE_BAR = 5; | |
| 163 FOREIGN_LITE_BAZ = 6; | |
| 164 } | |
| 165 | |
| 166 message TestPackedTypesLite { | |
| 167 repeated int32 packed_int32 = 90 [packed = true]; | |
| 168 repeated int64 packed_int64 = 91 [packed = true]; | |
| 169 repeated uint32 packed_uint32 = 92 [packed = true]; | |
| 170 repeated uint64 packed_uint64 = 93 [packed = true]; | |
| 171 repeated sint32 packed_sint32 = 94 [packed = true]; | |
| 172 repeated sint64 packed_sint64 = 95 [packed = true]; | |
| 173 repeated fixed32 packed_fixed32 = 96 [packed = true]; | |
| 174 repeated fixed64 packed_fixed64 = 97 [packed = true]; | |
| 175 repeated sfixed32 packed_sfixed32 = 98 [packed = true]; | |
| 176 repeated sfixed64 packed_sfixed64 = 99 [packed = true]; | |
| 177 repeated float packed_float = 100 [packed = true]; | |
| 178 repeated double packed_double = 101 [packed = true]; | |
| 179 repeated bool packed_bool = 102 [packed = true]; | |
| 180 repeated ForeignEnumLite packed_enum = 103 [packed = true]; | |
| 181 } | |
| 182 | |
| 183 message TestAllExtensionsLite { | |
| 184 extensions 1 to max; | |
| 185 } | |
| 186 | |
| 187 extend TestAllExtensionsLite { | |
| 188 // Singular | |
| 189 optional int32 optional_int32_extension_lite = 1; | |
| 190 optional int64 optional_int64_extension_lite = 2; | |
| 191 optional uint32 optional_uint32_extension_lite = 3; | |
| 192 optional uint64 optional_uint64_extension_lite = 4; | |
| 193 optional sint32 optional_sint32_extension_lite = 5; | |
| 194 optional sint64 optional_sint64_extension_lite = 6; | |
| 195 optional fixed32 optional_fixed32_extension_lite = 7; | |
| 196 optional fixed64 optional_fixed64_extension_lite = 8; | |
| 197 optional sfixed32 optional_sfixed32_extension_lite = 9; | |
| 198 optional sfixed64 optional_sfixed64_extension_lite = 10; | |
| 199 optional float optional_float_extension_lite = 11; | |
| 200 optional double optional_double_extension_lite = 12; | |
| 201 optional bool optional_bool_extension_lite = 13; | |
| 202 optional string optional_string_extension_lite = 14; | |
| 203 optional bytes optional_bytes_extension_lite = 15; | |
| 204 | |
| 205 optional group OptionalGroup_extension_lite = 16 { | |
| 206 optional int32 a = 17; | |
| 207 } | |
| 208 | |
| 209 optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite | |
| 210 = 18; | |
| 211 optional ForeignMessageLite optional_foreign_message_extension_lite = 19; | |
| 212 optional protobuf_unittest_import.ImportMessageLite | |
| 213 optional_import_message_extension_lite = 20; | |
| 214 | |
| 215 optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21; | |
| 216 optional ForeignEnumLite optional_foreign_enum_extension_lite = 22; | |
| 217 optional protobuf_unittest_import.ImportEnumLite | |
| 218 optional_import_enum_extension_lite = 23; | |
| 219 | |
| 220 optional string optional_string_piece_extension_lite = 24 | |
| 221 [ctype=STRING_PIECE]; | |
| 222 optional string optional_cord_extension_lite = 25 [ctype=CORD]; | |
| 223 | |
| 224 optional protobuf_unittest_import.PublicImportMessageLite | |
| 225 optional_public_import_message_extension_lite = 26; | |
| 226 | |
| 227 optional TestAllTypesLite.NestedMessage | |
| 228 optional_lazy_message_extension_lite = 27 [lazy=true]; | |
| 229 | |
| 230 // Repeated | |
| 231 repeated int32 repeated_int32_extension_lite = 31; | |
| 232 repeated int64 repeated_int64_extension_lite = 32; | |
| 233 repeated uint32 repeated_uint32_extension_lite = 33; | |
| 234 repeated uint64 repeated_uint64_extension_lite = 34; | |
| 235 repeated sint32 repeated_sint32_extension_lite = 35; | |
| 236 repeated sint64 repeated_sint64_extension_lite = 36; | |
| 237 repeated fixed32 repeated_fixed32_extension_lite = 37; | |
| 238 repeated fixed64 repeated_fixed64_extension_lite = 38; | |
| 239 repeated sfixed32 repeated_sfixed32_extension_lite = 39; | |
| 240 repeated sfixed64 repeated_sfixed64_extension_lite = 40; | |
| 241 repeated float repeated_float_extension_lite = 41; | |
| 242 repeated double repeated_double_extension_lite = 42; | |
| 243 repeated bool repeated_bool_extension_lite = 43; | |
| 244 repeated string repeated_string_extension_lite = 44; | |
| 245 repeated bytes repeated_bytes_extension_lite = 45; | |
| 246 | |
| 247 repeated group RepeatedGroup_extension_lite = 46 { | |
| 248 optional int32 a = 47; | |
| 249 } | |
| 250 | |
| 251 repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite | |
| 252 = 48; | |
| 253 repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49; | |
| 254 repeated protobuf_unittest_import.ImportMessageLite | |
| 255 repeated_import_message_extension_lite = 50; | |
| 256 | |
| 257 repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51; | |
| 258 repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52; | |
| 259 repeated protobuf_unittest_import.ImportEnumLite | |
| 260 repeated_import_enum_extension_lite = 53; | |
| 261 | |
| 262 repeated string repeated_string_piece_extension_lite = 54 | |
| 263 [ctype=STRING_PIECE]; | |
| 264 repeated string repeated_cord_extension_lite = 55 [ctype=CORD]; | |
| 265 | |
| 266 repeated TestAllTypesLite.NestedMessage | |
| 267 repeated_lazy_message_extension_lite = 57 [lazy=true]; | |
| 268 | |
| 269 // Singular with defaults | |
| 270 optional int32 default_int32_extension_lite = 61 [default = 41 ]; | |
| 271 optional int64 default_int64_extension_lite = 62 [default = 42 ]; | |
| 272 optional uint32 default_uint32_extension_lite = 63 [default = 43 ]; | |
| 273 optional uint64 default_uint64_extension_lite = 64 [default = 44 ]; | |
| 274 optional sint32 default_sint32_extension_lite = 65 [default = -45 ]; | |
| 275 optional sint64 default_sint64_extension_lite = 66 [default = 46 ]; | |
| 276 optional fixed32 default_fixed32_extension_lite = 67 [default = 47 ]; | |
| 277 optional fixed64 default_fixed64_extension_lite = 68 [default = 48 ]; | |
| 278 optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49 ]; | |
| 279 optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50 ]; | |
| 280 optional float default_float_extension_lite = 71 [default = 51.5 ]; | |
| 281 optional double default_double_extension_lite = 72 [default = 52e3 ]; | |
| 282 optional bool default_bool_extension_lite = 73 [default = true ]; | |
| 283 optional string default_string_extension_lite = 74 [default = "hello"]; | |
| 284 optional bytes default_bytes_extension_lite = 75 [default = "world"]; | |
| 285 | |
| 286 optional TestAllTypesLite.NestedEnum | |
| 287 default_nested_enum_extension_lite = 81 [default = BAR]; | |
| 288 optional ForeignEnumLite | |
| 289 default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; | |
| 290 optional protobuf_unittest_import.ImportEnumLite | |
| 291 default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; | |
| 292 | |
| 293 optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE, | |
| 294 default="abc"]; | |
| 295 optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"]; | |
| 296 } | |
| 297 | |
| 298 message TestPackedExtensionsLite { | |
| 299 extensions 1 to max; | |
| 300 } | |
| 301 | |
| 302 extend TestPackedExtensionsLite { | |
| 303 repeated int32 packed_int32_extension_lite = 90 [packed = true]; | |
| 304 repeated int64 packed_int64_extension_lite = 91 [packed = true]; | |
| 305 repeated uint32 packed_uint32_extension_lite = 92 [packed = true]; | |
| 306 repeated uint64 packed_uint64_extension_lite = 93 [packed = true]; | |
| 307 repeated sint32 packed_sint32_extension_lite = 94 [packed = true]; | |
| 308 repeated sint64 packed_sint64_extension_lite = 95 [packed = true]; | |
| 309 repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true]; | |
| 310 repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true]; | |
| 311 repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true]; | |
| 312 repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true]; | |
| 313 repeated float packed_float_extension_lite = 100 [packed = true]; | |
| 314 repeated double packed_double_extension_lite = 101 [packed = true]; | |
| 315 repeated bool packed_bool_extension_lite = 102 [packed = true]; | |
| 316 repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true]; | |
| 317 } | |
| 318 | |
| 319 message TestNestedExtensionLite { | |
| 320 extend TestAllExtensionsLite { | |
| 321 optional int32 nested_extension = 12345; | |
| 322 } | |
| 323 } | |
| 324 | |
| 325 // Test that deprecated fields work. We only verify that they compile (at one | |
| 326 // point this failed). | |
| 327 message TestDeprecatedLite { | |
| 328 optional int32 deprecated_field = 1 [deprecated = true]; | |
| 329 } | |
| 330 | |
| 331 // See the comments of the same type in unittest.proto. | |
| 332 message TestParsingMergeLite { | |
| 333 message RepeatedFieldsGenerator { | |
| 334 repeated TestAllTypesLite field1 = 1; | |
| 335 repeated TestAllTypesLite field2 = 2; | |
| 336 repeated TestAllTypesLite field3 = 3; | |
| 337 repeated group Group1 = 10 { | |
| 338 optional TestAllTypesLite field1 = 11; | |
| 339 } | |
| 340 repeated group Group2 = 20 { | |
| 341 optional TestAllTypesLite field1 = 21; | |
| 342 } | |
| 343 repeated TestAllTypesLite ext1 = 1000; | |
| 344 repeated TestAllTypesLite ext2 = 1001; | |
| 345 } | |
| 346 required TestAllTypesLite required_all_types = 1; | |
| 347 optional TestAllTypesLite optional_all_types = 2; | |
| 348 repeated TestAllTypesLite repeated_all_types = 3; | |
| 349 optional group OptionalGroup = 10 { | |
| 350 optional TestAllTypesLite optional_group_all_types = 11; | |
| 351 } | |
| 352 repeated group RepeatedGroup = 20 { | |
| 353 optional TestAllTypesLite repeated_group_all_types = 21; | |
| 354 } | |
| 355 extensions 1000 to max; | |
| 356 extend TestParsingMergeLite { | |
| 357 optional TestAllTypesLite optional_ext = 1000; | |
| 358 repeated TestAllTypesLite repeated_ext = 1001; | |
| 359 } | |
| 360 } | |
| OLD | NEW |