From 7122ba1d0a93532324ab29cf05bd3fa4fd99e45e Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Thu, 20 Jun 2024 08:36:52 -0700 Subject: [PATCH] Java: Deprecate newExtensionWriter. New usages should use newExtensionSerializer, which can avoid allocations for empty field sets. PiperOrigin-RevId: 645044533 --- .../main/java/com/google/protobuf/GeneratedMessage.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java index 426adb61bf18..aeeeb94e3dc4 100644 --- a/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java +++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java @@ -1094,7 +1094,14 @@ public void writeUntil(final int end, final CodedOutputStream output) throws IOE } } - // TODO: Remove, replace with newExtensionSerializer(). + /** + * For compatibility with older gencode. + * + *

TODO Remove this in the next breaking release. + * + * @deprecated Use {@link newExtensionSerializer()} instead. + */ + @Deprecated protected ExtensionWriter newExtensionWriter() { return new ExtensionWriter(false); }