-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate away from examining the syntax of a proto file via reflection.
PiperOrigin-RevId: 511796130
- Loading branch information
1 parent
684a3de
commit 2a55706
Showing
1 changed file
with
1 addition
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2407,10 +2407,7 @@ public void clear(final GeneratedMessageV3.Builder<?> builder) { | |
isOneofField = | ||
descriptor.getContainingOneof() != null | ||
&& !descriptor.getContainingOneof().isSynthetic(); | ||
hasHasMethod = | ||
descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO2 | ||
|| descriptor.hasOptionalKeyword() | ||
|| (!isOneofField && descriptor.getJavaType() == FieldDescriptor.JavaType.MESSAGE); | ||
hasHasMethod = descriptor.hasPresence(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
zhangskz
Author
Member
|
||
ReflectionInvoker reflectionInvoker = | ||
new ReflectionInvoker( | ||
descriptor, | ||
|
@zhangskz this seems to be a breaking change for oneof: before this change, hasHasMethod for oneof will be false, but after this it will be true. When hasHasMethod is true, the generated codes for oneof need to have a hasXXX() method, which was introduced after 3.15 protoc. So for any generated codes from old protoc version, they will break when using this runtime, however it states here that for minor version older protoc should work on newer runtime