• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google Inc.  All rights reserved.
3//
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
7
8syntax = "proto2";
9
10package pb;
11
12import "google/protobuf/descriptor.proto";
13
14option java_package = "com.google.protobuf";
15option java_outer_classname = "JavaFeaturesProto";
16
17extend google.protobuf.FeatureSet {
18  optional JavaFeatures java = 1001;
19}
20
21message JavaFeatures {
22  // Whether or not to treat an enum field as closed.  This option is only
23  // applicable to enum fields, and will be removed in the future.  It is
24  // consistent with the legacy behavior of using proto3 enum types for proto2
25  // fields.
26  optional bool legacy_closed_enum = 1 [
27    retention = RETENTION_RUNTIME,
28    targets = TARGET_TYPE_FIELD,
29    targets = TARGET_TYPE_FILE,
30    feature_support = {
31      edition_introduced: EDITION_2023,
32      edition_deprecated: EDITION_2023,
33      deprecation_warning: "The legacy closed enum behavior in Java is "
34                           "deprecated and is scheduled to be removed in "
35                           "edition 2025.  See http://protobuf.dev/programming-guides/enum/#java for "
36                           "more information.",
37    },
38    edition_defaults = { edition: EDITION_LEGACY, value: "true" },
39    edition_defaults = { edition: EDITION_PROTO3, value: "false" }
40  ];
41
42  // The UTF8 validation strategy to use.  See go/editions-utf8-validation for
43  // more information on this feature.
44  enum Utf8Validation {
45    // Invalid default, which should never be used.
46    UTF8_VALIDATION_UNKNOWN = 0;
47    // Respect the UTF8 validation behavior specified by the global
48    // utf8_validation feature.
49    DEFAULT = 1;
50    // Verifies UTF8 validity overriding the global utf8_validation
51    // feature. This represents the legacy java_string_check_utf8 option.
52    VERIFY = 2;
53  }
54  optional Utf8Validation utf8_validation = 2 [
55    retention = RETENTION_RUNTIME,
56    targets = TARGET_TYPE_FIELD,
57    targets = TARGET_TYPE_FILE,
58    feature_support = {
59      edition_introduced: EDITION_2023,
60      edition_deprecated: EDITION_2024,
61      deprecation_warning: "The Java-specific utf8 validation feature is "
62                           "deprecated and is scheduled to be removed in "
63                           "edition 2025.  Utf8 validation behavior should "
64                           "use the global cross-language utf8_validation "
65                           "feature.",
66    },
67    edition_defaults = { edition: EDITION_LEGACY, value: "DEFAULT" }
68  ];
69}
70