Skip to content

Commit 9a50829

Browse files
zhangskzcopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 839390379
1 parent ca93842 commit 9a50829

File tree

1 file changed

+11
-9
lines changed
  • src/google/protobuf/compiler/java

1 file changed

+11
-9
lines changed

src/google/protobuf/compiler/java/file.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -482,24 +482,26 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable(
482482
} else {
483483
}
484484

485+
std::string method_prefix = "_clinit_autosplit_dinit";
485486
int bytecode_estimate = 0;
486487
int method_num = 0;
487-
488488
for (int i = 0; i < file_->message_type_count(); i++) {
489489
bytecode_estimate +=
490490
message_generators_[i]->GenerateStaticVariableInitializers(printer);
491491
MaybeRestartJavaMethod(
492492
printer, &bytecode_estimate, &method_num,
493-
"_clinit_autosplit_dinit_$method_num$();\n",
494-
"private static void _clinit_autosplit_dinit_$method_num$() {\n");
493+
"$method_prefix$_$method_num$();\n",
494+
"private static void $method_prefix$_$method_num$() {\n");
495495
}
496+
497+
496498
for (int i = 0; i < file_->extension_count(); i++) {
497499
bytecode_estimate +=
498500
extension_generators_[i]->GenerateNonNestedInitializationCode(printer);
499501
MaybeRestartJavaMethod(
500502
printer, &bytecode_estimate, &method_num,
501-
"_clinit_autosplit_dinit_$method_num$();\n",
502-
"private static void _clinit_autosplit_dinit_$method_num$() {\n");
503+
"$method_prefix$_$method_num$();\n",
504+
"private static void $method_prefix$_$method_num$() {\n");
503505
}
504506
// Feature resolution for Java features uses extension registry
505507
// which must happen after internalInit() from
@@ -548,8 +550,8 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable(
548550
bytecode_estimate += generator->GenerateRegistrationCode(printer);
549551
MaybeRestartJavaMethod(
550552
printer, &bytecode_estimate, &method_num,
551-
"_clinit_autosplit_dinit_$method_num$(registry);\n",
552-
"private static void _clinit_autosplit_dinit_$method_num$(\n"
553+
"$method_prefix$_$method_num$(registry);\n",
554+
"private static void $method_prefix$_$method_num$(\n"
553555
" com.google.protobuf.ExtensionRegistry registry) {\n");
554556
}
555557
for (const FieldDescriptor* field : optional_extensions) {
@@ -567,8 +569,8 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable(
567569
bytecode_estimate += 8;
568570
MaybeRestartJavaMethod(
569571
printer, &bytecode_estimate, &method_num,
570-
"_clinit_autosplit_dinit_$method_num$(registry);\n",
571-
"private static void _clinit_autosplit_dinit_$method_num$(\n"
572+
"$method_prefix$_$method_num$(registry);\n",
573+
"private static void $method_prefix$_$method_num$(\n"
572574
" com.google.protobuf.ExtensionRegistry registry) {\n");
573575
}
574576
printer->Print(

0 commit comments

Comments
 (0)