Skip to content

Commit 2a55706

Browse files
zhangskzcopybara-github
authored andcommitted
Migrate away from examining the syntax of a proto file via reflection.
PiperOrigin-RevId: 511796130
1 parent 684a3de commit 2a55706

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,10 +2407,7 @@ public void clear(final GeneratedMessageV3.Builder<?> builder) {
24072407
isOneofField =
24082408
descriptor.getContainingOneof() != null
24092409
&& !descriptor.getContainingOneof().isSynthetic();
2410-
hasHasMethod =
2411-
descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO2
2412-
|| descriptor.hasOptionalKeyword()
2413-
|| (!isOneofField && descriptor.getJavaType() == FieldDescriptor.JavaType.MESSAGE);
2410+
hasHasMethod = descriptor.hasPresence();
24142411
ReflectionInvoker reflectionInvoker =
24152412
new ReflectionInvoker(
24162413
descriptor,

0 commit comments

Comments
 (0)