Skip to content

Commit 30b6251

Browse files
zhangskzcopybara-github
authored andcommitted
Automated rollback of commit 2a55706.
PiperOrigin-RevId: 569253919
1 parent 49f2388 commit 30b6251

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -2459,7 +2459,11 @@ public void clear(final GeneratedMessageV3.Builder<?> builder) {
24592459
final String containingOneofCamelCaseName) {
24602460
isOneofField =
24612461
descriptor.getRealContainingOneof() != null;
2462-
hasHasMethod = descriptor.hasPresence();
2462+
hasHasMethod =
2463+
descriptor.getFile().getSyntax() == FileDescriptor.Syntax.EDITIONS && descriptor.hasPresence()
2464+
|| descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO2
2465+
|| descriptor.hasOptionalKeyword()
2466+
|| (!isOneofField && descriptor.getJavaType() == FieldDescriptor.JavaType.MESSAGE);
24632467
ReflectionInvoker reflectionInvoker =
24642468
new ReflectionInvoker(
24652469
descriptor,

0 commit comments

Comments
 (0)