Enable editions support for Java Lite.

java_features.proto and descriptor.proto should now both be included in the Java Lite and Kotlin Lite maven releases.

Fixes https://github.com/protocolbuffers/protobuf/issues/7331

PiperOrigin-RevId: 618251348
pull/16262/head
Sandy Zhang 8 months ago committed by Copybara-Service
parent d452a16b8c
commit 500c953d10
  1. 2
      conformance/BUILD.bazel
  2. 85
      conformance/ConformanceJavaLite.java
  3. 4
      conformance/failure_list_java_lite.txt
  4. 10
      java/core/BUILD.bazel
  5. 2
      java/core/src/test/proto/com/google/protobuf/any_test.proto
  6. 6
      java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto
  7. 3
      java/core/src/test/proto/com/google/protobuf/dynamic_message_test.proto
  8. 6
      java/core/src/test/proto/com/google/protobuf/field_presence_test.proto
  9. 30
      java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto
  10. 36
      java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto
  11. 24
      java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto
  12. 24
      java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto
  13. 6
      java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto
  14. 19
      java/core/src/test/proto/com/google/protobuf/map_lite_test.proto
  15. 19
      java/core/src/test/proto/com/google/protobuf/map_test.proto
  16. 18
      java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto
  17. 17
      java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto
  18. 8
      java/core/src/test/proto/com/google/protobuf/nested_extension.proto
  19. 8
      java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto
  20. 9
      java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto
  21. 8
      java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto
  22. 2
      java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto
  23. 2
      java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto
  24. 8
      java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto
  25. 57
      java/core/src/test/proto/com/google/protobuf/packed_field_test.proto
  26. 384
      java/core/src/test/proto/com/google/protobuf/proto2_message.proto
  27. 376
      java/core/src/test/proto/com/google/protobuf/proto2_message_lite.proto
  28. 7
      java/core/src/test/proto/com/google/protobuf/proto2_text_format_performance_test.proto
  29. 8
      java/core/src/test/proto/com/google/protobuf/proto2_unknown_enum_values.proto
  30. 100
      java/core/src/test/proto/com/google/protobuf/proto3_message.proto
  31. 100
      java/core/src/test/proto/com/google/protobuf/proto3_message_lite.proto
  32. 4
      java/core/src/test/proto/com/google/protobuf/proto3_text_format_performance_test.proto
  33. 122
      java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto
  34. 14
      java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto
  35. 14
      java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto
  36. 3
      java/core/src/test/proto/com/google/protobuf/wrappers_test.proto
  37. 8
      java/kotlin-lite/BUILD.bazel
  38. 3
      java/kotlin-lite/generate-sources-build.xml
  39. 2
      java/lite/BUILD.bazel
  40. 3
      java/lite/generate-sources-build.xml
  41. 7
      java/lite/pom.xml
  42. 8
      src/google/protobuf/compiler/command_line_interface.cc
  43. 11
      src/google/protobuf/compiler/java/generator.cc
  44. 14
      src/google/protobuf/editions/BUILD
  45. 16
      src/google/protobuf/map_lite_unittest.proto
  46. 6
      src/google/protobuf/unittest_import_lite.proto
  47. 4
      src/google/protobuf/unittest_import_public_lite.proto
  48. 526
      src/google/protobuf/unittest_lite.proto

@ -271,6 +271,8 @@ java_binary(
"//:protobuf_javalite",
"//:test_messages_proto2_java_proto_lite",
"//:test_messages_proto3_java_proto_lite",
"//src/google/protobuf/editions:test_messages_proto2_editions_java_proto_lite",
"//src/google/protobuf/editions:test_messages_proto3_editions_java_proto_lite",
],
)

