We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49f2388 commit 30b6251Copy full SHA for 30b6251
java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
@@ -2459,7 +2459,11 @@ public void clear(final GeneratedMessageV3.Builder<?> builder) {
2459
final String containingOneofCamelCaseName) {
2460
isOneofField =
2461
descriptor.getRealContainingOneof() != null;
2462
- hasHasMethod = descriptor.hasPresence();
+ 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);
2467
ReflectionInvoker reflectionInvoker =
2468
new ReflectionInvoker(
2469
descriptor,
0 commit comments