Warning, /include/google/protobuf/java_features.proto is written in an unsupported language. File is not indexed.
0001
0002 // Protocol Buffers - Google's data interchange format
0003 // Copyright 2023 Google Inc. All rights reserved.
0004 //
0005 // Use of this source code is governed by a BSD-style
0006 // license that can be found in the LICENSE file or at
0007 // https://developers.google.com/open-source/licenses/bsd
0008
0009 syntax = "proto2";
0010
0011 package pb;
0012
0013 import "google/protobuf/descriptor.proto";
0014
0015 option java_package = "com.google.protobuf";
0016 option java_outer_classname = "JavaFeaturesProto";
0017
0018 extend google.protobuf.FeatureSet {
0019 optional JavaFeatures java = 1001;
0020 }
0021
0022 message JavaFeatures {
0023 // Whether or not to treat an enum field as closed. This option is only
0024 // applicable to enum fields, and will be removed in the future. It is
0025 // consistent with the legacy behavior of using proto3 enum types for proto2
0026 // fields.
0027 optional bool legacy_closed_enum = 1 [
0028 retention = RETENTION_RUNTIME,
0029 targets = TARGET_TYPE_FIELD,
0030 targets = TARGET_TYPE_FILE,
0031 feature_support = {
0032 edition_introduced: EDITION_2023,
0033 edition_deprecated: EDITION_2023,
0034 deprecation_warning: "The legacy closed enum behavior in Java is "
0035 "deprecated and is scheduled to be removed in "
0036 "edition 2025. See http://protobuf.dev/programming-guides/enum/#java for "
0037 "more information.",
0038 },
0039 edition_defaults = { edition: EDITION_LEGACY, value: "true" },
0040 edition_defaults = { edition: EDITION_PROTO3, value: "false" }
0041 ];
0042
0043 // The UTF8 validation strategy to use.
0044 enum Utf8Validation {
0045 // Invalid default, which should never be used.
0046 UTF8_VALIDATION_UNKNOWN = 0;
0047 // Respect the UTF8 validation behavior specified by the global
0048 // utf8_validation feature.
0049 DEFAULT = 1;
0050 // Verifies UTF8 validity overriding the global utf8_validation
0051 // feature. This represents the legacy java_string_check_utf8 option.
0052 VERIFY = 2;
0053 }
0054 optional Utf8Validation utf8_validation = 2 [
0055 retention = RETENTION_RUNTIME,
0056 targets = TARGET_TYPE_FIELD,
0057 targets = TARGET_TYPE_FILE,
0058 feature_support = {
0059 edition_introduced: EDITION_2023,
0060 edition_deprecated: EDITION_2024,
0061 deprecation_warning: "The Java-specific utf8 validation feature is "
0062 "deprecated and is scheduled to be removed in "
0063 "edition 2025. Utf8 validation behavior should "
0064 "use the global cross-language utf8_validation "
0065 "feature.",
0066 },
0067 edition_defaults = { edition: EDITION_LEGACY, value: "DEFAULT" }
0068 ];
0069
0070 // Allows creation of large Java enums, extending beyond the standard
0071 // constant limits imposed by the Java language.
0072 optional bool large_enum = 3 [
0073 retention = RETENTION_RUNTIME,
0074 targets = TARGET_TYPE_ENUM,
0075 targets = TARGET_TYPE_FILE,
0076 feature_support = {
0077 edition_introduced: EDITION_2024,
0078 },
0079 edition_defaults = { edition: EDITION_LEGACY, value: "false" }
0080 ];
0081
0082 // Whether to use the old default outer class name scheme, or the new feature
0083 // which adds a "Proto" suffix to the outer class name.
0084 //
0085 // Users will not be able to set this option, because we removed it in the
0086 // same edition that it was introduced. But we use it to determine which
0087 // naming scheme to use for outer class name defaults.
0088 optional bool use_old_outer_classname_default = 4 [
0089 retention = RETENTION_RUNTIME,
0090 targets = TARGET_TYPE_FILE,
0091 feature_support = {
0092 edition_introduced: EDITION_2024,
0093 edition_removed: EDITION_2024,
0094 },
0095 edition_defaults = { edition: EDITION_LEGACY, value: "true" },
0096 edition_defaults = { edition: EDITION_2024, value: "false" }
0097 ];
0098
0099 message NestInFileClassFeature {
0100 enum NestInFileClass {
0101 // Invalid default, which should never be used.
0102 NEST_IN_FILE_CLASS_UNKNOWN = 0;
0103 // Do not nest the generated class in the file class.
0104 NO = 1;
0105 // Nest the generated class in the file class.
0106 YES = 2;
0107 // Fall back to the `java_multiple_files` option. Users won't be able to
0108 // set this option.
0109 LEGACY = 3 [feature_support = {
0110 edition_introduced: EDITION_2024
0111 edition_removed: EDITION_2024
0112 }];
0113 }
0114 reserved 1 to max;
0115 }
0116
0117 // Whether to nest the generated class in the generated file class. This is
0118 // only applicable to *top-level* messages, enums, and services.
0119 optional NestInFileClassFeature.NestInFileClass nest_in_file_class = 5 [
0120 retention = RETENTION_RUNTIME,
0121 targets = TARGET_TYPE_MESSAGE,
0122 targets = TARGET_TYPE_ENUM,
0123 targets = TARGET_TYPE_SERVICE,
0124 feature_support = {
0125 edition_introduced: EDITION_2024,
0126 },
0127 edition_defaults = { edition: EDITION_LEGACY, value: "LEGACY" },
0128 edition_defaults = { edition: EDITION_2024, value: "NO" }
0129 ];
0130
0131 reserved 6; // field `mutable_nest_in_file_class` removed.
0132 }