Automated Code Change

PiperOrigin-RevId: 1002379893
diff --git a/hpb/BUILD b/hpb/BUILD
index d29e10f..89e65ea 100644
--- a/hpb/BUILD
+++ b/hpb/BUILD
@@ -5,14 +5,27 @@
 # license that can be found in the LICENSE file or at
 # https://developers.google.com/open-source/licenses/bsd
 
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
 load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
 load("@rules_cc//cc:cc_test.bzl", "cc_test")
 load("@rules_cc//cc:defs.bzl", "cc_library")
+load("//hpb:hpb_users.bzl", "HPB_USERS")
 
 package(default_applicable_licenses = ["//:license"])
 
 licenses(["notice"])
 
+package_group(
+    name = "hpb_users",
+    packages = HPB_USERS,
+)
+
+bzl_library(
+    name = "hpb_users_bzl",
+    srcs = ["hpb_users.bzl"],
+    visibility = ["//hpb:__subpackages__"],
+)
+
 string_flag(
     name = "hpb_backend",
     build_setting_default = "upb",
@@ -20,7 +33,7 @@
         "upb",
         "cpp",
     ],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
 )
 
 config_setting(
@@ -28,7 +41,7 @@
     flag_values = {
         ":hpb_backend": "upb",
     },
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
 )
 
 config_setting(
@@ -36,7 +49,7 @@
     flag_values = {
         ":hpb_backend": "cpp",
     },
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
 )
 
 cc_library(
@@ -44,7 +57,7 @@
     hdrs = [
         "hpb.h",
     ],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
     deps = [
         ":arena",
         ":extension",
@@ -88,7 +101,7 @@
     hdrs = [
         "repeated_field.h",
     ],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
     deps = [
         ":multibackend",
         ":ptr",
@@ -122,19 +135,19 @@
 cc_library(
     name = "requires",
     hdrs = ["requires.h"],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
 )
 
 cc_library(
     name = "ptr",
     hdrs = ["ptr.h"],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
 )
 
 cc_library(
     name = "arena",
     hdrs = ["arena.h"],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
     deps = [
         ":multibackend",
         "//hpb/backend:types",
@@ -152,7 +165,7 @@
     name = "status",
     srcs = ["status.cc"],
     hdrs = ["status.h"],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
     deps = [
         ":multibackend",
         "//hpb/backend:types",
@@ -182,7 +195,7 @@
     name = "extension",
     srcs = ["extension.cc"],
     hdrs = ["extension.h"],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
     deps = [
         ":arena",
         ":multibackend",
@@ -205,7 +218,7 @@
 cc_library(
     name = "options",
     hdrs = ["options.h"],
-    visibility = ["//visibility:public"],
+    visibility = [":hpb_users"],
     deps = [
         "//hpb:extension",
         "//hpb:multibackend",
diff --git a/hpb/bazel/BUILD b/hpb/bazel/BUILD
index 9460138..d5051d2 100644
--- a/hpb/bazel/BUILD
+++ b/hpb/bazel/BUILD
@@ -14,9 +14,10 @@
 bzl_library(
     name = "hpb_proto_library_bzl",
     srcs = ["hpb_proto_library.bzl"],
-    visibility = ["//visibility:public"],
+    visibility = ["//hpb:hpb_users"],
     deps = [
         "//bazel/common:proto_common_bzl",
+        "//hpb:hpb_users_bzl",
         "//upb/bazel:upb_proto_library_bzl",
         "@bazel_skylib//lib:paths",
         "@bazel_tools//tools/cpp:toolchain_utils.bzl",
diff --git a/hpb/bazel/hpb_proto_library.bzl b/hpb/bazel/hpb_proto_library.bzl
index 95fc8ad..24695e8 100644
--- a/hpb/bazel/hpb_proto_library.bzl
+++ b/hpb/bazel/hpb_proto_library.bzl
@@ -16,9 +16,12 @@
 load("//bazel/common:proto_common.bzl", "proto_common")
 load("//bazel/common:proto_info.bzl", "ProtoInfo")
 load("//bazel/common:proto_lang_toolchain_info.bzl", "ProtoLangToolchainInfo")
+load("//hpb:hpb_users.bzl", "HPB_USERS")
 load("//upb/bazel:upb_proto_library.bzl", "UpbWrappedCcInfo", "upb_proto_library_aspect")
 load("//upb/bazel/private:upb_proto_library_internal/cc_library_func.bzl", "cc_library_func")  # buildifier: disable=bzl-visibility
 
+visibility(HPB_USERS)
+
 def upb_use_cpp_toolchain():
     return use_cpp_toolchain()
 
diff --git a/hpb/hpb_users.bzl b/hpb/hpb_users.bzl
new file mode 100644
index 0000000..b9518f3
--- /dev/null
+++ b/hpb/hpb_users.bzl
@@ -0,0 +1,9 @@
+# Copyright (c) 2026, Google LLC
+# All rights reserved.
+#
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+visibility("public")
+HPB_USERS = ["public"]
diff --git a/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java b/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java
index 5540660..6c58497 100644
--- a/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/DebugFormatTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2024 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/GeneratedMessageLazyEqualsTest.java b/java/core/src/test/java/com/google/protobuf/GeneratedMessageLazyEqualsTest.java
index 12184e4..5df0493 100644
--- a/java/core/src/test/java/com/google/protobuf/GeneratedMessageLazyEqualsTest.java
+++ b/java/core/src/test/java/com/google/protobuf/GeneratedMessageLazyEqualsTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2026 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/GeneratorNamesTest.java b/java/core/src/test/java/com/google/protobuf/GeneratorNamesTest.java
index 2c18cfd..10a6c2a 100644
--- a/java/core/src/test/java/com/google/protobuf/GeneratorNamesTest.java
+++ b/java/core/src/test/java/com/google/protobuf/GeneratorNamesTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/ImportJavaFeaturesTest.java b/java/core/src/test/java/com/google/protobuf/ImportJavaFeaturesTest.java
index 8447269..ad392db 100644
--- a/java/core/src/test/java/com/google/protobuf/ImportJavaFeaturesTest.java
+++ b/java/core/src/test/java/com/google/protobuf/ImportJavaFeaturesTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2026 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/ImportOptionTest.java b/java/core/src/test/java/com/google/protobuf/ImportOptionTest.java
index f8788d6..40aaa01 100644
--- a/java/core/src/test/java/com/google/protobuf/ImportOptionTest.java
+++ b/java/core/src/test/java/com/google/protobuf/ImportOptionTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/IterableByteBufferInputStreamTest.java b/java/core/src/test/java/com/google/protobuf/IterableByteBufferInputStreamTest.java
index e269b5d..29da39a 100644
--- a/java/core/src/test/java/com/google/protobuf/IterableByteBufferInputStreamTest.java
+++ b/java/core/src/test/java/com/google/protobuf/IterableByteBufferInputStreamTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java b/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java
index 8254fd5..41131c1 100644
--- a/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/LegacyUnredactedTextFormatTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2024 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java b/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java
index bb9f1fd..c394b4e 100644
--- a/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java
+++ b/java/core/src/test/java/com/google/protobuf/ProtobufToStringOutputTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2024 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java b/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java
index e6796dd..96f47df 100644
--- a/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java
+++ b/java/core/src/test/java/com/google/protobuf/UnredactedDebugFormatForTestTest.java
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 package com.google.protobuf;
 
 import static com.google.common.truth.Truth.assertThat;
diff --git a/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto b/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto
index 225edd7..4523b2c 100644
--- a/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto
+++ b/java/core/src/test/proto/com/google/protobuf/field_name_clashes.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2024 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package protobuf_unittest;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_enum.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_enum.proto
index f0daf2a..0011471 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_enum.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_enum.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_message.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_message.proto
index 6a2164d..7dfdd09 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_message.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_message.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_enum.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_enum.proto
index 8a6fd5b..f84f091 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_enum.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_enum.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_message.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_message.proto
index e7f21cf..099007b 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_message.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_nested_message.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_service.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_service.proto
index 52dde7e..1661bb7 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_service.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_conflicting_service.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_edition2024_defaults.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_edition2024_defaults.proto
index c6fed12..b207f61 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_edition2024_defaults.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_edition2024_defaults.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2024";
 
 package protobuf.edition2024.defaults;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_generic_services.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_generic_services.proto
index 7b30d5c..01434a6 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_generic_services.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_generic_services.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto2.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto2.proto
index de9c456..5aa9d57 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto2.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto2.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 syntax = "proto2";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto3.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto3.proto
index 4f65aa5..0c81ea1 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto3.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_multiple_files_proto3.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 syntax = "proto3";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_nest_in_file_class.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_nest_in_file_class.proto
index d3844cf..5ba1c76 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_nest_in_file_class.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_nest_in_file_class.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2024";
 
 package protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_outer_classname.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_outer_classname.proto
index 6617029..ad1f23e 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_outer_classname.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_outer_classname.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/generator_names_pre2024_defaults.proto b/java/core/src/test/proto/com/google/protobuf/generator_names_pre2024_defaults.proto
index dc661fe..edd8ef0 100644
--- a/java/core/src/test/proto/com/google/protobuf/generator_names_pre2024_defaults.proto
+++ b/java/core/src/test/proto/com/google/protobuf/generator_names_pre2024_defaults.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2025 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2023";
 
 package com.google.protobuf;
diff --git a/java/core/src/test/proto/com/google/protobuf/test_import_java_features.proto b/java/core/src/test/proto/com/google/protobuf/test_import_java_features.proto
index c829ee6..3e1c503 100644
--- a/java/core/src/test/proto/com/google/protobuf/test_import_java_features.proto
+++ b/java/core/src/test/proto/com/google/protobuf/test_import_java_features.proto
@@ -1,3 +1,10 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2026 Google LLC
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+
 edition = "2024";
 
 package test;