@ -5,6 +5,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
import com.google.protobuf.AbstractMessageLite;
import com.google.protobuf.ByteString;
import com.google.protobuf.CodedInputStream;
import com.google.protobuf.ExtensionRegistryLite;
@ -15,6 +16,8 @@ import com.google.protobuf.conformance.Conformance;
import com.google.protobuf_test_messages.proto2.TestMessagesProto2;
import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2;
import com.google.protobuf_test_messages.proto3.TestMessagesProto3;
import com.google.protobuf_test_messages.editions.proto2.TestMessagesProto2Editions;
import com.google.protobuf_test_messages.editions.proto3.TestMessagesProto3Editions;
import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@ -203,42 +206,62 @@ class ConformanceJavaLite {
return messages.get(0);
}
private Class<? extends AbstractMessageLite> createTestMessage(String messageType) {
switch (messageType) {
case "protobuf_test_messages.proto3.TestAllTypesProto3":
return TestAllTypesProto3.class;
case "protobuf_test_messages.proto2.TestAllTypesProto2":
return TestAllTypesProto2.class;
case "protobuf_test_messages.editions.proto3.TestAllTypesProto3":
return TestMessagesProto3Editions.TestAllTypesProto3.class;
case "protobuf_test_messages.editions.proto2.TestAllTypesProto2":
return TestMessagesProto2Editions.TestAllTypesProto2.class;
default:
throw new IllegalArgumentException(
"Protobuf request has unexpected payload type: " + messageType);
}
}
private Class<?> createTestFile(String messageType) {
switch (messageType) {
case "protobuf_test_messages.proto3.TestAllTypesProto3":
return TestMessagesProto3.class;
case "protobuf_test_messages.proto2.TestAllTypesProto2":
return TestMessagesProto2.class;
case "protobuf_test_messages.editions.proto3.TestAllTypesProto3":
return TestMessagesProto3Editions.class;
case "protobuf_test_messages.editions.proto2.TestAllTypesProto2":
return TestMessagesProto2Editions.class;
default:
throw new IllegalArgumentException(
"Protobuf request has unexpected payload type: " + messageType);
}
}
@SuppressWarnings("unchecked")
private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
com.google.protobuf.MessageLite testMessage;
boolean isProto3 =
request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3");
boolean isProto2 =
request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");
String messageType = request.getMessageType();
switch (request.getPayloadCase()) {
case PROTOBUF_PAYLOAD:
{
if (isProto3) {
try {
ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
TestMessagesProto3.registerAllExtensions(extensions);
testMessage =
parseBinary(
request.getProtobufPayload(), TestAllTypesProto3.parser(), extensions);
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
}
} else if (isProto2) {
try {
ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
TestMessagesProto2.registerAllExtensions(extensions);
testMessage =
parseBinary(
request.getProtobufPayload(), TestAllTypesProto2.parser(), extensions);
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
}
} else {
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
try {
ExtensionRegistryLite extensions = ExtensionRegistryLite.newInstance();
createTestFile(messageType)
.getMethod("registerAllExtensions", ExtensionRegistryLite.class)
.invoke(null, extensions);
testMessage =
parseBinary(
request.getProtobufPayload(),
(Parser<AbstractMessageLite>)
createTestMessage(messageType).getMethod("parser").invoke(null),
extensions);
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder()
.setParseError(e.getMessage())
.build();
} catch (Exception e) {
throw new RuntimeException(e);
}
break;
}

@ -8,3 +8,7 @@ Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValu
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Editions_Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Editions_Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Editions_Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Editions_Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE

@ -109,8 +109,10 @@ internal_gen_well_known_protos_java(
name = "gen_well_known_protos_javalite",
javalite = True,
deps = [
":java_features_proto",
"//:any_proto",
"//:api_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
@ -155,7 +157,9 @@ protobuf_java_export(
maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "//java/lite:pom_template.xml",
resources = [
":java_features_proto",
"//:lite_well_known_protos",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [":lite_bundle"],
@ -170,7 +174,11 @@ proto_library(
name = "java_features_proto",
srcs = ["src/main/java/com/google/protobuf/java_features.proto"],
strip_import_prefix = "/java/core/src/main/java/com",
visibility = ["//pkg:__pkg__"],
visibility = [
"//java/kotlin-lite:__pkg__",
"//java/lite:__pkg__",
"//pkg:__pkg__",
],
deps = ["//:descriptor_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 any_test;

@ -6,7 +6,7 @@
// https://developers.google.com/open-source/licenses/bsd
// A regression test for b/74087933
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
@ -17,6 +17,6 @@ option optimize_for = CODE_SIZE;
option java_multiple_files = true;
message TestCachedFieldSizeMessage {
optional protobuf_unittest.TestPackedTypes proto2_child = 1;
optional proto3_unittest.TestPackedTypes proto3_child = 2;
protobuf_unittest.TestPackedTypes proto2_child = 1;
proto3_unittest.TestPackedTypes proto3_child = 2;
}

@ -5,10 +5,11 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package dynamic_message_test;
option features.utf8_validation = NONE;
option java_package = "dynamicmessagetest";
option java_outer_classname = "DynamicMessageTestProto";

@ -5,12 +5,13 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package field_presence_test;
import "google/protobuf/unittest.proto";
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf";
option java_outer_classname = "FieldPresenceTestProto";
@ -20,6 +21,7 @@ message TestAllTypes {
BAR = 1;
BAZ = 2;
}
message NestedMessage {
int32 value = 1;
}
@ -48,7 +50,7 @@ message TestAllTypes {
repeated NestedEnum repeated_nested_enum = 24;
repeated NestedMessage repeated_nested_message = 25;
repeated protobuf_unittest.TestRequired repeated_proto2_message = 26;
repeated NestedEnum packed_nested_enum = 27 [packed = true];
repeated NestedEnum packed_nested_enum = 27;
}
message TestOptionalFieldsOnly {

@ -9,15 +9,19 @@
//
// A proto file with lazy fields
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
option features.utf8_validation = NONE;
message LazyMessageLite {
optional int32 num = 1;
optional int32 num_with_default = 2 [default = 421];
optional LazyInnerMessageLite inner = 3 [lazy = true];
repeated LazyInnerMessageLite repeated_inner = 4 ;
int32 num = 1;
int32 num_with_default = 2 [default = 421];
LazyInnerMessageLite inner = 3 [lazy = true];
repeated LazyInnerMessageLite repeated_inner = 4;
oneof oneof_field {
int32 oneof_num = 5;
@ -26,21 +30,23 @@ message LazyMessageLite {
}
message LazyInnerMessageLite {
optional int32 num = 1;
optional int32 num_with_default = 2 [default = 42];
optional LazyNestedInnerMessageLite nested = 3 [lazy = true];
int32 num = 1;
int32 num_with_default = 2 [default = 42];
LazyNestedInnerMessageLite nested = 3 [lazy = true];
extensions 1000 to max;
}
message LazyExtension {
extend LazyInnerMessageLite {
optional LazyExtension extension = 1000;
LazyExtension extension = 1000;
}
optional string name = 1;
string name = 1;
}
message LazyNestedInnerMessageLite {
optional int32 num = 1;
optional int32 num_with_default = 2 [default = 4];
int32 num = 1;
int32 num_with_default = 2 [default = 4];
}

@ -7,10 +7,11 @@
// Author: pbogle@google.com (Phil Bogle)
syntax = "proto2";
edition = "2023";
package protobuf_unittest.lite_equals_and_hash;
option features.utf8_validation = NONE;
message TestOneofEquals {
oneof oneof_field {
@ -20,15 +21,18 @@ message TestOneofEquals {
}
message Foo {
optional int32 value = 1;
int32 value = 1;
repeated Bar bar = 2;
map<string, string> my_map = 3;
oneof Single {
sint64 sint64 = 4;
// LINT: ALLOW_GROUPS
group MyGroup = 5 {
optional int32 value = 1;
}
MyGroup mygroup = 5 [features.message_encoding = DELIMITED];
}
// LINT: ALLOW_GROUPS
message MyGroup {
int32 value = 1;
}
extensions 100 to max;
@ -36,25 +40,27 @@ message Foo {
message Bar {
extend Foo {
optional Bar foo_ext = 100;
Bar foo_ext = 100;
}
optional string name = 1;
string name = 1;
}
message BarPrime {
optional string name = 1;
string name = 1;
}
message Empty {}
extend Foo {
optional int32 varint = 101;
optional fixed32 fixed32 = 102;
optional fixed64 fixed64 = 103;
optional group MyGroup = 104 {
optional string group_value = 1;
}
int32 varint = 101;
fixed32 fixed32 = 102;
fixed64 fixed64 = 103;
MyGroup mygroup = 104 [features.message_encoding = DELIMITED];
}
message MyGroup {
string group_value = 1;
}
message TestRecursiveOneof {

@ -5,18 +5,21 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package map_for_proto2_lite_test;
option features.enum_type = CLOSED;
option features.utf8_validation = NONE;
option java_outer_classname = "MapForProto2TestProto";
option optimize_for = LITE_RUNTIME;
option java_package = "map_lite_test";
message TestMap {
message MessageValue {
optional int32 value = 1;
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -32,8 +35,9 @@ message TestMap {
map<string, int32> string_to_int32_field = 6;
message MessageWithRequiredFields {
required int32 value = 1;
int32 value = 1 [features.field_presence = LEGACY_REQUIRED];
}
map<int32, MessageWithRequiredFields> required_message_map = 11;
}
@ -46,7 +50,7 @@ message TestUnknownEnumValue {
// Test that the maps initialization code works correctly when the map field
// references the containing message.
message TestRecursiveMap {
optional int32 value = 1;
int32 value = 1;
map<int32, TestRecursiveMap> recursive_map_field = 2;
}
@ -54,14 +58,19 @@ message TestRecursiveMap {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -77,11 +86,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -91,17 +103,21 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}

@ -5,17 +5,20 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package map_for_proto2_test;
option features.enum_type = CLOSED;
option features.utf8_validation = NONE;
option java_package = "map_test";
option java_outer_classname = "MapForProto2TestProto";
message TestMap {
message MessageValue {
optional int32 value = 1;
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -31,8 +34,9 @@ message TestMap {
map<string, int32> string_to_int32_field = 6;
message MessageWithRequiredFields {
required int32 value = 1;
int32 value = 1 [features.field_presence = LEGACY_REQUIRED];
}
map<int32, MessageWithRequiredFields> required_message_map = 11;
}
@ -45,7 +49,7 @@ message TestUnknownEnumValue {
// Test that the maps initialization code works correctly when the map field
// references the containing message.
message TestRecursiveMap {
optional int32 value = 1;
int32 value = 1;
map<int32, TestRecursiveMap> recursive_map_field = 2;
}
@ -53,14 +57,19 @@ message TestRecursiveMap {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -76,11 +85,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -90,17 +102,21 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}

@ -14,10 +14,11 @@
// a. getDescriptor() is called on another message in the same file.
// b. use protobuf reflection to access the map field.
// The symptom is a NullPointerException being thrown.
syntax = "proto2";
edition = "2023";
package map_test;
option features.utf8_validation = NONE;
option java_package = "map_test";
option java_outer_classname = "MapInitializationOrderTest";
option java_multiple_files = true;
@ -27,11 +28,12 @@ option java_multiple_files = true;
message Message1 {
map<string, bool> map_field = 1;
extensions 1000 to max;
}
extend Message1 {
optional Message1 recursive_extension = 1001;
Message1 recursive_extension = 1001;
}
message RedactAllTypes {}

@ -5,10 +5,12 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package map_lite_test;
option features.field_presence = IMPLICIT;
option optimize_for = LITE_RUNTIME;
option java_package = "map_lite_test";
option java_outer_classname = "MapTestProto";
@ -17,6 +19,7 @@ message TestMap {
message MessageValue {
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -45,14 +48,19 @@ message TestOnChangeEventPropagation {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -68,11 +76,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -82,22 +93,26 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string,string> my_map = 1;
map<string, string> my_map = 1;
}

@ -5,10 +5,12 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package map_test;
option features.field_presence = IMPLICIT;
option java_package = "map_test";
option java_outer_classname = "MapTestProto";
@ -16,6 +18,7 @@ message TestMap {
message MessageValue {
int32 value = 1;
}
enum EnumValue {
FOO = 0;
BAR = 1;
@ -44,14 +47,19 @@ message TestOnChangeEventPropagation {
message BizarroTestMap {
// same key type, different value
map<int32, bytes> int32_to_int32_field = 1;
// different key and value types
map<string, int32> int32_to_string_field = 2;
// different key types, same value
map<string, int32> int32_to_bytes_field = 3;
// different key and value types
map<string, bytes> int32_to_enum_field = 4;
// different key and value types
map<string, bytes> int32_to_message_field = 5;
// same key type, different value
map<string, bytes> string_to_int32_field = 6;
}
@ -67,11 +75,14 @@ message ReservedAsMapField {
map<string, uint32> class = 4;
map<string, uint32> int = 5;
map<string, uint32> void = 6;
// These are also proto keywords
map<string, uint32> string = 7;
map<string, uint32> package = 8;
// Most recent Java reserved word
map<string, uint32> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, uint32> null = 10;
}
@ -81,22 +92,26 @@ message ReservedAsMapFieldWithEnumValue {
A = 0;
B = 1;
}
map<string, SampleEnum> if = 1;
map<string, SampleEnum> const = 2;
map<string, SampleEnum> private = 3;
map<string, SampleEnum> class = 4;
map<string, SampleEnum> int = 5;
map<string, SampleEnum> void = 6;
// These are also proto keywords
map<string, SampleEnum> string = 7;
map<string, SampleEnum> package = 8;
// Most recent Java reserved word
map<string, SampleEnum> enum = 9;
// null is not a 'reserved word' per se but as a literal needs similar care
map<string, SampleEnum> null = 10;
}
// https://github.com/protocolbuffers/protobuf/issues/9785
message MapContainer {
map<string,string> my_map = 1;
map<string, string> my_map = 1;
}

@ -9,7 +9,7 @@
//
// A proto file which tests the java_multiple_files option.
syntax = "proto2";
edition = "2023";
// Some generic_services option(s) added automatically.
// See: http://go/proto2-generic-services-default
@ -18,29 +18,33 @@ package protobuf_unittest;
import "google/protobuf/descriptor.proto";
import "google/protobuf/unittest.proto";
option features.enum_type = CLOSED;
option java_generic_services = true; // auto-added
option java_multiple_files = true;
option java_outer_classname = "MultipleFilesTestProto";
message MessageWithNoOuter {
message NestedMessage {
optional int32 i = 1;
int32 i = 1;
}
enum NestedEnum {
BAZ = 3;
}
optional NestedMessage nested = 1;
NestedMessage nested = 1;
repeated TestAllTypes foreign = 2;
optional NestedEnum nested_enum = 3;
optional EnumWithNoOuter foreign_enum = 4;
NestedEnum nested_enum = 3;
EnumWithNoOuter foreign_enum = 4;
}
extend google.protobuf.EnumValueOptions {
optional int32 enum_value_option = 7654321;
int32 enum_value_option = 7654321;
}
enum EnumWithNoOuter {
FOO = 1 [(enum_value_option) = 12345];
BAR = 2;
}
@ -49,5 +53,5 @@ service ServiceWithNoOuter {
}
extend TestAllExtensions {
optional int32 extension_with_outer = 1234567;
int32 extension_with_outer = 1234567;
}

@ -6,8 +6,7 @@
// https://developers.google.com/open-source/licenses/bsd
// Author: jonp@google.com (Jon Perlow)
//
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
@ -15,21 +14,21 @@ option java_multiple_files = true;
option java_outer_classname = "NestedBuilders";
message Vehicle {
optional Engine engine = 1;
Engine engine = 1;
repeated Wheel wheel = 2;
}
message Engine {
optional int32 cylinder = 1;
optional int32 liters = 2;
optional TimingBelt timing_belt = 3;
int32 cylinder = 1;
int32 liters = 2;
TimingBelt timing_belt = 3;
}
message TimingBelt {
optional int32 number_of_teeth = 1;
int32 number_of_teeth = 1;
}
message Wheel {
optional int32 radius = 1;
optional int32 width = 2;
int32 radius = 1;
int32 width = 2;
}

@ -10,7 +10,9 @@
// A proto file with nested extensions. Note that this must be defined in
// a separate file to properly test the initialization of the outer class.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
@ -19,7 +21,7 @@ import "com/google/protobuf/non_nested_extension.proto";
message MyNestedExtension {
extend MessageToBeExtended {
optional MessageToBeExtended recursiveExtension = 2;
optional int32 default = 2002;
MessageToBeExtended recursiveExtension = 2;
int32 default = 2002;
}
}

@ -11,7 +11,9 @@
// this must be defined in a separate file to properly test the initialization
// of the outer class.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
@ -21,7 +23,7 @@ option optimize_for = LITE_RUNTIME;
message MyNestedExtensionLite {
extend MessageLiteToBeExtended {
optional MessageLiteToBeExtended recursiveExtensionLite = 3;
optional double private = 2004;
MessageLiteToBeExtended recursiveExtensionLite = 3;
double private = 2004;
}
}

@ -9,10 +9,13 @@
//
// A proto file with extensions.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
option features.utf8_validation = NONE;
message MessageToBeExtended {
extensions 1 to max;
@ -21,6 +24,6 @@ message MessageToBeExtended {
message MyNonNestedExtension {}
extend MessageToBeExtended {
optional MyNonNestedExtension nonNestedExtension = 1;
optional string if = 2000;
MyNonNestedExtension nonNestedExtension = 1;
string if = 2000;
}

@ -9,7 +9,9 @@
//
// A proto file with extensions for a MessageLite messages.
syntax = "proto2";
// LINT: LEGACY_NAMES
edition = "2023";
package protobuf_unittest;
@ -22,6 +24,6 @@ message MessageLiteToBeExtended {
message MyNonNestedExtensionLite {}
extend MessageLiteToBeExtended {
optional MyNonNestedExtensionLite nonNestedExtensionLite = 1;
optional bool package = 2006;
MyNonNestedExtensionLite nonNestedExtensionLite = 1;
bool package = 2006;
}

@ -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 protobuf_unittest;

@ -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 protobuf_unittest;

@ -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 protobuf_unittest;
@ -15,6 +15,10 @@ message TestMessage3 {
// This enum's name is the same with the default outer class name of this
// proto file. It's used to test if the compiler can avoid this conflict
// correctly.
enum OuterClassNameTest3 { DUMMY_VALUE = 1; }
enum OuterClassNameTest3 {
option features.enum_type = CLOSED;
DUMMY_VALUE = 1;
}
}
}

@ -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 packed_field_test;
@ -36,18 +36,45 @@ message TestAllTypes {
}
message TestUnpackedTypes {
repeated int32 repeated_int32 = 1 [packed = false];
repeated int64 repeated_int64 = 2 [packed = false];
repeated uint32 repeated_uint32 = 3 [packed = false];
repeated uint64 repeated_uint64 = 4 [packed = false];
repeated sint32 repeated_sint32 = 5 [packed = false];
repeated sint64 repeated_sint64 = 6 [packed = false];
repeated fixed32 repeated_fixed32 = 7 [packed = false];
repeated fixed64 repeated_fixed64 = 8 [packed = false];
repeated sfixed32 repeated_sfixed32 = 9 [packed = false];
repeated sfixed64 repeated_sfixed64 = 10 [packed = false];
repeated float repeated_float = 11 [packed = false];
repeated double repeated_double = 12 [packed = false];
repeated bool repeated_bool = 13 [packed = false];
repeated TestAllTypes.NestedEnum repeated_nested_enum = 14 [packed = false];
repeated int32 repeated_int32 = 1
[features.repeated_field_encoding = EXPANDED];
repeated int64 repeated_int64 = 2
[features.repeated_field_encoding = EXPANDED];
repeated uint32 repeated_uint32 = 3
[features.repeated_field_encoding = EXPANDED];
repeated uint64 repeated_uint64 = 4
[features.repeated_field_encoding = EXPANDED];
repeated sint32 repeated_sint32 = 5
[features.repeated_field_encoding = EXPANDED];
repeated sint64 repeated_sint64 = 6
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 repeated_fixed32 = 7
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 repeated_fixed64 = 8
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 repeated_sfixed32 = 9
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 repeated_sfixed64 = 10
[features.repeated_field_encoding = EXPANDED];
repeated float repeated_float = 11
[features.repeated_field_encoding = EXPANDED];
repeated double repeated_double = 12
[features.repeated_field_encoding = EXPANDED];
repeated bool repeated_bool = 13
[features.repeated_field_encoding = EXPANDED];
repeated TestAllTypes.NestedEnum repeated_nested_enum = 14
[features.repeated_field_encoding = EXPANDED];
}

@ -6,82 +6,121 @@
// https://developers.google.com/open-source/licenses/bsd
// LINT: ALLOW_GROUPS
syntax = "proto2";
edition = "2023";
package protobuf.experimental;
option features.utf8_validation = NONE;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto2Testing";
message Proto2SpecialFieldName {
optional double regular_name = 1;
optional int32 cached_size = 2;
optional int64 serialized_size = 3;
optional string class = 4;
double regular_name = 1;
int32 cached_size = 2;
int64 serialized_size = 3;
string class = 4;
}
message Proto2Message {
enum TestEnum {
option features.enum_type = CLOSED;
ZERO = 0;
ONE = 1;
TWO = 2;
}
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2Message field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2Message field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2Message field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2Message field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
message FieldGroup49 {
int32 field_int32_50 = 50;
}
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;
@ -99,35 +138,75 @@ message Proto2Message {
sfixed64 field_sfixed64_66 = 66;
sint32 field_sint32_67 = 67;
sint64 field_sint64_68 = 68;
group FieldGroup69 = 69 {
optional int32 field_int32_70 = 70;
}
FieldGroup69 fieldgroup69 = 69 [features.message_encoding = DELIMITED];
}
message FieldGroup69 {
int32 field_int32_70 = 70;
}
message RequiredNestedMessage {
optional int32 value = 1;
int32 value = 1;
}
required double field_required_double_71 = 71;
required float field_required_float_72 = 72;
required int64 field_required_int64_73 = 73;
required uint64 field_required_uint64_74 = 74;
required int32 field_required_int32_75 = 75;
required fixed64 field_required_fixed64_76 = 76;
required fixed32 field_required_fixed32_77 = 77;
required bool field_required_bool_78 = 78;
required string field_required_string_79 = 79;
required RequiredNestedMessage field_required_message_80 = 80;
required bytes field_required_bytes_81 = 81;
required uint32 field_required_uint32_82 = 82;
required TestEnum field_required_enum_83 = 83;
required sfixed32 field_required_sfixed32_84 = 84;
required sfixed64 field_required_sfixed64_85 = 85;
required sint32 field_required_sint32_86 = 86;
required sint64 field_required_sint64_87 = 87;
required group FieldRequiredGroup88 = 88 {
optional int32 field_int32_89 = 89;
double field_required_double_71 = 71
[features.field_presence = LEGACY_REQUIRED];
float field_required_float_72 = 72
[features.field_presence = LEGACY_REQUIRED];
int64 field_required_int64_73 = 73
[features.field_presence = LEGACY_REQUIRED];
uint64 field_required_uint64_74 = 74
[features.field_presence = LEGACY_REQUIRED];
int32 field_required_int32_75 = 75
[features.field_presence = LEGACY_REQUIRED];
fixed64 field_required_fixed64_76 = 76
[features.field_presence = LEGACY_REQUIRED];
fixed32 field_required_fixed32_77 = 77
[features.field_presence = LEGACY_REQUIRED];
bool field_required_bool_78 = 78 [features.field_presence = LEGACY_REQUIRED];
string field_required_string_79 = 79
[features.field_presence = LEGACY_REQUIRED];
RequiredNestedMessage field_required_message_80 = 80
[features.field_presence = LEGACY_REQUIRED];
bytes field_required_bytes_81 = 81
[features.field_presence = LEGACY_REQUIRED];
uint32 field_required_uint32_82 = 82
[features.field_presence = LEGACY_REQUIRED];
TestEnum field_required_enum_83 = 83
[features.field_presence = LEGACY_REQUIRED];
sfixed32 field_required_sfixed32_84 = 84
[features.field_presence = LEGACY_REQUIRED];
sfixed64 field_required_sfixed64_85 = 85
[features.field_presence = LEGACY_REQUIRED];
sint32 field_required_sint32_86 = 86
[features.field_presence = LEGACY_REQUIRED];
sint64 field_required_sint64_87 = 87
[features.field_presence = LEGACY_REQUIRED];
message FieldRequiredGroup88 {
int32 field_int32_89 = 89;
}
FieldRequiredGroup88 fieldrequiredgroup88 = 88 [
features.field_presence = LEGACY_REQUIRED,
features.message_encoding = DELIMITED
];
}
message Proto2Empty {}
@ -137,65 +216,94 @@ message Proto2MessageWithExtensions {
}
extend Proto2MessageWithExtensions {
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2Message field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional Proto2Message.TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2Message field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated Proto2Message.TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated Proto2Message.TestEnum field_enum_list_packed_44 = 44
[packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
}
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2Message field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
Proto2Message.TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
}
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2Message field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated Proto2Message.TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated Proto2Message.TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
}
message FieldGroup49 {
int32 field_int32_50 = 50;
}
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
message Proto2MessageWithMaps {

@ -6,75 +6,114 @@
// https://developers.google.com/open-source/licenses/bsd
// LINT: ALLOW_GROUPS
syntax = "proto2";
edition = "2023";
package protobuf.experimental.lite;
option features.utf8_validation = NONE;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto2TestingLite";
message Proto2MessageLite {
enum TestEnum {
option features.enum_type = CLOSED;
ZERO = 0;
ONE = 1;
TWO = 2;
}
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2MessageLite field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2MessageLite field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2MessageLite field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2MessageLite field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
message FieldGroup49 {
int32 field_int32_50 = 50;
}
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;
@ -92,35 +131,75 @@ message Proto2MessageLite {
sfixed64 field_sfixed64_66 = 66;
sint32 field_sint32_67 = 67;
sint64 field_sint64_68 = 68;
group FieldGroup69 = 69 {
optional int32 field_int32_70 = 70;
}
FieldGroup69 fieldgroup69 = 69 [features.message_encoding = DELIMITED];
}
message FieldGroup69 {
int32 field_int32_70 = 70;
}
message RequiredNestedMessage {
optional int32 value = 1;
int32 value = 1;
}
required double field_required_double_71 = 71;
required float field_required_float_72 = 72;
required int64 field_required_int64_73 = 73;
required uint64 field_required_uint64_74 = 74;
required int32 field_required_int32_75 = 75;
required fixed64 field_required_fixed64_76 = 76;
required fixed32 field_required_fixed32_77 = 77;
required bool field_required_bool_78 = 78;
required string field_required_string_79 = 79;
required RequiredNestedMessage field_required_message_80 = 80;
required bytes field_required_bytes_81 = 81;
required uint32 field_required_uint32_82 = 82;
required TestEnum field_required_enum_83 = 83;
required sfixed32 field_required_sfixed32_84 = 84;
required sfixed64 field_required_sfixed64_85 = 85;
required sint32 field_required_sint32_86 = 86;
required sint64 field_required_sint64_87 = 87;
required group FieldRequiredGroup88 = 88 {
optional int32 field_int32_89 = 89;
double field_required_double_71 = 71
[features.field_presence = LEGACY_REQUIRED];
float field_required_float_72 = 72
[features.field_presence = LEGACY_REQUIRED];
int64 field_required_int64_73 = 73
[features.field_presence = LEGACY_REQUIRED];
uint64 field_required_uint64_74 = 74
[features.field_presence = LEGACY_REQUIRED];
int32 field_required_int32_75 = 75
[features.field_presence = LEGACY_REQUIRED];
fixed64 field_required_fixed64_76 = 76
[features.field_presence = LEGACY_REQUIRED];
fixed32 field_required_fixed32_77 = 77
[features.field_presence = LEGACY_REQUIRED];
bool field_required_bool_78 = 78 [features.field_presence = LEGACY_REQUIRED];
string field_required_string_79 = 79
[features.field_presence = LEGACY_REQUIRED];
RequiredNestedMessage field_required_message_80 = 80
[features.field_presence = LEGACY_REQUIRED];
bytes field_required_bytes_81 = 81
[features.field_presence = LEGACY_REQUIRED];
uint32 field_required_uint32_82 = 82
[features.field_presence = LEGACY_REQUIRED];
TestEnum field_required_enum_83 = 83
[features.field_presence = LEGACY_REQUIRED];
sfixed32 field_required_sfixed32_84 = 84
[features.field_presence = LEGACY_REQUIRED];
sfixed64 field_required_sfixed64_85 = 85
[features.field_presence = LEGACY_REQUIRED];
sint32 field_required_sint32_86 = 86
[features.field_presence = LEGACY_REQUIRED];
sint64 field_required_sint64_87 = 87
[features.field_presence = LEGACY_REQUIRED];
message FieldRequiredGroup88 {
int32 field_int32_89 = 89;
}
FieldRequiredGroup88 fieldrequiredgroup88 = 88 [
features.field_presence = LEGACY_REQUIRED,
features.message_encoding = DELIMITED
];
}
message Proto2EmptyLite {}
@ -130,65 +209,94 @@ message Proto2MessageLiteWithExtensions {
}
extend Proto2MessageLiteWithExtensions {
optional double field_double_1 = 1;
optional float field_float_2 = 2;
optional int64 field_int64_3 = 3;
optional uint64 field_uint64_4 = 4;
optional int32 field_int32_5 = 5;
optional fixed64 field_fixed64_6 = 6;
optional fixed32 field_fixed32_7 = 7;
optional bool field_bool_8 = 8;
optional string field_string_9 = 9;
optional Proto2MessageLite field_message_10 = 10;
optional bytes field_bytes_11 = 11;
optional uint32 field_uint32_12 = 12;
optional Proto2MessageLite.TestEnum field_enum_13 = 13;
optional sfixed32 field_sfixed32_14 = 14;
optional sfixed64 field_sfixed64_15 = 15;
optional sint32 field_sint32_16 = 16;
optional sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto2MessageLite field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated Proto2MessageLite.TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated Proto2MessageLite.TestEnum field_enum_list_packed_44 = 44
[packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
optional group FieldGroup49 = 49 {
optional int32 field_int32_50 = 50;
}
double field_double_1 = 1;
float field_float_2 = 2;
int64 field_int64_3 = 3;
uint64 field_uint64_4 = 4;
int32 field_int32_5 = 5;
fixed64 field_fixed64_6 = 6;
fixed32 field_fixed32_7 = 7;
bool field_bool_8 = 8;
string field_string_9 = 9;
Proto2MessageLite field_message_10 = 10;
bytes field_bytes_11 = 11;
uint32 field_uint32_12 = 12;
Proto2MessageLite.TestEnum field_enum_13 = 13;
sfixed32 field_sfixed32_14 = 14;
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated group FieldGroupList51 = 51 {
optional int32 field_int32_52 = 52;
}
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26;
repeated Proto2MessageLite field_message_list_27 = 27;
repeated bytes field_bytes_list_28 = 28;
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated Proto2MessageLite.TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated Proto2MessageLite.TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
FieldGroup49 fieldgroup49 = 49 [features.message_encoding = DELIMITED];
repeated FieldGroupList51 fieldgrouplist51 = 51
[features.message_encoding = DELIMITED];
}
message FieldGroup49 {
int32 field_int32_50 = 50;
}
message FieldGroupList51 {
int32 field_int32_52 = 52;
}
message Proto2MessageLiteWithMaps {

@ -5,15 +5,16 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package protobuf.testing.textformat.performance.proto2;
option features.repeated_field_encoding = EXPANDED;
option java_package = "com.google.protobuf.testing.textformat.performance.proto2";
option java_outer_classname = "Proto2TextFormatPerformanceProto";
message ContainsSubMessageWithRepeatedInt32 {
optional RepeatedInt32 sub_msg = 1;
RepeatedInt32 sub_msg = 1;
}
message RepeatedInt32 {
@ -25,5 +26,5 @@ message ContainsExtensionSubMessage {
}
extend ContainsExtensionSubMessage {
optional RepeatedInt32 sub_msg_ext = 1;
RepeatedInt32 sub_msg_ext = 1;
}

@ -5,10 +5,11 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package proto2_unknown_enum_values;
option features.enum_type = CLOSED;
option java_package = "com.google.protobuf";
option java_outer_classname = "Proto2UnknownEnumValuesTestProto";
@ -19,7 +20,7 @@ enum Proto2TestEnum {
}
message Proto2EnumMessage {
repeated Proto2TestEnum repeated_packed_enum = 1 [packed = true];
repeated Proto2TestEnum repeated_packed_enum = 1;
}
// An enum containing a subset of the values of Proto2TestEnum, to test
@ -27,11 +28,12 @@ message Proto2EnumMessage {
enum Proto2TestEnumSubset {
TESTENUM_SUBSET_ZERO = 0;
TESTENUM_SUBSET_ONE = 1;
// No enum value with number 2.
}
// Test messages for packed enum, with identical field number as
// Proto2Message, to test parsing unknown packed enums.
message Proto2EnumMessageWithEnumSubset {
repeated Proto2TestEnumSubset repeated_packed_enum = 1 [packed = true];
repeated Proto2TestEnumSubset repeated_packed_enum = 1;
}

@ -5,10 +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 protobuf.experimental;
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto3Testing";
@ -43,37 +44,72 @@ message Proto3Message {
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto3Message field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26
[features.repeated_field_encoding = EXPANDED];
repeated Proto3Message field_message_list_27 = 27
[features.repeated_field_encoding = EXPANDED];
repeated bytes field_bytes_list_28 = 28
[features.repeated_field_encoding = EXPANDED];
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;

@ -5,10 +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 protobuf.experimental;
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf.testing";
option java_outer_classname = "Proto3TestingLite";
@ -36,37 +37,72 @@ message Proto3MessageLite {
sfixed64 field_sfixed64_15 = 15;
sint32 field_sint32_16 = 16;
sint64 field_sint64_17 = 17;
repeated double field_double_list_18 = 18 [packed = false];
repeated float field_float_list_19 = 19 [packed = false];
repeated int64 field_int64_list_20 = 20 [packed = false];
repeated uint64 field_uint64_list_21 = 21 [packed = false];
repeated int32 field_int32_list_22 = 22 [packed = false];
repeated fixed64 field_fixed64_list_23 = 23 [packed = false];
repeated fixed32 field_fixed32_list_24 = 24 [packed = false];
repeated bool field_bool_list_25 = 25 [packed = false];
repeated string field_string_list_26 = 26 [packed = false];
repeated Proto3MessageLite field_message_list_27 = 27 [packed = false];
repeated bytes field_bytes_list_28 = 28 [packed = false];
repeated uint32 field_uint32_list_29 = 29 [packed = false];
repeated TestEnum field_enum_list_30 = 30 [packed = false];
repeated sfixed32 field_sfixed32_list_31 = 31 [packed = false];
repeated sfixed64 field_sfixed64_list_32 = 32 [packed = false];
repeated sint32 field_sint32_list_33 = 33 [packed = false];
repeated sint64 field_sint64_list_34 = 34 [packed = false];
repeated double field_double_list_packed_35 = 35 [packed = true];
repeated float field_float_list_packed_36 = 36 [packed = true];
repeated int64 field_int64_list_packed_37 = 37 [packed = true];
repeated uint64 field_uint64_list_packed_38 = 38 [packed = true];
repeated int32 field_int32_list_packed_39 = 39 [packed = true];
repeated fixed64 field_fixed64_list_packed_40 = 40 [packed = true];
repeated fixed32 field_fixed32_list_packed_41 = 41 [packed = true];
repeated bool field_bool_list_packed_42 = 42 [packed = true];
repeated uint32 field_uint32_list_packed_43 = 43 [packed = true];
repeated TestEnum field_enum_list_packed_44 = 44 [packed = true];
repeated sfixed32 field_sfixed32_list_packed_45 = 45 [packed = true];
repeated sfixed64 field_sfixed64_list_packed_46 = 46 [packed = true];
repeated sint32 field_sint32_list_packed_47 = 47 [packed = true];
repeated sint64 field_sint64_list_packed_48 = 48 [packed = true];
repeated double field_double_list_18 = 18
[features.repeated_field_encoding = EXPANDED];
repeated float field_float_list_19 = 19
[features.repeated_field_encoding = EXPANDED];
repeated int64 field_int64_list_20 = 20
[features.repeated_field_encoding = EXPANDED];
repeated uint64 field_uint64_list_21 = 21
[features.repeated_field_encoding = EXPANDED];
repeated int32 field_int32_list_22 = 22
[features.repeated_field_encoding = EXPANDED];
repeated fixed64 field_fixed64_list_23 = 23
[features.repeated_field_encoding = EXPANDED];
repeated fixed32 field_fixed32_list_24 = 24
[features.repeated_field_encoding = EXPANDED];
repeated bool field_bool_list_25 = 25
[features.repeated_field_encoding = EXPANDED];
repeated string field_string_list_26 = 26
[features.repeated_field_encoding = EXPANDED];
repeated Proto3MessageLite field_message_list_27 = 27
[features.repeated_field_encoding = EXPANDED];
repeated bytes field_bytes_list_28 = 28
[features.repeated_field_encoding = EXPANDED];
repeated uint32 field_uint32_list_29 = 29
[features.repeated_field_encoding = EXPANDED];
repeated TestEnum field_enum_list_30 = 30
[features.repeated_field_encoding = EXPANDED];
repeated sfixed32 field_sfixed32_list_31 = 31
[features.repeated_field_encoding = EXPANDED];
repeated sfixed64 field_sfixed64_list_32 = 32
[features.repeated_field_encoding = EXPANDED];
repeated sint32 field_sint32_list_33 = 33
[features.repeated_field_encoding = EXPANDED];
repeated sint64 field_sint64_list_34 = 34
[features.repeated_field_encoding = EXPANDED];
repeated double field_double_list_packed_35 = 35;
repeated float field_float_list_packed_36 = 36;
repeated int64 field_int64_list_packed_37 = 37;
repeated uint64 field_uint64_list_packed_38 = 38;
repeated int32 field_int32_list_packed_39 = 39;
repeated fixed64 field_fixed64_list_packed_40 = 40;
repeated fixed32 field_fixed32_list_packed_41 = 41;
repeated bool field_bool_list_packed_42 = 42;
repeated uint32 field_uint32_list_packed_43 = 43;
repeated TestEnum field_enum_list_packed_44 = 44;
repeated sfixed32 field_sfixed32_list_packed_45 = 45;
repeated sfixed64 field_sfixed64_list_packed_46 = 46;
repeated sint32 field_sint32_list_packed_47 = 47;
repeated sint64 field_sint64_list_packed_48 = 48;
oneof test_oneof {
double field_double_53 = 53;
float field_float_54 = 54;

@ -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 protobuf.testing.textformat.performance.proto3;
@ -13,7 +13,7 @@ option java_package = "com.google.protobuf.testing.textformat.performance.proto3
option java_outer_classname = "Proto3TextFormatPerformanceProto";
message ContainsSubMessageWithRepeatedInt32 {
optional RepeatedInt32 sub_msg = 1;
RepeatedInt32 sub_msg = 1;
}
message RepeatedInt32 {

@ -11,10 +11,13 @@
// though the same identifiers are used internally by the java code generator.
// LINT: LEGACY_NAMES
syntax = "proto2";
edition = "2023";
package io_protocol_tests;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option features.enum_type = CLOSED;
option java_generic_services = true; // auto-added
option java_package = "com.google.protobuf";
option java_outer_classname = "TestBadIdentifiersProto";
@ -24,19 +27,19 @@ option java_outer_classname = "TestBadIdentifiersProto";
// src/google/protobuf/compiler/java/java_helpers.cc
message ForbiddenWordsUnderscoreMessage {
// java.lang.Object
optional bool class = 1;
bool class = 1;
// com.google.protobuf.MessageLiteOrBuilder
optional bool default_instance_for_type = 2;
bool default_instance_for_type = 2;
// com.google.protobuf.MessageLite
optional bool parser_for_type = 3;
optional bool serialized_size = 4;
bool parser_for_type = 3;
bool serialized_size = 4;
// com.google.protobuf.MessageOrBuilder
optional bool all_fields = 5;
optional bool descriptor_for_type = 6;
optional bool initialization_error_string = 7;
optional bool unknown_fields = 8;
bool all_fields = 5;
bool descriptor_for_type = 6;
bool initialization_error_string = 7;
bool unknown_fields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool cached_size = 9;
bool cached_size = 9;
}
// Message with field names using leading underscores that conflict with
@ -44,20 +47,20 @@ message ForbiddenWordsUnderscoreMessage {
// src/google/protobuf/compiler/java/java_helpers.cc
message ForbiddenWordsLeadingUnderscoreMessage {
// java.lang.Object
optional bool _class = 1;
bool _class = 1;
// com.google.protobuf.MessageLiteOrBuilder
optional bool _default_instance_for_type = 2;
bool _default_instance_for_type = 2;
// com.google.protobuf.MessageLite
optional bool _parser_for_type = 3;
optional bool _serialized_size = 4;
bool _parser_for_type = 3;
bool _serialized_size = 4;
// com.google.protobuf.MessageOrBuilder
optional bool _all_fields = 5;
optional bool _descriptor_for_type = 6;
optional bool _initialization_error_string = 7;
bool _all_fields = 5;
bool _descriptor_for_type = 6;
bool _initialization_error_string = 7;
// TODO: re-enable
// optional bool _unknown_fields = 8;
// bool _unknown_fields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool _cached_size = 9;
bool _cached_size = 9;
}
// Message with field names in camel case that conflict with accessors in the
@ -65,32 +68,32 @@ message ForbiddenWordsLeadingUnderscoreMessage {
// src/google/protobuf/compiler/java/java_helpers.cc
message ForbiddenWordsCamelMessage {
// java.lang.Object
optional bool class = 1;
bool class = 1;
// com.google.protobuf.MessageLiteOrBuilder
optional bool defaultInstanceForType = 2;
bool defaultInstanceForType = 2;
// com.google.protobuf.MessageLite
optional bool serializedSize = 3;
optional bool parserForType = 4;
bool serializedSize = 3;
bool parserForType = 4;
// com.google.protobuf.MessageOrBuilder:
optional bool initializationErrorString = 5;
optional bool descriptorForType = 6;
optional bool allFields = 7;
bool initializationErrorString = 5;
bool descriptorForType = 6;
bool allFields = 7;
// TODO: re-enable
// optional bool unknownFields = 8;
// bool unknownFields = 8;
// obsolete. kept for backwards compatibility of generated code
optional bool cachedSize = 9;
bool cachedSize = 9;
}
message Descriptor {
option no_standard_descriptor_accessor = true;
optional string descriptor = 1;
string descriptor = 1;
message NestedDescriptor {
option no_standard_descriptor_accessor = true;
optional string descriptor = 1;
string descriptor = 1;
}
optional NestedDescriptor nested_descriptor = 2;
NestedDescriptor nested_descriptor = 2;
enum NestedEnum {
UNKNOWN = 0;
FOO = 1;
@ -102,7 +105,7 @@ message Parser {
UNKNOWN = 0;
PARSER = 1;
}
optional ParserEnum parser = 1;
ParserEnum parser = 1;
}
message Deprecated {
@ -114,38 +117,38 @@ message Deprecated {
BAR = 2 [deprecated = true];
}
optional int32 field1 = 1 [deprecated = true];
optional TestEnum field2 = 2 [deprecated = true];
optional ForbiddenWordsUnderscoreMessage field3 = 3 [deprecated = true];
int32 field1 = 1 [deprecated = true];
TestEnum field2 = 2 [deprecated = true];
ForbiddenWordsUnderscoreMessage field3 = 3 [deprecated = true];
}
message Override {
optional int32 override = 1;
int32 override = 1;
}
message Object {
optional int32 object = 1;
optional string string_object = 2;
int32 object = 1;
string string_object = 2;
}
message String {
optional string string = 1;
string string = 1;
}
message Integer {
optional int32 integer = 1;
int32 integer = 1;
}
message Long {
optional int32 long = 1;
int32 long = 1;
}
message Float {
optional float float = 1;
float float = 1;
}
message Double {
optional double double = 1;
double double = 1;
}
service TestConflictingMethodNames {
@ -168,11 +171,11 @@ message TestConflictingFieldNames {
repeated bytes bytes_field = 4;
repeated ForbiddenWordsUnderscoreMessage message_field = 5;
optional int32 int32_field_count = 11;
optional TestEnum enum_field_count = 12;
optional string string_field_count = 13;
optional bytes bytes_field_count = 14;
optional ForbiddenWordsUnderscoreMessage message_field_count = 15;
int32 int32_field_count = 11;
TestEnum enum_field_count = 12;
string string_field_count = 13;
bytes bytes_field_count = 14;
ForbiddenWordsUnderscoreMessage message_field_count = 15;
repeated int32 Int32Field = 21; // NO_PROTO3
repeated TestEnum EnumField = 22; // NO_PROTO3
@ -182,13 +185,14 @@ message TestConflictingFieldNames {
// This field conflicts with "int32_field" as they both generate
// the method getInt32FieldList().
required int32 int32_field_list = 31; // NO_PROTO3
int32 int32_field_list = 31
[features.field_presence = LEGACY_REQUIRED]; // NO_PROTO3
// These field pairs have the same Java converted name
optional string field_name = 32; // NO_PROTO3
optional string field__name = 33; // NO_PROTO3
optional int32 _2conflict = 34; // NO_PROTO3
optional int32 __2conflict = 35;
string field_name = 32; // NO_PROTO3
string field__name = 33; // NO_PROTO3
int32 _2conflict = 34; // NO_PROTO3
int32 __2conflict = 35;
extensions 1000 to max; // NO_PROTO3
@ -196,9 +200,9 @@ message TestConflictingFieldNames {
extend TestConflictingFieldNames { // NO_PROTO3
// We don't generate accessors for extensions so the following extension
// fields don't conflict with the repeated field "int64_field".
optional int64 int64_field_count = 1001; // NO_PROTO3
optional int64 int64_field_list = 1002; // NO_PROTO3
} // NO_PROTO3
int64 int64_field_count = 1001; // NO_PROTO3
int64 int64_field_list = 1002; // NO_PROTO3
} // NO_PROTO3
}
message TestMapField {
@ -210,12 +214,12 @@ message TestMapField {
}
message TestLeadingNumberFields {
optional int32 _30day_impressions = 1;
int32 _30day_impressions = 1;
repeated string _60day_impressions = 2;
optional string __2_underscores = 3;
string __2_underscores = 3;
repeated string __2repeated_underscores = 4;
optional int32 _32 = 32;
int32 _32 = 32;
repeated int64 _64 = 64;
}

@ -8,21 +8,23 @@
// Author: Jacob Butcher (jbaum@google.com)
//
// Test file option java_string_check_utf8.
syntax = "proto2";
edition = "2023";
package proto2_test_check_utf8;
option features.utf8_validation = VERIFY;
option java_outer_classname = "TestCheckUtf8";
option java_string_check_utf8 = true;
message StringWrapper {
required string req = 1;
optional string opt = 2;
string req = 1 [features.field_presence = LEGACY_REQUIRED];
string opt = 2;
repeated string rep = 3;
}
message BytesWrapper {
required bytes req = 1;
optional bytes opt = 2;
bytes req = 1 [features.field_presence = LEGACY_REQUIRED];
bytes opt = 2;
repeated bytes rep = 3;
}

@ -8,22 +8,24 @@
// Author: Jacob Butcher (jbaum@google.com)
//
// Test file option java_string_check_utf8.
syntax = "proto2";
edition = "2023";
package proto2_test_check_utf8_size;
option features.utf8_validation = VERIFY;
option java_outer_classname = "TestCheckUtf8Size";
option java_string_check_utf8 = true;
option optimize_for = CODE_SIZE;
message StringWrapperSize {
required string req = 1;
optional string opt = 2;
string req = 1 [features.field_presence = LEGACY_REQUIRED];
string opt = 2;
repeated string rep = 3;
}
message BytesWrapperSize {
required bytes req = 1;
optional bytes opt = 2;
bytes req = 1 [features.field_presence = LEGACY_REQUIRED];
bytes opt = 2;
repeated bytes rep = 3;
}

@ -5,12 +5,13 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto3";
edition = "2023";
package wrappers_test;
import "google/protobuf/wrappers.proto";
option features.field_presence = IMPLICIT;
option java_package = "com.google.protobuf.wrapperstest";
option java_outer_classname = "WrappersTestProto";

@ -22,6 +22,7 @@ internal_gen_kt_protos(
deps = [
"//:any_proto",
"//:api_proto",
"//:descriptor_proto",
"//:duration_proto",
"//:empty_proto",
"//:field_mask_proto",
@ -30,6 +31,7 @@ internal_gen_kt_protos(
"//:timestamp_proto",
"//:type_proto",
"//:wrappers_proto",
"//java/core:java_features_proto",
],
)
@ -53,7 +55,11 @@ kt_jvm_export(
],
maven_coordinates = "com.google.protobuf:protobuf-kotlin-lite:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "//java/kotlin-lite:pom_template.xml",
resources = ["//:well_known_type_protos"],
resources = [
"//:well_known_type_protos",
"//java/core:java_features_proto",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [
":lite_extensions",

@ -4,8 +4,11 @@
<exec executable="${protoc}">
<arg value="--kotlin_out=lite:${generated.sources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.java_source.dir}"/>
<arg value="${protobuf.java_source.dir}/main/java/com/google/protobuf/java_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>

@ -24,6 +24,7 @@ proto_lang_toolchain(
name = "toolchain",
# keep this in sync w/ LITE_WELL_KNOWN_PROTO_MAP in //:BUILD
blacklisted_protos = [
"//java/core:java_features_proto",
"//:any_proto",
"//:api_proto",
"//:duration_proto",
@ -60,6 +61,7 @@ build_test(
conformance_test(
name = "conformance_test",
failure_list = "//conformance:failure_list_java_lite.txt",
maximum_edition = "2023",
testee = "//conformance:conformance_java_lite",
text_format_failure_list = "//conformance:text_format_failure_list_java_lite.txt",
)

@ -4,8 +4,11 @@
<exec executable="${protoc}">
<arg value="--java_out=lite:${generated.sources.dir}"/>
<arg value="--proto_path=${protobuf.source.dir}"/>
<arg value="--proto_path=${protobuf.java_source.dir}"/>
<arg value="${protobuf.java_source.dir}/main/java/com/google/protobuf/java_features.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/any.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/api.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/duration.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/empty.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/field_mask.proto"/>

@ -47,6 +47,7 @@
<includes>
<include>google/protobuf/any.proto</include>
<include>google/protobuf/api.proto</include>
<include>google/protobuf/descriptor.proto</include>
<include>google/protobuf/duration.proto</include>
<include>google/protobuf/empty.proto</include>
<include>google/protobuf/field_mask.proto</include>
@ -57,6 +58,12 @@
<include>google/protobuf/wrappers.proto</include>
</includes>
</resource>
<resource>
<directory>${protobuf.java_source.dir}</directory>
<includes>
<include>main/java/com/google/protobuf/java_features.proto</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>

@ -2657,14 +2657,6 @@ bool CommandLineInterface::GenerateOutput(
return false;
}
// TODO: Remove once Java lite supports editions.
if (output_directive.name == "--java_out" && experimental_editions_) {
if (!parameters.empty()) {
parameters.append(",");
}
parameters.append("experimental_editions");
}
if (!output_directive.generator->GenerateAll(parsed_files, parameters,
generator_context, &error)) {
// Generator returned an error.

@ -55,7 +55,6 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
file_options.opensource_runtime = opensource_runtime_;
bool enforce_editions = true;
for (auto& option : options) {
if (option.first == "output_list_file") {
file_options.output_list_file = option.second;
@ -75,8 +74,6 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
file_options.annotation_list_file = option.second;
} else if (option.first == "experimental_strip_nonfunctional_codegen") {
file_options.strip_nonfunctional_codegen = true;
} else if (option.first == "experimental_editions") {
enforce_editions = false;
} else {
*error = absl::StrCat("Unknown generator option: ", option.first);
return false;
@ -88,14 +85,6 @@ bool JavaGenerator::Generate(const FileDescriptor* file,
return false;
}
// TODO: Remove once Java lite supports editions
if (enforce_editions && !CanSkipEditionCheck(file->name()) &&
file_options.enforce_lite &&
GetEdition(*file) > google::protobuf::Edition::EDITION_PROTO3) {
*error = "lite runtime generator option cannot be used with editions yet.";
return false;
}
// By default we generate immutable code and shared code for immutable API.
if (!file_options.generate_immutable_code &&
!file_options.generate_mutable_code &&

@ -132,6 +132,13 @@ java_proto_library(
deps = [":test_messages_proto2_editions_proto"],
)
java_lite_proto_library(
name = "test_messages_proto2_editions_java_proto_lite",
testonly = True,
visibility = ["//conformance:__pkg__"],
deps = [":test_messages_proto2_editions_proto"],
)
py_proto_library(
name = "test_messages_proto2_editions_py_pb2",
testonly = True,
@ -193,6 +200,13 @@ java_proto_library(
deps = [":test_messages_proto3_editions_proto"],
)
java_lite_proto_library(
name = "test_messages_proto3_editions_java_proto_lite",
testonly = True,
visibility = ["//conformance:__pkg__"],
deps = [":test_messages_proto3_editions_proto"],
)
py_proto_library(
name = "test_messages_proto3_editions_py_pb2",
testonly = True,

@ -5,12 +5,14 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
import "google/protobuf/unittest_lite.proto";
option features.enum_type = CLOSED;
option features.utf8_validation = NONE;
option cc_enable_arenas = true;
option optimize_for = LITE_RUNTIME;
@ -94,15 +96,17 @@ enum MapEnumLite {
}
message TestRequiredLite {
required int32 a = 1;
required int32 b = 2;
required int32 c = 3;
int32 a = 1 [features.field_presence = LEGACY_REQUIRED];
int32 b = 2 [features.field_presence = LEGACY_REQUIRED];
int32 c = 3 [features.field_presence = LEGACY_REQUIRED];
extend TestAllExtensionsLite {
optional TestRequiredLite single = 1000;
TestRequiredLite single = 1000;
}
}
message ForeignMessageArenaLite {
optional int32 c = 1;
int32 c = 1;
}

@ -9,7 +9,7 @@
//
// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME.
syntax = "proto2";
edition = "2023";
package protobuf_unittest_import;
@ -19,10 +19,12 @@ option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
message ImportMessageLite {
optional int32 d = 1;
int32 d = 1;
}
enum ImportEnumLite {
option features.enum_type = CLOSED;
IMPORT_LITE_FOO = 7;
IMPORT_LITE_BAR = 8;
IMPORT_LITE_BAZ = 9;

@ -7,7 +7,7 @@
// Author: liujisi@google.com (Pherl Liu)
syntax = "proto2";
edition = "2023";
package protobuf_unittest_import;
@ -15,5 +15,5 @@ option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
message PublicImportMessageLite {
optional int32 e = 1;
int32 e = 1;
}

@ -9,12 +9,15 @@
//
// This is like unittest.proto but with optimize_for = LITE_RUNTIME.
syntax = "proto2";
edition = "2023";
package protobuf_unittest;
import "google/protobuf/unittest_import_lite.proto";
option features.enum_type = CLOSED;
option features.repeated_field_encoding = EXPANDED;
option features.utf8_validation = NONE;
option cc_enable_arenas = true;
option optimize_for = LITE_RUNTIME;
option java_package = "com.google.protobuf";
@ -22,13 +25,13 @@ option java_package = "com.google.protobuf";
// Same as TestAllTypes but with the lite runtime.
message TestAllTypesLite {
message NestedMessage {
optional int32 bb = 1;
optional int64 cc = 2;
repeated int32 dd = 3 [packed = true];
int32 bb = 1;
int64 cc = 2;
repeated int32 dd = 3 [features.repeated_field_encoding = PACKED];
}
message NestedMessage2 {
optional int32 dd = 1;
int32 dd = 1;
}
enum NestedEnum {
@ -38,45 +41,44 @@ message TestAllTypesLite {
}
// Singular
optional int32 optional_int32 = 1;
optional int64 optional_int64 = 2;
optional uint32 optional_uint32 = 3;
optional uint64 optional_uint64 = 4;
optional sint32 optional_sint32 = 5;
optional sint64 optional_sint64 = 6;
optional fixed32 optional_fixed32 = 7;
optional fixed64 optional_fixed64 = 8;
optional sfixed32 optional_sfixed32 = 9;
optional sfixed64 optional_sfixed64 = 10;
optional float optional_float = 11;
optional double optional_double = 12;
optional bool optional_bool = 13;
optional string optional_string = 14;
optional bytes optional_bytes = 15;
optional group OptionalGroup = 16 {
optional int32 a = 17;
int32 optional_int32 = 1;
int64 optional_int64 = 2;
uint32 optional_uint32 = 3;
uint64 optional_uint64 = 4;
sint32 optional_sint32 = 5;
sint64 optional_sint64 = 6;
fixed32 optional_fixed32 = 7;
fixed64 optional_fixed64 = 8;
sfixed32 optional_sfixed32 = 9;
sfixed64 optional_sfixed64 = 10;
float optional_float = 11;
double optional_double = 12;
bool optional_bool = 13;
string optional_string = 14;
bytes optional_bytes = 15;
message OptionalGroup {
int32 a = 17;
}
optional NestedMessage optional_nested_message = 18;
optional ForeignMessageLite optional_foreign_message = 19;
optional protobuf_unittest_import.ImportMessageLite optional_import_message =
20;
OptionalGroup optionalgroup = 16 [features.message_encoding = DELIMITED];
optional NestedEnum optional_nested_enum = 21;
optional ForeignEnumLite optional_foreign_enum = 22;
optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23;
NestedMessage optional_nested_message = 18;
ForeignMessageLite optional_foreign_message = 19;
protobuf_unittest_import.ImportMessageLite optional_import_message = 20;
NestedEnum optional_nested_enum = 21;
ForeignEnumLite optional_foreign_enum = 22;
protobuf_unittest_import.ImportEnumLite optional_import_enum = 23;
string optional_string_piece = 24 [ctype = STRING_PIECE];
optional string optional_string_piece = 24 [ctype = STRING_PIECE];
optional string optional_cord = 25 [ctype = CORD];
string optional_cord = 25 [ctype = CORD];
// Defined in unittest_import_public.proto
optional protobuf_unittest_import.PublicImportMessageLite
protobuf_unittest_import.PublicImportMessageLite
optional_public_import_message = 26;
NestedMessage optional_lazy_message = 27 [lazy = true];
optional NestedMessage optional_lazy_message = 27 [lazy = true];
optional NestedMessage optional_unverified_lazy_message = 28
[unverified_lazy = true];
NestedMessage optional_unverified_lazy_message = 28 [unverified_lazy = true];
// Repeated
repeated int32 repeated_int32 = 31;
@ -95,50 +97,67 @@ message TestAllTypesLite {
repeated string repeated_string = 44;
repeated bytes repeated_bytes = 45;
repeated group RepeatedGroup = 46 {
optional int32 a = 47;
message RepeatedGroup {
int32 a = 47;
}
repeated RepeatedGroup repeatedgroup = 46
[features.message_encoding = DELIMITED];
repeated NestedMessage repeated_nested_message = 48;
repeated ForeignMessageLite repeated_foreign_message = 49;
repeated protobuf_unittest_import.ImportMessageLite repeated_import_message =
50;
repeated NestedEnum repeated_nested_enum = 51;
repeated ForeignEnumLite repeated_foreign_enum = 52;
repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53;
repeated string repeated_string_piece = 54 [ctype = STRING_PIECE];
repeated string repeated_cord = 55 [ctype = CORD];
repeated NestedMessage repeated_lazy_message = 57 ;
repeated NestedMessage repeated_lazy_message = 57;
// Singular with defaults
optional int32 default_int32 = 61 [default = 41];
optional int64 default_int64 = 62 [default = 42];
optional uint32 default_uint32 = 63 [default = 43];
optional uint64 default_uint64 = 64 [default = 44];
optional sint32 default_sint32 = 65 [default = -45];
optional sint64 default_sint64 = 66 [default = 46];
optional fixed32 default_fixed32 = 67 [default = 47];
optional fixed64 default_fixed64 = 68 [default = 48];
optional sfixed32 default_sfixed32 = 69 [default = 49];
optional sfixed64 default_sfixed64 = 70 [default = -50];
optional float default_float = 71 [default = 51.5];
optional double default_double = 72 [default = 52e3];
optional bool default_bool = 73 [default = true];
optional string default_string = 74 [default = "hello"];
optional bytes default_bytes = 75 [default = "world"];
optional NestedEnum default_nested_enum = 81 [default = BAR];
optional ForeignEnumLite default_foreign_enum = 82
[default = FOREIGN_LITE_BAR];
optional protobuf_unittest_import.ImportEnumLite default_import_enum = 83
int32 default_int32 = 61 [default = 41];
int64 default_int64 = 62 [default = 42];
uint32 default_uint32 = 63 [default = 43];
uint64 default_uint64 = 64 [default = 44];
sint32 default_sint32 = 65 [default = -45];
sint64 default_sint64 = 66 [default = 46];
fixed32 default_fixed32 = 67 [default = 47];
fixed64 default_fixed64 = 68 [default = 48];
sfixed32 default_sfixed32 = 69 [default = 49];
sfixed64 default_sfixed64 = 70 [default = -50];
float default_float = 71 [default = 51.5];
double default_double = 72 [default = 5.2e4];
bool default_bool = 73 [default = true];
string default_string = 74 [default = "hello"];
bytes default_bytes = 75 [default = "world"];
NestedEnum default_nested_enum = 81 [default = BAR];
ForeignEnumLite default_foreign_enum = 82 [default = FOREIGN_LITE_BAR];
protobuf_unittest_import.ImportEnumLite default_import_enum = 83
[default = IMPORT_LITE_BAR];
optional string default_string_piece = 84
[ctype = STRING_PIECE, default = "abc"];
optional string default_cord = 85 [ctype = CORD, default = "123"];
string default_string_piece = 84 [ctype = STRING_PIECE, default = "abc"];
string default_cord = 85 [ctype = CORD, default = "123"];
// For oneof test
oneof oneof_field {
@ -147,15 +166,16 @@ message TestAllTypesLite {
string oneof_string = 113;
bytes oneof_bytes = 114;
NestedMessage oneof_lazy_nested_message = 115 [lazy = true];
NestedMessage2 oneof_nested_message2 = 117;
}
// Tests toString for non-repeated fields with a list suffix
optional int32 deceptively_named_list = 116;
int32 deceptively_named_list = 116;
}
message ForeignMessageLite {
optional int32 c = 1;
int32 c = 1;
}
enum ForeignEnumLite {
@ -165,20 +185,43 @@ enum ForeignEnumLite {
}
message TestPackedTypesLite {
repeated int32 packed_int32 = 90 [packed = true];
repeated int64 packed_int64 = 91 [packed = true];
repeated uint32 packed_uint32 = 92 [packed = true];
repeated uint64 packed_uint64 = 93 [packed = true];
repeated sint32 packed_sint32 = 94 [packed = true];
repeated sint64 packed_sint64 = 95 [packed = true];
repeated fixed32 packed_fixed32 = 96 [packed = true];
repeated fixed64 packed_fixed64 = 97 [packed = true];
repeated sfixed32 packed_sfixed32 = 98 [packed = true];
repeated sfixed64 packed_sfixed64 = 99 [packed = true];
repeated float packed_float = 100 [packed = true];
repeated double packed_double = 101 [packed = true];
repeated bool packed_bool = 102 [packed = true];
repeated ForeignEnumLite packed_enum = 103 [packed = true];
repeated int32 packed_int32 = 90 [features.repeated_field_encoding = PACKED];
repeated int64 packed_int64 = 91 [features.repeated_field_encoding = PACKED];
repeated uint32 packed_uint32 = 92
[features.repeated_field_encoding = PACKED];
repeated uint64 packed_uint64 = 93
[features.repeated_field_encoding = PACKED];
repeated sint32 packed_sint32 = 94
[features.repeated_field_encoding = PACKED];
repeated sint64 packed_sint64 = 95
[features.repeated_field_encoding = PACKED];
repeated fixed32 packed_fixed32 = 96
[features.repeated_field_encoding = PACKED];
repeated fixed64 packed_fixed64 = 97
[features.repeated_field_encoding = PACKED];
repeated sfixed32 packed_sfixed32 = 98
[features.repeated_field_encoding = PACKED];
repeated sfixed64 packed_sfixed64 = 99
[features.repeated_field_encoding = PACKED];
repeated float packed_float = 100 [features.repeated_field_encoding = PACKED];
repeated double packed_double = 101
[features.repeated_field_encoding = PACKED];
repeated bool packed_bool = 102 [features.repeated_field_encoding = PACKED];
repeated ForeignEnumLite packed_enum = 103
[features.repeated_field_encoding = PACKED];
}
message TestAllExtensionsLite {
@ -187,49 +230,43 @@ message TestAllExtensionsLite {
extend TestAllExtensionsLite {
// Singular
optional int32 optional_int32_extension_lite = 1;
optional int64 optional_int64_extension_lite = 2;
optional uint32 optional_uint32_extension_lite = 3;
optional uint64 optional_uint64_extension_lite = 4;
optional sint32 optional_sint32_extension_lite = 5;
optional sint64 optional_sint64_extension_lite = 6;
optional fixed32 optional_fixed32_extension_lite = 7;
optional fixed64 optional_fixed64_extension_lite = 8;
optional sfixed32 optional_sfixed32_extension_lite = 9;
optional sfixed64 optional_sfixed64_extension_lite = 10;
optional float optional_float_extension_lite = 11;
optional double optional_double_extension_lite = 12;
optional bool optional_bool_extension_lite = 13;
optional string optional_string_extension_lite = 14;
optional bytes optional_bytes_extension_lite = 15;
optional group OptionalGroup_extension_lite = 16 {
optional int32 a = 17;
}
optional TestAllTypesLite.NestedMessage
optional_nested_message_extension_lite = 18;
optional ForeignMessageLite optional_foreign_message_extension_lite = 19;
optional protobuf_unittest_import.ImportMessageLite
int32 optional_int32_extension_lite = 1;
int64 optional_int64_extension_lite = 2;
uint32 optional_uint32_extension_lite = 3;
uint64 optional_uint64_extension_lite = 4;
sint32 optional_sint32_extension_lite = 5;
sint64 optional_sint64_extension_lite = 6;
fixed32 optional_fixed32_extension_lite = 7;
fixed64 optional_fixed64_extension_lite = 8;
sfixed32 optional_sfixed32_extension_lite = 9;
sfixed64 optional_sfixed64_extension_lite = 10;
float optional_float_extension_lite = 11;
double optional_double_extension_lite = 12;
bool optional_bool_extension_lite = 13;
string optional_string_extension_lite = 14;
bytes optional_bytes_extension_lite = 15;
OptionalGroup_extension_lite optionalgroup_extension_lite = 16
[features.message_encoding = DELIMITED];
TestAllTypesLite.NestedMessage optional_nested_message_extension_lite = 18;
ForeignMessageLite optional_foreign_message_extension_lite = 19;
protobuf_unittest_import.ImportMessageLite
optional_import_message_extension_lite = 20;
TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21;
ForeignEnumLite optional_foreign_enum_extension_lite = 22;
protobuf_unittest_import.ImportEnumLite optional_import_enum_extension_lite =
23;
string optional_string_piece_extension_lite = 24 [ctype = STRING_PIECE];
optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21;
optional ForeignEnumLite optional_foreign_enum_extension_lite = 22;
optional protobuf_unittest_import.ImportEnumLite
optional_import_enum_extension_lite = 23;
optional string optional_string_piece_extension_lite = 24
[ctype = STRING_PIECE];
// TODO: ctype=CORD is not supported for extension. Add
// ctype=CORD option back after it is supported.
optional string optional_cord_extension_lite = 25;
optional protobuf_unittest_import.PublicImportMessageLite
string optional_cord_extension_lite = 25;
protobuf_unittest_import.PublicImportMessageLite
optional_public_import_message_extension_lite = 26;
TestAllTypesLite.NestedMessage optional_lazy_message_extension_lite = 27
[lazy = true];
optional TestAllTypesLite.NestedMessage optional_lazy_message_extension_lite =
27 [lazy = true];
optional TestAllTypesLite.NestedMessage
TestAllTypesLite.NestedMessage
optional_unverified_lazy_message_extension_lite = 28
[unverified_lazy = true];
@ -249,67 +286,87 @@ extend TestAllExtensionsLite {
repeated bool repeated_bool_extension_lite = 43;
repeated string repeated_string_extension_lite = 44;
repeated bytes repeated_bytes_extension_lite = 45;
repeated group RepeatedGroup_extension_lite = 46 {
optional int32 a = 47;
}
repeated RepeatedGroup_extension_lite repeatedgroup_extension_lite = 46
[features.message_encoding = DELIMITED];
repeated TestAllTypesLite.NestedMessage
repeated_nested_message_extension_lite = 48;
repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49;
repeated protobuf_unittest_import.ImportMessageLite
repeated_import_message_extension_lite = 50;
repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51;
repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52;
repeated protobuf_unittest_import.ImportEnumLite
repeated_import_enum_extension_lite = 53;
repeated string repeated_string_piece_extension_lite = 54
[ctype = STRING_PIECE];
// TODO: ctype=CORD is not supported for extension. Add
// ctype=CORD option back after it is supported.
repeated string repeated_cord_extension_lite = 55;
repeated TestAllTypesLite.NestedMessage repeated_lazy_message_extension_lite =
57 [lazy = true];
// Singular with defaults
optional int32 default_int32_extension_lite = 61 [default = 41];
optional int64 default_int64_extension_lite = 62 [default = 42];
optional uint32 default_uint32_extension_lite = 63 [default = 43];
optional uint64 default_uint64_extension_lite = 64 [default = 44];
optional sint32 default_sint32_extension_lite = 65 [default = -45];
optional sint64 default_sint64_extension_lite = 66 [default = 46];
optional fixed32 default_fixed32_extension_lite = 67 [default = 47];
optional fixed64 default_fixed64_extension_lite = 68 [default = 48];
optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49];
optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50];
optional float default_float_extension_lite = 71 [default = 51.5];
optional double default_double_extension_lite = 72 [default = 52e3];
optional bool default_bool_extension_lite = 73 [default = true];
optional string default_string_extension_lite = 74 [default = "hello"];
optional bytes default_bytes_extension_lite = 75 [default = "world"];
optional TestAllTypesLite.NestedEnum default_nested_enum_extension_lite = 81
int32 default_int32_extension_lite = 61 [default = 41];
int64 default_int64_extension_lite = 62 [default = 42];
uint32 default_uint32_extension_lite = 63 [default = 43];
uint64 default_uint64_extension_lite = 64 [default = 44];
sint32 default_sint32_extension_lite = 65 [default = -45];
sint64 default_sint64_extension_lite = 66 [default = 46];
fixed32 default_fixed32_extension_lite = 67 [default = 47];
fixed64 default_fixed64_extension_lite = 68 [default = 48];
sfixed32 default_sfixed32_extension_lite = 69 [default = 49];
sfixed64 default_sfixed64_extension_lite = 70 [default = -50];
float default_float_extension_lite = 71 [default = 51.5];
double default_double_extension_lite = 72 [default = 5.2e4];
bool default_bool_extension_lite = 73 [default = true];
string default_string_extension_lite = 74 [default = "hello"];
bytes default_bytes_extension_lite = 75 [default = "world"];
TestAllTypesLite.NestedEnum default_nested_enum_extension_lite = 81
[default = BAR];
optional ForeignEnumLite default_foreign_enum_extension_lite = 82
ForeignEnumLite default_foreign_enum_extension_lite = 82
[default = FOREIGN_LITE_BAR];
optional protobuf_unittest_import.ImportEnumLite
default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR];
optional string default_string_piece_extension_lite = 84
protobuf_unittest_import.ImportEnumLite default_import_enum_extension_lite = 83
[default = IMPORT_LITE_BAR];
string default_string_piece_extension_lite = 84
[ctype = STRING_PIECE, default = "abc"];
// TODO: ctype=CORD is not supported for extension. Add
// ctype=CORD option back after it is supported.
optional string default_cord_extension_lite = 85 [default = "123"];
string default_cord_extension_lite = 85 [default = "123"];
// For oneof test
optional uint32 oneof_uint32_extension_lite = 111;
optional TestAllTypesLite.NestedMessage oneof_nested_message_extension_lite =
112;
optional string oneof_string_extension_lite = 113;
optional bytes oneof_bytes_extension_lite = 114;
uint32 oneof_uint32_extension_lite = 111;
TestAllTypesLite.NestedMessage oneof_nested_message_extension_lite = 112;
string oneof_string_extension_lite = 113;
bytes oneof_bytes_extension_lite = 114;
}
message OptionalGroup_extension_lite {
int32 a = 17;
}
message RepeatedGroup_extension_lite {
int32 a = 47;
}
message TestPackedExtensionsLite {
@ -317,35 +374,66 @@ message TestPackedExtensionsLite {
}
extend TestPackedExtensionsLite {
repeated int32 packed_int32_extension_lite = 90 [packed = true];
repeated int64 packed_int64_extension_lite = 91 [packed = true];
repeated uint32 packed_uint32_extension_lite = 92 [packed = true];
repeated uint64 packed_uint64_extension_lite = 93 [packed = true];
repeated sint32 packed_sint32_extension_lite = 94 [packed = true];
repeated sint64 packed_sint64_extension_lite = 95 [packed = true];
repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true];
repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true];
repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true];
repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true];
repeated float packed_float_extension_lite = 100 [packed = true];
repeated double packed_double_extension_lite = 101 [packed = true];
repeated bool packed_bool_extension_lite = 102 [packed = true];
repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true];
repeated int32 packed_int32_extension_lite = 90
[features.repeated_field_encoding = PACKED];
repeated int64 packed_int64_extension_lite = 91
[features.repeated_field_encoding = PACKED];
repeated uint32 packed_uint32_extension_lite = 92
[features.repeated_field_encoding = PACKED];
repeated uint64 packed_uint64_extension_lite = 93
[features.repeated_field_encoding = PACKED];
repeated sint32 packed_sint32_extension_lite = 94
[features.repeated_field_encoding = PACKED];
repeated sint64 packed_sint64_extension_lite = 95
[features.repeated_field_encoding = PACKED];
repeated fixed32 packed_fixed32_extension_lite = 96
[features.repeated_field_encoding = PACKED];
repeated fixed64 packed_fixed64_extension_lite = 97
[features.repeated_field_encoding = PACKED];
repeated sfixed32 packed_sfixed32_extension_lite = 98
[features.repeated_field_encoding = PACKED];
repeated sfixed64 packed_sfixed64_extension_lite = 99
[features.repeated_field_encoding = PACKED];
repeated float packed_float_extension_lite = 100
[features.repeated_field_encoding = PACKED];
repeated double packed_double_extension_lite = 101
[features.repeated_field_encoding = PACKED];
repeated bool packed_bool_extension_lite = 102
[features.repeated_field_encoding = PACKED];
repeated ForeignEnumLite packed_enum_extension_lite = 103
[features.repeated_field_encoding = PACKED];
}
message TestNestedExtensionLite {
extend TestAllExtensionsLite {
optional int32 nested_extension = 12345;
int32 nested_extension = 12345;
}
}
// Test that deprecated fields work. We only verify that they compile (at one
// point this failed).
message TestDeprecatedLite {
optional int32 deprecated_field = 1 [deprecated = true];
required int32 deprecated_field2 = 2 [deprecated = true];
optional string deprecated_field3 = 3 [deprecated = true];
optional TestDeprecatedLite deprecated_field4 = 4 [deprecated = true];
int32 deprecated_field = 1 [deprecated = true];
int32 deprecated_field2 = 2
[features.field_presence = LEGACY_REQUIRED, deprecated = true];
string deprecated_field3 = 3 [deprecated = true];
TestDeprecatedLite deprecated_field4 = 4 [deprecated = true];
}
// See the comments of the same type in unittest.proto.
@ -354,27 +442,46 @@ message TestParsingMergeLite {
repeated TestAllTypesLite field1 = 1;
repeated TestAllTypesLite field2 = 2;
repeated TestAllTypesLite field3 = 3;
repeated group Group1 = 10 {
optional TestAllTypesLite field1 = 11;
message Group1 {
TestAllTypesLite field1 = 11;
}
repeated group Group2 = 20 {
optional TestAllTypesLite field1 = 21;
repeated Group1 group1 = 10 [features.message_encoding = DELIMITED];
message Group2 {
TestAllTypesLite field1 = 21;
}
repeated Group2 group2 = 20 [features.message_encoding = DELIMITED];
repeated TestAllTypesLite ext1 = 1000;
repeated TestAllTypesLite ext2 = 1001;
}
required TestAllTypesLite required_all_types = 1;
optional TestAllTypesLite optional_all_types = 2;
TestAllTypesLite required_all_types = 1
[features.field_presence = LEGACY_REQUIRED];
TestAllTypesLite optional_all_types = 2;
repeated TestAllTypesLite repeated_all_types = 3;
optional group OptionalGroup = 10 {
optional TestAllTypesLite optional_group_all_types = 11;
message OptionalGroup {
TestAllTypesLite optional_group_all_types = 11;
}
repeated group RepeatedGroup = 20 {
optional TestAllTypesLite repeated_group_all_types = 21;
OptionalGroup optionalgroup = 10 [features.message_encoding = DELIMITED];
message RepeatedGroup {
TestAllTypesLite repeated_group_all_types = 21;
}
repeated RepeatedGroup repeatedgroup = 20
[features.message_encoding = DELIMITED];
extensions 1000 to max;
extend TestParsingMergeLite {
optional TestAllTypesLite optional_ext = 1000;
TestAllTypesLite optional_ext = 1000;
repeated TestAllTypesLite repeated_ext = 1001;
}
}
@ -382,7 +489,7 @@ message TestParsingMergeLite {
// Test that the correct exception is thrown by parseFrom in a corner case
// involving merging, extensions, and required fields.
message TestMergeExceptionLite {
optional TestAllExtensionsLite all_extensions = 1;
TestAllExtensionsLite all_extensions = 1;
}
// TestEmptyMessageLite is used to test unknown fields support in lite mode.
@ -404,30 +511,36 @@ enum V2EnumLite {
}
message V1MessageLite {
required int32 int_field = 1;
optional V1EnumLite enum_field = 2 [default = V1_FIRST];
int32 int_field = 1 [features.field_presence = LEGACY_REQUIRED];
V1EnumLite enum_field = 2 [default = V1_FIRST];
}
message V2MessageLite {
required int32 int_field = 1;
optional V2EnumLite enum_field = 2 [default = V2_FIRST];
int32 int_field = 1 [features.field_presence = LEGACY_REQUIRED];
V2EnumLite enum_field = 2 [default = V2_FIRST];
}
message TestHugeFieldNumbersLite {
optional int32 optional_int32 = 536870000;
optional int32 fixed_32 = 536870001;
repeated int32 repeated_int32 = 536870002 [packed = false];
repeated int32 packed_int32 = 536870003 [packed = true];
optional ForeignEnumLite optional_enum = 536870004;
optional string optional_string = 536870005;
optional bytes optional_bytes = 536870006;
optional ForeignMessageLite optional_message = 536870007;
optional group OptionalGroup = 536870008 {
optional int32 group_a = 536870009;
int32 optional_int32 = 536870000;
int32 fixed_32 = 536870001;
repeated int32 repeated_int32 = 536870002;
repeated int32 packed_int32 = 536870003
[features.repeated_field_encoding = PACKED];
ForeignEnumLite optional_enum = 536870004;
string optional_string = 536870005;
bytes optional_bytes = 536870006;
ForeignMessageLite optional_message = 536870007;
message OptionalGroup {
int32 group_a = 536870009;
}
OptionalGroup optionalgroup = 536870008
[features.message_encoding = DELIMITED];
map<string, string> string_string_map = 536870010;
oneof oneof_field {
@ -445,7 +558,7 @@ message TestHugeFieldNumbersLite {
}
extend TestHugeFieldNumbersLite {
optional TestAllTypesLite test_all_types_lite = 536860000;
TestAllTypesLite test_all_types_lite = 536860000;
}
message TestOneofParsingLite {
@ -454,11 +567,16 @@ message TestOneofParsingLite {
TestAllTypesLite oneof_submessage = 2;
string oneof_string = 3;
bytes oneof_bytes = 4 [default = "default bytes"];
string oneof_string_cord = 5 [ctype = CORD, default = "default Cord"];
bytes oneof_bytes_cord = 6 [ctype = CORD];
string oneof_string_string_piece = 7 [ctype = STRING_PIECE];
bytes oneof_bytes_string_piece = 8
[ctype = STRING_PIECE, default = "default StringPiece"];
V2EnumLite oneof_enum = 9;
}
}
@ -473,7 +591,8 @@ message TestMessageSetLite {
// packed and non-packed repeated fields. We use the field number 2048, because
// that is large enough to require a 3-byte varint for the tag.
message PackedInt32 {
repeated int32 repeated_int32 = 2048 [packed = true];
repeated int32 repeated_int32 = 2048
[features.repeated_field_encoding = PACKED];
}
message NonPackedInt32 {
@ -481,7 +600,8 @@ message NonPackedInt32 {
}
message PackedFixed32 {
repeated fixed32 repeated_fixed32 = 2048 [packed = true];
repeated fixed32 repeated_fixed32 = 2048
[features.repeated_field_encoding = PACKED];
}
message NonPackedFixed32 {
@ -502,6 +622,6 @@ message DupEnum {
}
message RecursiveMessage {
optional RecursiveMessage recurse = 1;
optional bytes payload = 2;
RecursiveMessage recurse = 1;
bytes payload = 2;
}

Loading…
Cancel
Save