Skip to content

Commit 4424a85

Browse files
Protocol Buffer TeamLogofile
authored andcommitted
This documentation change includes the following:
* Pins the version for Hugo to prevent rendering issues * Corrects the protoc compiler command line in the Python tutorial * Adds additional information about enums and how they behave in editions * Adds information about how to get a Builder instance in Java * Corrects the names of methods for Ruby enums PiperOrigin-RevId: 663425236 Change-Id: Idb326bb419539b15e55cafec1d279bad8a7e45d1
1 parent afde7aa commit 4424a85

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

content/programming-guides/enum.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ open, and when importing from another editions file it uses the feature setting.
110110

111111
All known C++ releases are out of conformance. When a `proto2` file imports an
112112
enum defined in a `proto3` file, C++ treats that field as a **closed** enum.
113+
Under editions, this behavior is represented by the deprecated field feature
114+
[`features.(pb.cpp).legacy_closed_enum`](/editions/features#legacy_closed_enum).
115+
There are two options for moving to conformant behavior:
116+
117+
* Remove the field feature. This is the recommended approach, but may cause
118+
runtime behavior changes. Without the feature, unrecognized integers will
119+
end up stored in the field cast to the enum type instead of being put into
120+
the unknown field set.
121+
* Change the enum to closed. This is discouraged, and can cause runtime
122+
behavior if *anybody else* is using the enum. Unrecognized integers will end
123+
up in the unknown field set instead of those fields.
113124

114125
Under editions, this behavior is represented by the deprecated field feature
115126
[`features.(pb.cpp).legacy_closed_enum`](/editions/features#legacy_closed_enum).

0 commit comments

Comments
 (0)