From aec4023f7130f0c2adf628c7692674641e59b79e Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Thu, 20 Nov 2025 13:10:54 -0800 Subject: [PATCH] Clean up java generated code to always mark private descriptor variable as final. This is already a private variable and should not break compatibility. PiperOrigin-RevId: 834882104 --- src/google/protobuf/compiler/java/file.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/google/protobuf/compiler/java/file.cc b/src/google/protobuf/compiler/java/file.cc index e18534c123e42..77f507ee68a9b 100644 --- a/src/google/protobuf/compiler/java/file.cc +++ b/src/google/protobuf/compiler/java/file.cc @@ -471,11 +471,9 @@ void FileGenerator::GenerateDescriptorInitializationCodeForImmutable( " getDescriptor() {\n" " return descriptor;\n" "}\n" - "private static $final$ com.google.protobuf.Descriptors.FileDescriptor\n" + "private static final com.google.protobuf.Descriptors.FileDescriptor\n" " descriptor;\n" - "static {\n", - // TODO: Mark this as final. - "final", google::protobuf::internal::IsOss() ? "" : "final"); + "static {\n"); printer->Indent(); if (google::protobuf::internal::IsOss()) {