Rewrote the comment about the `java_string_check_utf8` option to fix a few errors and omissions.

- The comment stated that the option does not affect lite, but this appears to be false: in my testing the option affects both lite and full protos.
- The comment failed to mention that the option has no effect when set explicitly to false. It can only be used to opt proto2 into extra checking, it cannot opt proto3 out of the checks.

PiperOrigin-RevId: 605097398
pull/15769/head
Joshua Haberman 1 year ago committed by Copybara-Service
parent afd1c0d653
commit 49fdc9d1cd
  1. 16
      src/google/protobuf/descriptor.proto

@ -448,12 +448,16 @@ message FileOptions {
// This option does nothing.
optional bool java_generate_equals_and_hash = 20 [deprecated=true];
// If set true, then the Java2 code generator will generate code that
// throws an exception whenever an attempt is made to assign a non-UTF-8
// byte sequence to a string field.
// Message reflection will do the same.
// However, an extension field still accepts non-UTF-8 byte sequences.
// This option has no effect on when used with the lite runtime.
// A proto2 file can set this to true to opt in to UTF-8 checking for Java,
// which will throw an exception if invalid UTF-8 is parsed from the wire or
// assigned to a string field.
//
// TODO: clarify exactly what kinds of field types this option
// applies to, and update these docs accordingly.
//
// Proto3 files already perform these checks. Setting the option explicitly to
// false has no effect: it cannot be used to opt proto3 files out of UTF-8
// checks.
optional bool java_string_check_utf8 = 27 [default = false];
// Generated classes can be optimized for speed or code size.

Loading…
Cancel
Save