Skip to content

Commit

Permalink
Automated rollback of commit 1d7bda4.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 519177322
  • Loading branch information
mkruskal-google authored and copybara-github committed Mar 24, 2023
1 parent 620eebe commit 3e188b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/google/protobuf/compiler/java/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,11 @@ bool HasRequiredFields(const Descriptor* descriptor);
bool IsRealOneof(const FieldDescriptor* descriptor);

inline bool HasHasbit(const FieldDescriptor* descriptor) {
return internal::cpp::HasHasbit(descriptor);
// TODO(b/241441075) Replace this with internal::cpp::HasHasbit once Elysium
// unblocks this change.
return (FieldDescriptorLegacy(descriptor).has_optional_keyword() ||
descriptor->is_required()) &&
!descriptor->options().weak();
}

// Whether generate classes expose public PARSER instances.
Expand Down
6 changes: 2 additions & 4 deletions src/google/protobuf/compiler/java/message_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,8 @@ void ImmutableMessageFieldGenerator::GenerateBuilderMembers(

"$name$Builder_.mergeFrom(value);\n",

"if ($name$_ != null) {\n"
" $set_has_field_bit_builder$\n"
" $on_changed$\n"
"}\n"
"$set_has_field_bit_builder$\n"
"$on_changed$\n"
"return this;\n");

// Message.Builder clearField()
Expand Down

0 comments on commit 3e188b7

Please sign in to comment.