We have an obscure bug where packed-by-default repeated custom options defined
in proto3 files are not correctly treated as packed when dynamic extensions are
used. This CL introduces a simple fix and adds a test verifying the correct
behavior.
The bug was not a major problem in most cases, since parsers will accept both
the packed and unpacked encodings. It is useful to fix this to ensure that
descriptors are serialized in a consistent way, though.
PiperOrigin-RevId: 513249881
Fixes#12081.
The issue was the call to `MaybeDetachComment`: the conditional assumed that there was a next token, which was on the same line as the previous one, making attribution unclear. However, if there is no next token, we should not detach.
The actual fix is a one-liner. The rest of this PR is updates to the tests to verify this behavior under a handful of scenarios.
Closes#12082
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12082 from jhump:jh/fix-trailing-comment-attribution 767e41cb05
PiperOrigin-RevId: 513046172
Fixes#12081.
The issue was the call to `MaybeDetachComment`: the conditional assumed that there was a next token, which was on the same line as the previous one, making attribution unclear. However, if there is no next token, we should not detach.
The actual fix is a one-liner. The rest of this PR is updates to the tests to verify this behavior under a handful of scenarios.
Closes#12082
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12082 from jhump:jh/fix-trailing-comment-attribution 767e41cb05
PiperOrigin-RevId: 513046172
By default all protos are included in proto instrumentation when inject_field_listener_events option is set. Adding proto instrumentation callbacks for every proto in the binary adds codesize and runtime performance penalties. This cl introduces 'protos_for_field_listener_events' option where a list of proto files can be provided (seperated by ':') for which field listener events will be injected.
For example :-
protos_for_field_listener_events=foo/bar/foo.proto:foo/bar.proto
The field listener event will only be sent for 'foo/bar/foo.proto' and 'foo/bar.proto'.
PiperOrigin-RevId: 512905094