Skip to content

Commit 1e51d8c

Browse files
authored
Merge pull request #178 from Logofile/sync
Documentation update
2 parents 2498df9 + d45232c commit 1e51d8c

File tree

7 files changed

+42
-14
lines changed

7 files changed

+42
-14
lines changed

content/getting-started/pythontutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ compiler `protoc` on your `.proto`:
189189
`.proto`. In this case, you...:
190190

191191
```shell
192-
protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto
192+
protoc --proto_path=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/addressbook.proto
193193
```
194194

195195
Because you want Python classes, you use the `--python_out` option --

content/programming-guides/enum.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ behave.
103103

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

107118
### C# {#csharp}
108119

@@ -113,6 +124,18 @@ All known C# releases are out of conformance. C# treats all enums as **open**.
113124
All known Java releases are out of conformance. When a `proto2` file imports an
114125
enum defined in a `proto3` file, Java treats that field as a **closed** enum.
115126

127+
Under editions, this behavior is represented by the deprecated field feature
128+
[`features.(pb.java).legacy_closed_enum`](/editions/features#legacy_closed_enum)).
129+
There are two options for moving to conformant behavior:
130+
131+
* Remove the field feature. This may cause runtime behavior changes. Without
132+
the feature, unrecognized integers will end up stored in the field and the
133+
`UNRECOGNIZED` value will be returned by the enum getter. Before, these
134+
values would be put into the unknown field set.
135+
* Change the enum to closed. If *anybody else* is using it they may see
136+
runtime behavior changes. Unrecognized integers will end up in the unknown
137+
field set instead of those fields.
138+
116139
> **NOTE:** Java's handling of **open** enums has surprising edge cases. Given
117140
> the following definitions:
118141
>

content/programming-guides/proto-limits.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ sizes.
4444

4545
## Depth Limit for Proto Unmarshaling {#depth}
4646

47-
* Java: 100
48-
* C++: 100
47+
* Java:
48+
100
49+
* C++:
50+
100
4951
* Go:
5052
10000
5153
(there is a plan to reduce this to 100)

content/programming-guides/proto2.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,9 @@ symbolic constants with integer values in the runtime-generated class.
634634

635635
{{% alert title="Important" color="warning" %}} The
636636
generated code may be subject to language-specific limitations on the number of
637-
enumerators (low thousands for one language). Review the limitations for the
638-
languages you plan to use. {{% /alert %}}
637+
enumerators (low thousands for one language). Review the
638+
limitations for the languages you plan to use.
639+
{{% /alert %}}
639640

640641
{{% alert title="Important" color="warning" %}} For
641642
information on how enums should work contrasted with how they currently work in

content/programming-guides/proto3.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,9 @@ symbolic constants with integer values in the runtime-generated class.
684684

685685
{{% alert title="Important" color="warning" %}} The
686686
generated code may be subject to language-specific limitations on the number of
687-
enumerators (low thousands for one language). Review the limitations for the
688-
languages you plan to use. {{% /alert %}}
687+
enumerators (low thousands for one language). Review the
688+
limitations for the languages you plan to use.
689+
{{% /alert %}}
689690

690691
During deserialization, unrecognized enum values will be preserved in the
691692
message, though how this is represented when the message is deserialized is

content/reference/java/java-generated.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ implements the `Message.Builder` interface. It extends the
205205
`GeneratedMessage.Builder` class, but, again, this should be considered an
206206
implementation detail. Like `Foo`, `Foo.Builder` may rely on generic method
207207
implementations in `GeneratedMessage.Builder` or, when the `optimize_for` option
208-
is used, generated custom code that is much faster.
208+
is used, generated custom code that is much faster. You can get a `Foo.Builder`
209+
by calling the static method `Foo.newBuilder()`.
209210

210211
`Foo.Builder` does not define any static methods. Its interface is exactly as
211212
defined by the `Message.Builder` interface, with the exception that return types

content/reference/ruby/ruby-generated.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,12 @@ end
357357

358358
An enum module also defines the following utility methods:
359359

360-
- `Enum#lookup(number)`: Looks up the given number and returns its name, or
361-
`nil` if none was found. If more than one name has this number, returns the
362-
first that was defined.
363-
- `Enum#resolve(symbol)`: Returns the number for this enum name, or `nil` if
364-
none was found.
365-
- `Enum#descriptor`: Returns the descriptor for this enum.
360+
- `Foo::SomeEnum.lookup(number)`: Looks up the given number and returns its
361+
name, or `nil` if none was found. If more than one name has this number,
362+
returns the first that was defined.
363+
- `Foo::SomeEnum.resolve(symbol)`: Returns the number for this enum name, or
364+
`nil` if none was found.
365+
- `Foo::SomeEnum.descriptor`: Returns the descriptor for this enum.
366366

367367
## Oneof
368368

0 commit comments

Comments
 (0)